You want to delete Joomla users pro-grammatically (in any extensions like component). Leave it dude its easy just get user id & execute delete query on users & user_usergroup_map tables. Thats it. Okay you are right but don't you like to reduce the code? Just pass userid to getInstance & call delete method, that's it. You can see following function i have written for delete joomla 1.7 users.
function deleteuser()
{
$userid = JRequest::getInt('id'); // getting user id from url
$instance = JUser::getInstance($userid);
if($userid)
{
if($instance->delete())
{
return true;
}
}
}
Hope it will help you. However this is working fine for Joomla 1.7 . If you have any other ways you are welcome.
My Pleasure parker
ReplyDeleteTotally agree with you Atul
ReplyDeleteThank you for this post.
ReplyDeleteHere's a similar version as a stand-alone function:
function deleteUser($user_id) {
$user =& JFactory::getUser($user_id);
if ($user->delete()) {
return true;
}
}