• Resolved zorgbargle

    (@zorgbargle)


    Hi,

    I get the following fatal error when I try to sign in to my dashboard by accessing the https://mywpsite.com/wp-admin URL:
    Fatal error: Call to undefined method stdClass::get_term_roles_daterange() in …/wp-content/plugins/role-scoper/role-scoper_main.php on line 792

    If I remove the role scoper plugin, the wp-admin URL shows the login form as expected.

    I’ve tried debugging this, it seems the $user variable at line 792 should be of type WP_Scoped_User, but is instead of type WP_User. It seems this only occurs when trying to log in via the wp-admin/ link.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Kevin Behrens

    (@kevinb)

    The only way I can see that happening is if another plugin is resetting the $GLOBALS[‘current_user’] variable following Role Scoper initialization. I could give you some code for a more graceful failure, but until we stop current_user from being wiped, RS won’t be able to do its job.

    Start by searching all your plugin code for this:
    new WP_User

    Sorry to bump an older thread but I also receive a fatal error when I activate Role Scoper in WP 3.0.1:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'stdClass::has_cap' was given in /home/feliciac/public_html/wpsnippets/uao/wp-includes/capabilities.php on line 1067
    
    Fatal error: Call to undefined method stdClass::user_can_for_any_object() in /home/feliciac/public_html/wpsnippets/uao/wp-content/plugins/role-scoper/admin/permission_lib_rs.php on line 134

    I de-activated all the installed plugins, and also cleared my theme functions.php file just in case, so am a little bit puzzled.

    Any help would be much appreciated! ??

    Plugin Author Kevin Behrens

    (@kevinb)

    Are you running Role Scoper version 1.2.7, and seeing this when all plugins except Role Scoper are deactivated? Also after switching temporarily to the default theme?

    Does it occur right after you activate Role Scoper, with other wp-admin URL(s), or both?

    Is this a Multisite installation? If so, are you logged as a limited administrator (not a super admin of all sites)?

    Something strange is happening on your installation because normally the code that generated that error would not even execute for a logged Administrator (which you presumably are to activate the plugin).

    To help me diagnose this, can you temporarily modify permission_lib_rs.php as follows:

    change:

    if ( $reqd_caps = array_merge( array_keys($admin_caps), array_keys($delete_caps) ) ) {
       if ( ! defined('DISABLE_QUERYFILTERS_RS') && $scoper->cap_interceptor->user_can_for_any_object( $reqd_caps ) )
    	$return = true;
    }

    to:

    if ( $reqd_caps = array_merge( array_keys($admin_caps), array_keys($delete_caps) ) ) {
       if( ! method_exists( $scoper->cap_interceptor, 'user_can_for_any_object' ) )
          agp_bt_die();
    
       if ( ! defined('DISABLE_QUERYFILTERS_RS') && $scoper->cap_interceptor->user_can_for_any_object( $reqd_caps ) )
    	$return = true;
    }

    You will also need to temporarily add this to wp-config.php, above the “stop editing” line:

    define( 'RS_DEBUG', true );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Role Scoper] Fatal error when accessing wp-admin’ is closed to new replies.