I've been mucking around with drupal for a while(just restarted my site with a clean 4.6.5 version from fantastico in cpanel). And I'm having a minor but large problem.
I'm working on customizing blocks to display for specific users, and that works fine; I can show specific blocks to specific users and everything. BUT, there's an interesting problem that I can hack around, but don't know if it's a the cause of, which is:
When I login as a "Unrecognized username or password" from user/login, drupal no longer recognizes the $user variable, and thus my call to in_array:
if(in_array('anonymouse user',$user->roles))
gives me this error:
warning: in_array(): Wrong datatype for second argument in /home/.../public_html/includes/common.inc(1815) : eval()'d code on line 17.
Now I was getting this error when I was a moron and wasn't putting in the "global $user", but I now have that in the code, and thus $user is defined(whereas I'm pretty sure the pointer isn't working because $user is somehow no longer declared on this specific page), or at least should be since I have the code entered directly into the block body, with php code checked and everything correct(it works on every page except on bad logins).
I can simply put a $user conditional in the if statement as in: if( $user && in_array('role',$user->roles) )
and it works fine, but I was wondering if there were some more coherant way to get the $user variable on the login fail page?