WordPress.org

Ready to get started?Download WordPress

Forums

AdRotate
[resolved] Disable plugin with bbpress activated isnt yet possible v3.8.4.1 (16 posts)

  1. alfredo49
    Member
    Posted 1 year ago #

    The new version (v.3.8.4.1) dont fix this problem, when i try to deactivate adrotate when bbpress plugin is activated, returns this error (and not desactivate):

    Warning: Invalid argument supplied for foreach() in /usr/home/.../wp-content/plugins/adrotate/adrotate-functions.php on line 548

    Warning: Invalid argument supplied for foreach() in /usr/home/.../wp-content/plugins/adrotate/adrotate-functions.php on line 548

    Fatal error: Call to a member function remove_cap() on a non-object in /usr/home/.../wp-content/plugins/adrotate/adrotate-functions.php on line 595

    http://wordpress.org/extend/plugins/adrotate/

  2. Arnan de Gans
    Member
    Plugin Author

    Posted 1 year ago #

    I can't really reproduce the issue here.
    With or without bbPress active it seems to work fine for me.

    Logically that would indicate a bug in bbPress messing up the user capabilities.
    Did you experiment with that?

  3. alfredo49
    Member
    Posted 1 year ago #

    i can deactivate bbpress without any problem also with adrotate active, the issue happens when i try to deactivate adrotate:

    2 cases happens:

    1) deactivate adrotate without any plugins active,returns this error 15 times more or less, but finally deactivates the plugin:

    Warning: Invalid argument supplied for foreach() in /usr/home/../wp-content/plugins/adrotate/adrotate-functions.php on line 548

    2) deactivate adrotate with bbpress active, return this error , but the plugin isnt deactivate:

    Warning: Invalid argument supplied for foreach() in /usr/home/.../wp-content/plugins/adrotate/adrotate-functions.php on line 548

    Warning: Invalid argument supplied for foreach() in /usr/home/.../wp-content/plugins/adrotate/adrotate-functions.php on line 548

    Fatal error: Call to a member function remove_cap() on a non-object in /usr/home/.../wp-content/plugins/adrotate/adrotate-functions.php on line 595

    Thx for support!

  4. Arnan de Gans
    Member
    Plugin Author

    Posted 1 year ago #

    Which version of WordPress do you use?

  5. alfredo49
    Member
    Posted 1 year ago #

    The last 3,5,1

  6. Arnan de Gans
    Member
    Plugin Author

    Posted 1 year ago #

    So have I,

    I'll do some more digging, hopefully I am able to reproduce the issue so I can fix it :)

  7. alfredo49
    Member
    Posted 1 year ago #

    Thxs!

  8. Arnan de Gans
    Member
    Plugin Author

    Posted 1 year ago #

    Can you try something?

    I have learned that some wordpress sites do not have $wp_roles as a global.
    If your site is like that you need to create it before you can use it... Otherwise the error would show,

    Can you add this to line 546 (directly under global $wp_roles;

    if(!isset($wp_roles)) $wp_roles = new WP_Roles();

    If you save and upload the file with that extra line you should be able to disable AdRotate.

    Let me know how it goes :)

  9. alfredo49
    Member
    Posted 1 year ago #

    Hi:

    i add your code in this function (inside adrotate-functions.php):

    function adrotate_get_sorted_roles() {
    global $wp_roles;
    if(!isset($wp_roles)) $wp_roles = new WP_Roles(); //New Line
    $sorted = array();

    foreach($wp_roles as $roles) {
    foreach($roles as $role => $capabilities) {
    $sorted[$role] = get_role($role);
    }
    }

    $sorted = array_reverse($sorted);

    return $sorted;
    }

    i upload the file and Clean the cache, but i cant disable adrotate :-(

    Repeat exactly the 2 cases of my previous post

  10. Arnan de Gans
    Member
    Plugin Author

    Posted 1 year ago #

    hmm :(

  11. alfredo49
    Member
    Posted 1 year ago #

    Important note!

    This issue happens since v3.8, in v3.7.4.3 and previous versions dont happen any of the mentioned cases

  12. Arnan de Gans
    Member
    Plugin Author

    Posted 1 year ago #

    But at the same time it works fine for me and many others... My search continues.

  13. alfredo49
    Member
    Posted 1 year ago #

    Thxs for support

  14. Arnan de Gans
    Member
    Plugin Author

    Posted 1 year ago #

    Can you check the following;
    If you go into AdRotate settings and all the way in the bottom enable “Show array of all userroles and capabilities” and save the settings.

    This should output some debug information on the settings screen. Look for a line like this:

    [DEBUG] Current User Capabilities

    What does it say directly below it? There should be a long list of all capabilities and roles your website has. Can you email me this list? info@ajdg.net

    http://www.adrotateplugin.com/support/forums/topic/cannot-deactivate-adrotate/

  15. alfredo49
    Member
    Posted 1 year ago #

    ok
    email send!

  16. Arnan de Gans
    Member
    Plugin Author

    Posted 1 year ago #

    Alfredo and I figured out the problem and a patch will be included with the next version.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.