This topic is locked

Full Name vs. UserName

2/25/2009 6:41:35 PM
PHPRunner General questions
J
jpbconsulting author

I would like to use change the statement in the template from "Logged on as {$username}" to contain a value from the table other than the user name.
I would like to display the value in the "fullname" field in the table used to store user IDs.
For example:
UserID: jsmith

Full Name: Joe Smith
Message in header: "Logged on as Joe Smith" rather than "Logged on as jsmith"
Is this possible?

D
djsmithuk 2/25/2009

change {$Username} to {$row.1Full Name}
assuming that the value from the table is called Full Name
this might only work in tables where users can see their own data, i am unsure

J
jpbconsulting author 2/26/2009

I thought the $row variable was assigned to the SQL query for the view on the page. The FullName field would be in a table other than what is being used for results on the page. How do you distinguish the two?

J
jpbconsulting author 2/26/2009

I think I found my answer, but I am unsure how to address the individual field names.
The function AfterSuccessfulLogin($username, $password, $data) has the $data argument which supposedly contains an "array with existing user record in the login table". How do I address the individual values in the $data string? How do I parse it?

Admin 2/26/2009

$data['Full Name'] is what you looking for.
Save this value to session variable in AfterSuccessfulLogin event:

$_SESSION['FullName'] = $data['Full Name'];


Then in BeforeShowList event use the following:

$xt->assign("username",$_SESSION['FullName']);