english/libraries/joomla/user/helper.php
/**
	 * Method to remove a user from a group.
	 *
	 * @param   integer  $userId		The id of the user.
	 * @param   integer  $groupId	The id of the group.
	 *
	 * @return  mixed    Boolean true on success, JException on error.
	 * @since   11.1
	 */
Method to remove a user from a group.
@param   integer  $userId            The id of the user.
@param   integer  $groupId   The id of the group.

@return  mixed    Boolean true on success, JException on error.
Method to remove a user from a group . @param integer $userId The id of the user . @param integer $groupId The id of the group . @return mixed Boolean true on success JException on error .
public static function removeUserFromGroup($userId, $groupId)
	{
		$user = JUser::getInstance((int) $userId);
        $key = array_search($groupId, $user->groups);
		if ($key !== false)
		{
			unset($user->groups[$key]);
			if (!$user->save()) {
				return new JException($user->getError());
			}
		}
		$temp = JFactory::getUser((int) $userId);
		$temp->groups = $user->groups;
		$temp = JFactory::getUser();
		if ($temp->id == $userId) {
			$temp->groups = $user->groups;
		}
		return true;
	}
public static function removeUserFromGroup ( $ userId , $ groupId ) { $ user = JUser :: getInstance ( ( int ) $ userId ) ; $ key = array_search ( $ groupId , $ user -> groups ) ; if ( $ key !== false ) { unset ( $ user -> groups [ $ key ] ) ; if ( ! $ user -> save ( ) ) { return new JException ( $ user -> getError ( ) ) ; } } $ temp = JFactory :: getUser ( ( int ) $ userId ) ; $ temp -> groups = $ user -> groups ; $ temp = JFactory :: getUser ( ) ; if ( $ temp -> id == $ userId ) { $ temp -> groups = $ user -> groups ; } return true ; }
Method to remove a user from a group.
Method to remove a user from a group .
// Get the user object. // Remove the user from the group if necessary. // Remove the user from the group. // Store the user object. // Set the group data for any preloaded user objects. // Set the group data for the user object in the session.