Jump to content

Error Call to a member function isDefault() on null


cehlo
 Share

Recommended Posts

Hi folks, 

I am reaching you one more time for help with error I can´t solve. The setup is little more complicated, but I will try to introduce it in the best way. 

I have multiple user roles, one of them is role "member". These members have certain pages that they can edit, permission is granted during some automated process ( request for permission to edit, check if it is authorized, grant permission - via custom modules and hooks) but permission for editing is saved via module "PageEditPerUser". 

This pages which "member" can edit, have PageReference field, which is pointing on that user (Access - Users - Page of user) - field is called "dog_ownerSelect" and is used for loading personal data of owner = authorized user to page. Problem appears when the member is logged into processwire and he want to see pages which he can edit on live site. Return is only some error which does not seem have sense. On site traditionally error 500, because it is not superuser - output from tracydebugger error log is: 

[2019-11-03 10-30-56] PHP Notice: Undefined property: ProcessWire\User::$language in /nfsmnt/hosting1_1/b/5/b5ca8bf7-6179-408f-b688-09da79c8a644/daisy.sk/sub/hovawart/wire/core/PagesLoaderCache.php:236  @  https://hovawart.daisy.sk/databaza-chovu/chov/dajana-z-posonia/ 

When I added TracyDebugger permission to member, result: Call to a member function isDefault() on null. 

I am using $language in multiple places but that doesn't seem to be problem. I traced the error in file to using variable "dog_ownerSelect" in any way. 

<?php 
     
if(!$page->dog_ownerSelect){
     
} else {
     
}

?>

If there is this variable (which is pointing to user who is logged in) in any place in the file, it throws error I described. But this error occurs only if the user with role member is trying to look the page which he can edit. When you try to load page with guest or superuser or other member which doesn't have right to edit this page everything is going 100% smooth. 

Thank you for any suggestion where the error might be. 

Cheers 

Cehlo

Link to comment
Share on other sites

  • 5 months later...

Maybe little bit old, but again same error. Now I can't save or edit user profile for another user than superuser. I am not currently changing by any means edit profile module nor hooking it. And this is popping out. 

image.thumb.png.a68232b3cf5ef44cd626840869c366ab.pngimage.thumb.png.d9ea41ba754f9c1d845d75e006b78a90.png

 

Maybe at least some advice how to track error more precisely, because now is only forwarding me to LoaderCache and there is no problem. Thank you very much. 

Link to comment
Share on other sites

It is very strange, when I used bardump in tracy console during this error with same line:

bd($this->user->language->isDefault())

no error in tracy. I am just rubbing my head on this for like 4 hours and can't find no error or the cause of this. I even try fresh install of pw, imported database and site folder with no help. Then deleted ready file, all modules files still problem persists...

image.thumb.png.c7de6ea3255dd7452ae6c5a5c436214f.png 

Adding also some more error description from debugModelPanel. Thanks for help in advance. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...