Noticed that I'm getting the following errors in my error_log, any idea as to why?
[22-Jun-2008 22:01:46] PHP Notice: Undefined offset: 0 in /home/XXXX/public_html/live/public/forums/extensions/RoleListFix/default.php on line 49 [22-Jun-2008 22:01:46] PHP Notice: Undefined index: Account Options in /home/XXXX/public_html/live/public/forums/extensions/RoleListFix/default.php on line 52 [22-Jun-2008 22:01:46] PHP Warning: Invalid argument supplied for foreach() in /home/XXXX/public_html/live/public/forums/extensions/RoleListFix/default.php on line 53
I'm getting the same errors as sherem and dkodr. It happens when I look at a user's account when not logged in (i.e. as a guest). I tried adding a bailout to line 49, adding '$Context->Session->User->Name == Guest' to the list of conditions but this didn't work. Obviously, a guest shouldn't see the role list so a simple exit should suffice but I don't know how to test whether a user is a guest or not.
Thanks
Oh hang on, just figured it out. "Guest" is the user name displayed when the user doesn't have a name. Thus testing for "Guest" is daft, whereas testing for a name fixes it. Thus my line 49 now reads:
Comments
[22-Jun-2008 22:01:46] PHP Notice: Undefined offset: 0 in /home/XXXX/public_html/live/public/forums/extensions/RoleListFix/default.php on line 49
[22-Jun-2008 22:01:46] PHP Notice: Undefined index: Account Options in /home/XXXX/public_html/live/public/forums/extensions/RoleListFix/default.php on line 52
[22-Jun-2008 22:01:46] PHP Warning: Invalid argument supplied for foreach() in /home/XXXX/public_html/live/public/forums/extensions/RoleListFix/default.php on line 53
Notice: Undefined offset: 0 in /srv/www/vhosts/myhost.com/httpdocs/forum/extensions/RoleListFix/default.php on line 49
on a applicant's profile page.
if(!$AccountUser || !$Context->Session->User->Name || $rid == $FRL_AdminID || $FRL_Priorities[$rid] > $FRL_Priorities[$AccountUser -> RoleID]) return;
and that seems to do the trick.