What might be causing my problem to access user variables in Rules? I use the module Rules link event to trigger a rule based on visited path. The problem I have that in condition I need to use user variables but get an error - variable user is not defined. If I try php condition and use global $user, I get Notice: Trying to get property of non-object in eval() and Warning: in_array() expects parameter 2 to be array, null given in eval()

What could be the problem here?
Not sure what the reason might be that is causing your problem. But something that you could do to make this work, for sure, is like so:


Add a Rules Action "Fetch entity by id", whereas you want to fetch the user entity, and where you use the uid of the "current-user". For any subsequent Rules Action, you then have all fields of that user available as tokens.
Enable the Conditional Rules module, which allows you to specify Rules Conditions as part of Rules Actions. Using that technique, you can then like "move" any of your existing Rules Conditions (ie the ones where you need those user variables, as per your question). In doing so, you can then use any of the tokens that you made avaiable via the preceeding Rules Action "Entity has field".


BTW, no dangerous PHP code (stored in your database) needed to get this to work ...

Easy, no?