Here is the situation - you want to give each user a quick access to her own data in users table. It would be nice to add 'My profile' link right to the main menu. 

Link to user profile page looks like users_edit.php?editid1=XXXX. We assume that login table name is users and XXXX is the value of primary key field in users table. 

1. Save ID of user account in session variable. For this purpose add the following code to AfterSuccessfulLogin event
$_SESSION["user_id"]=$data["id"];


In this example id is a primary key column name in login table.

2. Create a new menu item via Menu Builder. 
Link type: Application page
Link to: Users (login table) List page
Link text: My profile

3. Now add the following code to MenuItem: Modify event

if ($menuItem->getTitle()=="My profile") {
                $menuItem
->setUrl("users_edit.php?editid1=".$_SESSION["user_id"]);
}
return true;


This is it. 

Post a Comment