Hi,

I bump into this message on every page:

Notice: Trying to get property of non-object in user_access() (line 790, 802, 803, 809, 812 of ...user.module). Basically thru user_access function.

Perhaps some module is calling this user_access function with wrong parameter(s)?

I've tried to disable few modules, flush caches etc. but nothing seems to help. I know that I could just install a new copy of drupal and build it up again but that is

  • first of all lengthy process and
  • secondly it is possible that I could bump into this again.

Therefore it would be nice to find a solution instead of a workaround.

Comments

JAYBOB’s picture

I noticed that this problem is present ONLY when logged in as ADMIN.

summit’s picture

Hi,

I have exactly the same problem after installing VBO.
No solution yet. Greetings, Martijn

goldcrusaider’s picture

Same problem here

bbjay’s picture

I received this notice after enabling "Administration Views" and "Administration Development tools". Do you think the problem may be from one of these modules?

zoszabo’s picture

Any update on this one?

bbjay’s picture

Update to latest dev version of ctools. I was using ctools 7.x-1.0-rc1 when I was getting this error, but after updating this, the error went away. I updated a few other modules at the same time though, so post back if that does not do the trick for you, so I can see what else I updated so you can try that. I'm pretty sure this is fixed after one of the module dev updates though.

zoszabo’s picture

Installed the latest dev version. It does not fix this issue :(

joe huggans’s picture

subscribed

joe huggans’s picture

Found out that my problem was with the twitter module, specifically the twitter block.

See here, comment 9

http://drupal.org/node/1367946

aniebel’s picture

Disabled the Twitter module and POOF!, it was gone.

monsoon’s picture

I have posted similar problem on following link at #6:
http://drupal.org/node/1422098

Do you think think a module AddThis (which is combination of many social Media sharing links including Twitter) is a cause of the problem.

Please comment.

pitxels’s picture

same problem, I am not using any twitter module, but I just updated ctools...

--
Drupal Theming at
www.pitxels.com

cneumann’s picture

Did that fix it?

joyan’s picture

I have same rpoblem when I install CSS Live module.

harri00413’s picture

After setting some permissions to the prescribed permissions by the Drupal Forum members and after installing Security Review.
Anyone?

Had same problem, switched off module Security Review 7.x-1.0, problem gone.
Not really solved but it's not bothering me anymore.
Hey, it's back. And I haven't got a clue

Also updated CTools.

Anonymous’s picture

So, I have no idea what module was actually causing this problem. I suspect it might have been views or related, as that was what I was working with at the time; it just started one day when constructing custom views, and refused to go away. When attempting to dig out the root of the problem, I found that the user_access function was being called with the permissions request string twice by some module or another. Been fighting with xdebug, so I'm hard pressed to tell you which one.

Anyways, a minor modification of the beginning of the user_access function (line 790 of modules/user/user.module for me) from this:

function user_access($string, $account = NULL) {
  global $user;

  if (!isset($account)) {
    $account = $user;
  }

to this:

function user_access($string, $account = NULL) {
  global $user;

  if (!isset($account) || !is_object($account)) {
    $account = $user;
  }

seems to do the trick. Only someone who's spent time in core could tell me if this is a correct fix, but as the function is being called incorrectly if my fix is triggered *anyways*, it seems all right to me. *And*, it makes the problem go away...until the next core update, that is. Any core hackers want to opine if this is patch worthy?

Anonymous’s picture

Of course, the minute I post, the solution presents itself. In my case, it apparently *did* have to do with views. See this thread.

alauddin’s picture

In my case it was commerce backoffice which once disabled fixed the issue.

Hopian’s picture

yea for me helped disable commerce back office to

keti-1931’s picture

thanks abeal your fix works for me also

syzbit’s picture

It looks like there are some missing permission or not implemented properly.

deerta’s picture

I solve this problem by disable those tree modules:Administration menu, Administration menu Toolbar style, Administration views

clear cache

re-enable those three modules.

problems solved.

kuni2014’s picture

I tried your solution.

It works!

Thanks!

sonicthoughts’s picture

fyi did not work for me :(

Arne Slabbinck’s picture

I'm also having this problem and this didn't help for me, problem still persist.

Using:
Administration menu 7.x-3.0-rc5
Administration menu Toolbar style 7.x-3.0-rc5
Administration views 7.x-1.5