erich
Basically I need to write an if statement that looks like this:
if !empty($INFO(['grps']['blog'])){....}
What exactly is the right syntax for the 'grps' part of the $INFO variable. I basically just want to see if a user is a member of a certain group. If they are then I want to display specific content to them. I can't find the documentation on this and have tried a few different ideas and know I must be close. Thanks so much,
Eric
lupo49
erich
Thank lupo. I had seen that devel documentation there but since I am not super familiar with php it was not enough for me to figure it out...this is what I am trying now:
if (!empty($INFO["isadmin"]) ||
!empty($INFO["userinfo"]["grps"]["blog"])){...}
I know I am close but no dice yet. I will keep trying a few different options. Thanks.
turnermm
First you do not want to check for whether or not $INFO["isadmin"] is empty but for whether not it's true:
if($INFO["isadmin"] )
Then you want to check for whether or not the group 'blog' is found in the array $INFO["userinfo"]["grps"]:
if(in_array('blog', $INFO["userinfo"]["grps"]))
So:
if($INFO["isadmin"] && in_array('blog', $INFO["userinfo"]["grps"]) ) {
}
-----------
Edit
If you just want to check whether the user belongs to a group, why are you checking for isadmin?
erich
I am just tweaking the script from boxes.php that Andreas Haerter wrote for the mnml blog template. I assumed that he did things right as that was his code for the "isadmin" part. Thanks so so much for your help.
turnermm
There may be a reason for that in the blog template, but it's not what you need to check for whether a user belongs to a particular group.