Fatal error: Call to a member function has_cap()

Fatal error: Call to a member function has_cap() on a non-object in /opt/www/vhost/languageacademy.utm.my/httpdocs/wp-content/plugins/quick-status/quick-status.php on line 71

I’ve followed suggestion like previous post on this support forum, like fully network deactivate and delete and install fresh plugin, but nothing seem to work.

  • Vinod Dalvi
    • WP Unicorn

    Hi @msh,

    Sorry to hear of the problem you are having.

    I have just tested it on my test site using latest version of Status plugin but didn’t get any such error message.

    Where are you getting this error message?

    Was this plugin working fine for you?

    This can be due to plugin/theme conflict on your site.

    You can just try on your development site using default WordPress theme like Twenty Fifteen and temporary deactivating all other plugins as displayed in the following flowchart to know which theme/plugin is conflicting if any.

    https://premium.wpmudev.org/manuals/getting-support/

    Would you mind if I logged in to your site and did some troubleshooting? This might help get to the bottom of this faster. If this is ok, just grant me temporary admin access to your site by clicking “Grant Access” button in the WPMU DEV Dashboard Settings as described on the following page and reply on this thread after granting it?

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Kind Regards,

    Vinod Dalvi

  • Ash
    • WordPress Hacker

    Hello @msh

    I hope you are well today.

    You have 190 subsites, which one I should check?

    I have checked your main site and got that you have selected that option to manually place the php code in your template. Where and how did you add it?

    And also, you need to disable all plugins (not only network deactivate but also the subsite deactivated too) to find the the conflict if there is any.

    And finally, where will I see the Fatal error in your site?

    Please let us know.

    Cheers

    Ash

  • Vinod Dalvi
    • WP Unicorn

    Hi @msh,

    I tested on your site http://languageacademy.utm.my/athirah but didn't get any error message as shown in the attached screenshot but the front end of this site is just displaying blank white screen.

    Could you please share the screenshot of the screen where you are getting the error message?

    Please temporary add the following code in any of your theme file and let me know what it's outputting on the site causing this issue.

    <?php
    global $wp_roles;
    if (!is_object($wp_roles)) return;
    $wp_roles->use_db = true;
    $administrator = $wp_roles->get_role('administrator');
    echo &quot;Role : &quot;.$administrator->name;
    ?>

    Regards,

    Vinod Dalvi

  • Ash
    • WordPress Hacker

    Hello @msh

    I hope you are well today.

    Would you please go to /wp-content/plugins/quick-status/quick-status.php on line 71 and change

    if (!$administrator->has_cap(WDQS_PUBLISH_CAPABILITY)) $wp_roles->add_cap('administrator', WDQS_PUBLISH_CAPABILITY);

    to

    if ( is_object($administrator) && !$administrator->has_cap(WDQS_PUBLISH_CAPABILITY)) $wp_roles->add_cap('administrator', WDQS_PUBLISH_CAPABILITY);

    Please let me know if it works.

    Please note that, this changes will be lost in next update. So it’s worth to note down this changes somewhere and apply again after your updates.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers

    Ash

  • msh
    • Site Builder, Child of Zeus

    Hi Ash, thanks for the remedy, the sites are back online. If possible, could you explain a bit what is causing this? Our staff is happy with the plugin, so its not something I can easily drop off in case this error is happening again and why shouldn’t this be set as default?

  • Ash
    • WordPress Hacker

    Hello @msh

    Well, I am not quite sure about the error in your site, also I can’t mark this as a bug as I can’t replicate this in my test site, neither any of my colleagues.

    It could be any plugin conflict or a conflict with your theme, but the above changes should fix this error message. You just need to note down the changes and apply again once you update the plugin.

    Cheers

    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.