This topic is locked
[SOLVED]

 Dynamic security and accesslevel

7/4/2011 1:01:59 PM
PHPRunner General questions
B
bluedude author

I'm trying to use AccessLevel in beforedisplay but it always shows me user. I'm for sure i'm in the admin group.
How can I display fields only for an admin group user?
Cheers,

B
bluedude author 7/4/2011

I tried but that doesn't work at all. I tested the value of the $_SESSION["AccessLevel"] and it is always User. I use dynamic security so i'm wondering what is wrong.

B
bluedude author 7/4/2011

To which field in which table is AccessLevel connected?

C
cgphp 7/4/2011

$_SESSION["AccessLevel"] discriminates only users from guests.
A possible workaround is:

global $conn;
$strSQL = "select GroupID from ugmembers where UserName ='".$_SESSION["UserID"]."' LIMIT 1";

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

$data=db_fetch_array($rs);
$xt->assign("yourfieldname_fieldheadercolumn",$data['GroupID'] == -1);

$xt->assign("yourfieldname_fieldcolumn",$data['GroupID'] == -1);
B
bluedude author 7/4/2011

Yep,
That works :-)