Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Tuesday, April 17, 2012

Add Group to User Automatically when Creating a New User with Form

Add this to the form...
public function save($con = null)
  {
    //Do the main save to get an ID
    $user = parent::save($con);
  
    //Add the user to the relevant group, for permissions and authentication
    if (!$user->hasGroup('Dispatchers'))
    {
      $user->addGroupByName('Dispatchers');
      $user->save();
    }
  
    return $user;
  }

Thursday, July 15, 2010

Get User ID with Jumi in Joomla

If you include a php file to an article with Jumi, you can get the user id with this:
defined('_JEXEC') OR defined('_VALID_MOS') OR die( "Direct Access Is Not Allowed" );

$jAp= & JFactory::getApplication();
$user =& JFactory::getUser();
echo $user->get('id');