This topic is locked

$_SESSION["UserID"] is storing username

10/3/2022 8:24:45 PM
PHPRunner General questions
S
Sayed author

When a record is added.

Version 10.8 > $SESSION["UserID"] is storing username in database.
Version 10.3 > $SESSION["UserID"] is storing ID in database.

Why its different and how to control it?

Admin 10/3/2022

$_SESSION["UserID"] always stored username. My only guess is that you were using ID as a username in version 10.3 or had some additional code that overwrote this value.

P
pmuckleDevClub member 10/5/2022

What would be the code to store the database ID?

Also, I have a standard user database, when I ask for $SESSION["fullname"] I get the username.

Admin 10/5/2022

In AfterSuccessfulLogin event you can get access access to any field from the login table, including ID. You can save it in the session variable and use it everywhere.

Another option is to use Security API function currentUserData().