Skip to content

Instantly share code, notes, and snippets.

@kahlil
Created October 4, 2010 14:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kahlil/609817 to your computer and use it in GitHub Desktop.
Save kahlil/609817 to your computer and use it in GitHub Desktop.
Contao: get frontend user data
<?php
if (FE_USER_LOGGED_IN)
{
$this->import('FrontendUser', 'User');
$userid = $this->User->id;
$membername = $this->User->firstname;
$lastname = $this->User->lastname;
echo "The user id is " .$userid. " and the user id is also " . $this->User->id;
}
@hh-com
Copy link

hh-com commented Oct 12, 2015

in newer contao versions ...

if (FE_USER_LOGGED_IN)
{
     $objUser = FrontendUser::getInstance();
     $userid = $objUser->id;
     $userfn = $objUser->firstname;
     $userln = $objUser->lastname;
     echo "The user id is " .$userid. " and his name: " .$userfn ." ".$userln ;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment