Hi Everyone,
I am trying to do a dynamic query on my list pages depending on the user group:
If the logged in user is a member of the 'editors' group (Group ID 3), he must see only his own records.
this is the code in "after table initialized" :
//Do a query to store the group ID in a custom variable
$rstmp = CustomQuery("select GroupID from security_ugmembers where UserName='".$_SESSION["UserID"]."'");
$datatmp = db_fetch_array($rstmp);
$_SESSION["CustomGroupID"] = $datatmp["GroupID"];
//Test if the logged in user is in Group 3, if he is, show him only his own records.
if ($_SESSION["CustomGroupID"]=3)$query->addWhere("userid='".$_SESSION["UserName"]."'");
My problem is: If an admin user logs in (Group id -1 or 1) he sees no records. I have checked the permissions and the admins should be able to view all records.