Kunena 7.0.4 Released

The Kunena team has announce the arrival of Kunena 7.0.4 [K 7.0.4] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0

Topics that are moved into this category are generally considered to be closed. Users may want to add additional information but these topics should not be resurrected in order to discuss new problems or unrelated matters.

Question Delete user directly in kunena user administration

More
16 years 5 months ago #32762 by xillibit
Hello,

I have made a little hack which allow you to delete directly an user into kunena user administration, the user will be from joomla! too.

Add this in your administrator\components\com_kunena\language\kunena.yourlanguage.php :
Code:
define('_KUNENA_REMOVE', 'Remove');

Open the file administrator\components\com_kunena\toolbar.kunena.html.php and at line 97 add this :
Code:
JToolBarHelper::spacer(); JToolBarHelper::custom('removeprofile', 'delete.png', 'delete_f2.png', _KUNENA_REMOVE);

In administrator\components\com_kunena\admin.kunena.php add this at line 1181 :
Code:
function removeUserProfile($uid) { $kunena_db = &JFactory::getDBO(); $currentUser =& JFactory::getUser(); $acl =& JFactory::getACL(); foreach($uid as $id){ $objectID = $acl->get_object_id( 'users', $id, 'ARO' ); $groups = $acl->get_object_groups( $objectID, 'ARO' ); $this_group = strtolower( $acl->get_group_name( $groups[0], 'ARO' ) ); if ( $this_group == 'super administrator' ){ $msg = JText::_( 'You cannot delete a Super Administrator' ); } else if ( $id == $currentUser->get( 'id' ) ) { $msg = JText::_( 'You cannot delete Yourself!' ); } else { $user =& JUser::getInstance((int)$id); $user->delete(); $kunena_db->setQuery("DELETE FROM #__fb_users WHERE userid='$id'"); $kunena_db->query() or trigger_dberror('Unable to delete user profiles.'); $msg = JText::_( 'User(s) deleted' ); } echo $msg; } }

I don't provide support by PM, because this can be useful for someone else.

Please Log in or Create an account to join the conversation.

More
16 years 5 months ago #32764 by 810
Thanks, but the jtext is better if you change it to :

In administrator\components\com_kunena\admin.kunena.php add this at line 1181 :
Code:
function removeUserProfile($uid) { $kunena_db = &JFactory::getDBO(); $currentUser =& JFactory::getUser(); $acl =& JFactory::getACL(); foreach($uid as $id){ $objectID = $acl->get_object_id( 'users', $id, 'ARO' ); $groups = $acl->get_object_groups( $objectID, 'ARO' ); $this_group = strtolower( $acl->get_group_name( $groups[0], 'ARO' ) ); if ( $this_group == 'super administrator' ){ $msg = JText::_( "KUNENA_DELETE_CANNOT_DELETE_SUPERADMINISTRATOR" ); } else if ( $id == $currentUser->get( 'id' ) ) { $msg = JText::_( "KUNENA_DELETE_CANNOT_DELETE_YOURSELF" ); } else { $user =& JUser::getInstance((int)$id); $user->delete(); $kunena_db->setQuery("DELETE FROM #__fb_users WHERE userid='$id'"); $kunena_db->query() or trigger_dberror('Unable to delete user profiles.'); $msg = JText::_( "KUNENA_DELETE_USERS"); } echo $msg; } }

Add this in your administrator\components\com_kunena\language\kunena.yourlanguage.php :
Code:
define('_KUNENA_REMOVE', 'Remove'); define('_KUNENA_DELETE_CANNOT_DELETE_SUPERADMINISTRATOR', 'You cannot delete a Super Administrator'); define('_KUNENA_DELETE_CANNOT_DELETE_YOURSELF', 'You cannot delete Yourself'); define('_KUNENA_DELETE_USERS', 'User deleted');

Please Log in or Create an account to join the conversation.

Time to create page: 0.240 seconds