How to get user that's currently signed in
odannyc
New
Hey, can anyone assist with pointing me in the right direction?
Within a controller does anyone know how to get the information of the current user that's signed in ?
For example do something like this: $this->currentUser['UserID'];
Tagged:
0
Comments
Gdn::session() - >UserID
$Session = Gdn::Session(); //Check if user is signed in if ($Session->IsValid()) { //get user name $UserName = $Session->User->Name; //get User Id $UserID =$Session->User->ID; }Example of usage
$this->AddLink('User', $Name, '/profile/{UserID}/{Username}', array('Garden.SignIn.Allow'), array('class' => 'UserNotifications'));❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Thanks! Worked
haha.. thanks for sharing... got the point...