Skip to content

User Management - Log username

Problem:


I would like to log the username into a database when changes are made to one of my other tables. What would I need to do to surface the username who is currently logged in? I tried adding $_SESSION['UserID'] but that didn't work.

Solution:


You can use 

$user->data()->username;

List of useful user properties:


* permissions // 1 is user, 2 is admin
* id
* email
* username
* password
* fname 
* lname
* account_id
* last_login

Feedback and Knowledge Base