This topic is locked

Adding a link to user profile to the menu

7/12/2013 6:05:33 PM
ASPRunnerPro Tips and tricks
admin

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.asp?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" then

menuItem.setUrl_p1("users_edit.asp?editid1=" & Session("user_id"))

end if
ModifyMenuItem = true


This is it.