Documentation on Delete User

Permalink
In pursuing the documentation on Users, there is information on Add and Edit a user, but not on Delete a user. Where might I be able to find some documentation on deleting a user? All I have is 5.6 info.

Todd

rtcary
 
CMSDeveloper replied on at Permalink Reply
CMSDeveloper
Hi!

Select Dasboard --> Members
Click on MemberName (top-right, RED button) Delete.


.
rtcary replied on at Permalink Reply
rtcary
I need to create a custom block and need some documentation on deleting member(s) selectively -- according to factors that are not part of C5.

Todd
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi rtcary,

It looks like you can use the delete() method on a UserInfo object. You can get the UserInfo object by username, user ID, or user email.

Example:
$userInfoObject = UserInfo::getByID($userID);
if ($userInfoObject) {
    $userInfoObject->delete();
}


It looks like the getByID(), getByUserName(), and getByEmail() methods are deprecated.

The current way would be something like this:
$app = \Concrete\Core\Support\Facade\Application::getFacadeApplication();
$userInfoRepository = $app->make('Concrete\Core\User\UserInfoRepository');
$userInfoObject = $userInfoRepository->getByID($uID);
if ($userInfoObject) {
    $userInfoObject->delete();
}