FEU - get user id

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
regus
New Member
New Member
Posts: 8
Joined: Fri Jan 15, 2010 10:54 pm

FEU - get user id

Post 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
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: FEU - get user id

Post 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
regus
New Member
New Member
Posts: 8
Joined: Fri Jan 15, 2010 10:54 pm

Re: FEU - get user id

Post 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.
JeremyBASS

Re: FEU - get user id

Post 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
regus
New Member
New Member
Posts: 8
Joined: Fri Jan 15, 2010 10:54 pm

Re: FEU - get user id

Post 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
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: FEU - get user id

Post by Jeff »

  $feusers =& $mymodule_obj->GetModuleInstance('FrontEndUsers');
  if( $feusers )
    {
      $userid = $feusers->LoggedInID();
    }

replace $mymodule_obj with your module obj name.
regus
New Member
New Member
Posts: 8
Joined: Fri Jan 15, 2010 10:54 pm

Re: FEU - get user id

Post by regus »

Thanks ! That's wat I need.
Post Reply

Return to “Developers Discussion”