WordPress.org

Forums

Simple History
[resolved] Who Can See It? (9 posts)

  1. npacademy
    Member
    Posted 1 year ago #

    Hi

    Which user levels can see the simple history records?

    Thanks.

    https://wordpress.org/plugins/simple-history/

  2. Marcelo Pedra
    Member
    Posted 1 year ago #

    Good question. I'm wondering the same thing...

  3. Pär Thernström
    Member
    Plugin Author

    Posted 1 year ago #

    Currently it's everyone with the edit_pages capability.

    This can be modified by using the filter simple_history_view_history_capability.

  4. Marcelo Pedra
    Member
    Posted 1 year ago #

    @Pär: thanks. Is there any docs online to view how to use this filter?
    I'd like to allow only admins or superadmins (under multisite) to view reports. How do you implement this?

  5. Pär Thernström
    Member
    Plugin Author

    Posted 1 year ago #

    This should do it I think:

    // Require the manage_options-capability to be able to view the simple history log
    // manage_options = a capability that only admin have
    add_filter("simple_history_view_history_capability", function($cap) {
      return "manage_options"
    });
  6. Marcelo Pedra
    Member
    Posted 1 year ago #

    Are you sure the syntax is ok? I obtain a blank page when I added that code to my functions.php file

  7. Pär Thernström
    Member
    Plugin Author

    Posted 1 year ago #

    Are you perhaps running or PHP < 5.3?
    Try this instead then:

    // Require the manage_options-capability to be able to view the simple history log
    // manage_options = a capability that only admin have
    add_filter("simple_history_view_history_capability", "prefix_simple_history_view_history_capability");
    
    function prefix_simple_history_view_history_capability($cap) {
      return "manage_options"
    }
  8. Marcelo Pedra
    Member
    Posted 1 year ago #

    Buddy there is a small typo in your code. You forgot a ; after the return.

    add_filter("simple_history_view_history_capability", "prefix_simple_history_view_history_capability");
    
    function prefix_simple_history_view_history_capability($cap) {
      return "manage_options";
    }

    Now it works!
    Thank you!

  9. k.vaillant
    Member
    Posted 1 year ago #

    Hello.
    At home it always appears as an editor and administrator.
    How to erase it of the editor.
    Thank you

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.