This topic is locked

Get User Group Session Variable Dynamic Permissions

12/18/2008 1:47:35 PM
PHPRunner General questions
U
Urnso author

Found this for getting the group name when using static permissions.
$_SESSION["GroupID"]
How can I get the same thing but for the dynamic permissions usergroup?
Thx!

U
Urnso author 12/18/2008

[codebox]global $conn,$userid;

$sql = "select GroupID from rhugmembers where UserName='".$_SESSION["UserID"]."'";

$rs = db_query($sql,$conn);

$data = db_fetch_array($rs);

$userid = $data["GroupID"];[/codebox]
Ok this works.
Now is there a way to disable a checkbox on the edit form based on the value of $userid?
Thx!

J
Jane 12/19/2008

Hi,
use List page: Before display event on the Events tab for this purpose.

Here is a sample:

if ($userid=="admin")

$xt->assign("FieldName_fieldblock",True);

U
Urnso author 12/19/2008

I tried that code on the List Page:Before Display it did not work. I also tried it on the Edit page:Before Display.

The field that I need locked is a checkbox and the fieldname is SpecFinalized. I need it to lock on the edit page only. I don't have the fields even listed on the Add page so it's not a problem there.
[codebox]global $conn,$userid;

$sql = "select GroupID from rhugmembers where UserName='".$_SESSION["UserID"]."'";

$rs = db_query($sql,$conn);

$data = db_fetch_array($rs);

$userid = $data["GroupID"];
if ($userid=="4")

$xt->assign("SpecFinalized_fieldblock",True);
if ($userid=="7")

$xt->assign("SpecFinalized_fieldblock",True);[/codebox]