Ok forgive me if this is answered in the forums somewhere - and i’m sure it is - but i dug and couldn’t find an answer.
Why doesn’t this code work as expected:
<?php
echo "{group_title}" . "
";
if ("{group_title}" == "Super Admins") echo "Super Admins";
else echo "Normal Folk";
?>If i am logged in as a super admin, the group title conditional doesn’t evaluate to true even though it seems like it should. And to make matters worse, I’m using code that’s not drastically different from this elsewhere and it works. The big differences are that it’s not using global variables (instead, results from ee loops) and it’s comparing ee database values stored in my PHP to other ee database values.
If you execute the above code logged in as a Super Admin you see:
Super Admins
Normal FolkWhen you should see 2 lines of “Super Admins” instead of the line “Normal Folk.”
I’ve got to be missing something really simple.
Yes, my template has PHP enabled (output).
If i run PHP’s string replacement on the group title value, it does NOT find the space character which initially lead me to believe that it was just how the space was encoded (or something like that). But i’m having the exact same problem if i use an EE loop and compare a field out of the database that has a group id stored in it (as a string obviously) to the logged_in_group_id global variable.