Skip to content

Commit

Permalink
Add a remove function to User
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviocopes committed Oct 19, 2015
1 parent 5476ef4 commit 813ab70
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions system/src/Grav/Common/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ public static function load($username)
return $user;
}

/**
* Remove user account.
*
* @param string $username
* @return bool True is the action was performed
*/
public static function remove($username)
{
$file_path = self::getGrav()['locator']->findResource('account://' . $username . YAML_EXT);
if (file_exists($file_path) && unlink($file_path)) {
return true;
}

return false;
}

/**
* Authenticate user.
*
Expand Down

0 comments on commit 813ab70

Please sign in to comment.