• Resolved jeykeysyn

    (@jeykeysyn)


    Hi,
    when I want to clear all data from the plugin (to start the statistics fresh) I am told I need administrator right. But I have that role. Any ideas?

    Thanks
    Joerg

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @jeykeysyn,

    I just tested the Clear All Data button on a fresh WordPress install (and on a Multisite one too) and it worked normally for me. Are you sure your user account has the manage_options capability assigned to it?

    Thread Starter jeykeysyn

    (@jeykeysyn)

    Hi Hector,

    thanks for the quick reply. All I can do is assign the “Administrator” role to my account. I do not know how to edit role capabilities or that that was even necessary for the “administrator”.

    Plugin Author Hector Cabrera

    (@hcabrera)

    If you’re not using a role-customizer-kind-of-plugin but the regular user management screen to manage your user accounts then your admin account should have that capability already.

    To rule out that it’s not a problem with your user account, please create a new administrator account (Users > Add New) and give it another try. If you still can’t clear WPP’s data with the new admin account, please share the exact error message you’re seeing so I can have a look.

    Also:

    • WordPress version?
    • Plugin version?
    • Active plugins?
    Thread Starter jeykeysyn

    (@jeykeysyn)

    Hi Hector,

    I already did create a new admin account and it still does not work.

    I am using WordPress 5.3.2
    Plugin Version Version 5.0.1

    Other plugins:

    Disable Emojis (GDPR friendly)
    Version 1.7.2 | Von Ryan Hellyer

    Envato Market
    WordPress Theme & Plugin management for the Envato Market.
    Version 2.0.3 | Von Envato

    Lets Blog Theme Gallery
    Plugin that will create gallery post for Lets Blog theme.
    Version 1.5 | Von ThemeGoods

    Remove Google Fonts References
    Remove Open Sans and other google fonts references from all pages.
    Version 2.6 | Von Bruno Xu

    I am using the Button in the Tools section called “Alle Daten löschen” (in English probably “Clear all data”) The error message says:
    “Du hast nicht die erforderlichen Rechte um das zu tun. Bitte wende dich an den Administrator für weitere Hilfe.” (in English probably “You do not have the necessary rights to do this. Please contact the administrator for further assistance.”).

    Thanks for looking into this.

    Best,
    Joerg

    Plugin Author Hector Cabrera

    (@hcabrera)

    How odd. Do you have a staging/dev version of your website by any chance? There are some things I’d like you to try which involve messing around with code (not that it’ll break anything but better safe than sorry.)

    Thread Starter jeykeysyn

    (@jeykeysyn)

    sorry, no. I can give you access to an FTP where a db dump and the wp files are if you like. But we need to do that via e-mail. Shall I send it to [email protected] ?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yeah, about that, moderators can get a bit cranky (for good reasons though) when people request/offer access credentials here in the forums (see Forum Guidelines – The Bad Stuff).

    Try this:

    1. Assuming you haven’t done so already, please enable the debug log.
    2. Go to Plugins > Plugin Editor, then pick the WordPress Popular Posts plugin using the dropdown to your right to edit it.
    3. Click on src/Admin/Admin.php to open the file.
    4. In the clear_data() function (around line 1058) add the following right before the if condition:
      $debug = array(
          'can_manage_options' => current_user_can('manage_options'),
          'token' => $token,
          'clear' => $clear,
          'key' => $key
      );
      error_log(print_r($debug, true));

      It should look something like this:

      $token = $_POST['token'];
      $clear = isset($_POST['clear']) ? $_POST['clear'] : null;
      $key = get_option("wpp_rand");
      
      $debug = array(
          'can_manage_options' => current_user_can('manage_options'),
          'token' => $token,
          'clear' => $clear,
          'key' => $key
      );
      error_log(print_r($debug, true));
    5. Click on the Update File button to save changes.
    6. Go to Settings > WordPress Popular Posts > Tools and click on the Clear All Data button.
    7. Share the contents of your /wp-content/debug.log file (use pastebin.com for this, please).
    Plugin Author Hector Cabrera

    (@hcabrera)

    Alternatively, if you don’t want to deal with code -although this is just a workaround and won’t fix the problem- you could also just log in into phpMyAdmin (or whichever tool your hosting provider offers to manage databases) then empty (truncate) both the _popularpostsdata and _popularpostssummary tables.

    Thread Starter jeykeysyn

    (@jeykeysyn)

    Thanks, Hektor. I did the truncate thing.
    Thank you for the good and quick support.

    I wish you a happy new year
    Jörg

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Can not clear data as admin’ is closed to new replies.