Here at the bank, we manage over 50 different products.
so we needed the ability for each user to be returned to thier last selected product upon log in. having to change this each time was a pain..
Here is how I resolved the issue.
I added a new column to the user table called lastProduct, of type int.
then added a new function to the users.inc.php:
/** Function updatethe last product selected by the user */
// 20051109 - jba created
function userUpdateLastProduct($userID, $lastProduct)
{
$sql = \"UPDATE user \" .
\"SET lastProduct=\" . $lastProduct;
$sql .= \" WHERE id=\" . $userID;
$result = do_mysql_query($sql);
// MHT 200507 - update session data if admin modify yourself
if (($userID == $_SESSION[\'userID\']) && $result)
setUserSession($login, $userID, $rightsID, $email, $locale, $lastProduct);
return $result ? \'ok\' : mysql_error();
}
I then modified the navBar.php to include the following:
$updateMainPage=0;
if (isset($_GET[\'product\']))
{
$updateMainPage=1;
userUpdateLastProduct($_SESSION[\'userID\'], $_GET[\'product\']);
}
So I\'m basically calling the function and updating the user table every time a new prodect is selected.
then modified the existLogin function in users.inc.php to include my new column, as well as the setUserSession function.
Last I modified the call to set user session in doAuthorize.php to include my new column.
setUserSession($userInfo[\'login\'], $userInfo[\'id\'],
$userInfo[\'rightsid\'], $userInfo[\'email\'],
$userInfo[\'locale\'], $userInfo[\'lastProduct\']);
and viola,, upon login the user is taken directly to the last product they selected before logging out.
there may have been a more elegant way.. and I must add.. with your awsome code structure it was pretty easy to make this change..
Jason
select last product on login
-
- TestLink user
- Posts: 9
- Joined: Wed Nov 09, 2005 6:06 pm
- Location: Salt Lake City, Utah
select last product on login
Jason B. Archibald
This Post is an Issue in Mantis
Please, don\'t use this forum as Bug Tracking System
You have reported the same bug in mantis, and IMHO mantis is the right place
regards
francisco
You have reported the same bug in mantis, and IMHO mantis is the right place
regards
francisco