What is the best way to get the current (logged in) 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
genepilot
Forum Members
Forum Members
Posts: 18
Joined: Wed Feb 27, 2008 4:42 pm

What is the best way to get the current (logged in) user ID?

Post by genepilot »

For users logged in with frontEndUsers module.

What is the best way to get the currently logged in user id?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: What is the best way to get the current (logged in) user ID?

Post by calguy1000 »

well if you want it in smarty use the customcontent module

if you want it in a udt, you can get a reference to the FrontEndUsers module and use the functions in FrontEndUsers.api.php
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
genepilot
Forum Members
Forum Members
Posts: 18
Joined: Wed Feb 27, 2008 4:42 pm

Re: What is the best way to get the current (logged in) user ID?

Post by genepilot »

This is from within a module in php.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: What is the best way to get the current (logged in) user ID?

Post by calguy1000 »

$feu =& $this->GetModuleInstance('FrontEndUsers');
$uid = $feu->LoggedInId();
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “Developers Discussion”