Lets say you want to give each user a quick access to their data in the users table. You can do so by adding a 'My profile' link to the main menu.
A link to the user profile page looks like this: users_edit.php?editid1=XXXX. We assume that the Login table name is users and XXXX is the value of the primary key field in users table.
1. Save the ID of the user account in a session variable. For this purpose, add the following code to AfterSuccessfulLogin event:
$_SESSION["user_id"]=$data["id"];
In this example id is the primary key column name in the 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;
See also: