• Resolved dmmtc

    (@dmmtc)


    Hi,

    Using this plugin on multi site instance. When trying to enable I get:

    Plugin could not be activated because it triggered a fatal error.
    
    Fatal error: Uncaught Error: Call to a member function add_cap() on null in xxx/public_html/wp-content/plugins/age-gate/src/Update/Activate.php:171 Stack trace: #0 xxx/public_html/wp-content/plugins/age-gate/src/Update/Activate.php(60): AgeGate\Update\Activate->setCapabilities('3.0.9', false) #1 xxx/public_html/wp-content/plugins/age-gate/age-gate.php(46): AgeGate\Update\Activate::activate() #2 xxx/public_html/wp-includes/class-wp-hook.php(308): age_gate_activate('') #3 xxx/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #4 xxx/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 xxx/public_html/wp-admin/plugins.php(194): do_action('activate_age-ga...') #6 {main} thrown in xxx/public_html/wp-content/plugins/age-gate/src/Update/Activate.php on line 171

    Corresponding error related to these lines of code:

    
    // administrator
    $admin = get_role('administrator');
    
    foreach (Constants::AGE_GATE_PERMISSION_ARRAY as $cap) {
         $admin->add_cap($cap);
    }
    

    There are two sites on my multi site instance. On one it is working and on other I get this error described above.

    Couldn’t find similar issue. Any thoughts?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Phil

    (@philsbury)

    Hi @dmmtc,

    Seems like one of the sites probably doesn’t have an administrator role. Did wonder if that’d ever be then case!

    In the latest release it’ll now try and find the next best thing and if it can’t give the permissions to the user installing the plugin to updated the access settings (and a little prompt to do it too).

    Let me know if you have any issues with activating 3.1.2.

    Thanks
    Phil

    Thread Starter dmmtc

    (@dmmtc)

    Hi @philsbury,

    Thank you for your fast response!

    I have updated plugin and it is working! You have sorted my issue.

    Thanks,
    Daniels

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin could not be activated because it triggered a fatal error.’ is closed to new replies.