bind($post);
}
if ( $user->get('id'))
{
$query = 'SELECT *'
. ' FROM #__contact_details'
. ' WHERE user_id = '.(int) $cid[0]
;
$db->setQuery( $query );
$contact = $db->loadObjectList();
}
else
{
$contact = NULL;
// Get the default group id for a new user
$config = &JComponentHelper::getParams( 'com_users' );
$newGrp = $config->get( 'new_usertype' );
$user->set( 'gid', $acl->get_group_id( $newGrp, null, 'ARO' ) );
}
$userObjectID = $acl->get_object_id( 'users', $user->get('id'), 'ARO' );
$userGroups = $acl->get_object_groups( $userObjectID, 'ARO' );
$userGroupName = strtolower( $acl->get_group_name( $userGroups[0], 'ARO' ) );
$myObjectID = $acl->get_object_id( 'users', $myuser->get('id'), 'ARO' );
$myGroups = $acl->get_object_groups( $myObjectID, 'ARO' );
$myGroupName = strtolower( $acl->get_group_name( $myGroups[0], 'ARO' ) );;
// ensure user can't add/edit group higher than themselves
/* NOTE : This check doesn't work commented out for the time being
if ( is_array( $myGroups ) && count( $myGroups ) > 0 )
{
$excludeGroups = (array) $acl->get_group_children( $myGroups[0], 'ARO', 'RECURSE' );
}
else
{
$excludeGroups = array();
}
if ( in_array( $userGroups[0], $excludeGroups ) )
{
echo 'not auth';
$mainframe->redirect( 'index.php?option=com_users', JText::_('NOT_AUTH') );
}
*/
/*
if ( $userGroupName == 'super administrator' )
{
// super administrators can't change
$lists['gid'] = ''. JText::_( 'Super Administrator' ) .'';
}
else if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' ) {
*/
if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' )
{
// administrators can't change each other
$lists['gid'] = ''. JText::_( 'Administrator' ) .'';
}
else
{
$gtree = $acl->get_group_children_tree( null, 'USERS', false );
// remove users 'above' me
//$i = 0;
//while ($i < count( $gtree )) {
// if ( in_array( $gtree[$i]->value, (array)$excludeGroups ) ) {
// array_splice( $gtree, $i, 1 );
// } else {
// $i++;
// }
//}
$lists['gid'] = JHTML::_('select.genericlist', $gtree, 'gid', 'size="10"', 'value', 'text', $user->get('gid') );
}
// build the html select list
$lists['block'] = JHTML::_('select.booleanlist', 'block', 'class="inputbox" size="1"', $user->get('block') );
// build the html select list
$lists['sendEmail'] = JHTML::_('select.booleanlist', 'sendEmail', 'class="inputbox" size="1"', $user->get('sendEmail') );
$this->assignRef('me', $me);
$this->assignRef('lists', $lists);
$this->assignRef('user', $user);
$this->assignRef('contact', $contact);
parent::display($tpl);
}
}