This topic is locked

Hide a field based on group

10/3/2012 8:13:51 PM
PHPRunner General questions
ladykathleen author

I have searched the forums and thought I found what I was needing to be able to block the field SocialSecurity from all but the admin group on the edit page.
This is what I used, but it does not seem to block the field from view.
I added this to Edit Page before Display.
$usergroup = $_SESSION["GroupID"];

if (($usergroup=="admin"))

{

$xt->assign("SocialSecurity_fieldblock",true);

}

else {

$xt->assign("SocialSecurity_fieldblock",false);

}
Can anyone tell me why this might not work? and better yet, what works....

C
cgphp 10/4/2012

Are you using static permissions? Check this article: http://xlinesoft.com/phprunner/docs/phprunner_session_variables.htm

ladykathleen author 10/4/2012



Are you using static permissions? Check this article: http://xlinesoft.com/phprunner/docs/phprunner_session_variables.htm


Yes we are using static permissions.
That is why I am wonder why this does not work.

C
cgphp 10/4/2012

Try to echo the session value:

echo $_SESSION["GroupID"];


before the if condition.

ladykathleen author 10/4/2012



Try to echo the session value:

echo $_SESSION["GroupID"];


before the if condition.


The echo shows the correct info under each account I log into.

I checked $usergroup and it also has the correct.

Sergey Kornilov admin 10/4/2012

Your code looks good.
If you need more help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.