Page 1 of 1

FEU - get user id

Posted: Tue Jan 19, 2010 8:53 pm
by regus
I've just created my own module and it's working fine. I've also installed Front-End-Users. In my own-made module, I need the userid (or username) who is logged on. Which piece of php-code should I use to get the current userid ?

Bart

Re: FEU - get user id

Posted: Tue Jan 19, 2010 8:55 pm
by RonnyK
IIRC is there a box in the settings of FEU, with either {name} or {username}. Check the settings of FEU, and see what is defaulted in on of the option-boxes.

Ronny

Re: FEU - get user id

Posted: Wed Jan 20, 2010 4:31 pm
by regus
Thank  you, but I think you misunderstood the question. I need the piece of php-code to get the current user who is logged on.

Re: FEU - get user id

Posted: Wed Jan 20, 2010 6:16 pm
by JeremyBASS
Look to the feu code.. the function you want to call is in the FrontEndUsers.api.php (to witch you can call much more too) and is called  LoggedInId()  from there you can grab the user name well anything.. hope this helps

Cheers
Jeremy

Re: FEU - get user id

Posted: Wed Jan 20, 2010 7:51 pm
by regus
Thanks for the info. I've been trying, but I can't make it work.
In my custom-made-module I use this code :

require_once($_SERVER["DOCUMENT_ROOT"] . "/modules/FrontEndUsers/FrontEndUsers.api.php" );

echo "your user id is : " . FrontEndUsersManipulator::LoggedInId();

But I get the error : Call to undefined method MyModule::ExpireUsers()

Could you give me some sample code to get me started ?

Thanks
Bart

Re: FEU - get user id

Posted: Wed Jan 20, 2010 8:11 pm
by Jeff
  $feusers =& $mymodule_obj->GetModuleInstance('FrontEndUsers');
  if( $feusers )
    {
      $userid = $feusers->LoggedInID();
    }

replace $mymodule_obj with your module obj name.

Re: FEU - get user id

Posted: Wed Jan 20, 2010 8:39 pm
by regus
Thanks ! That's wat I need.