• Hi,
    it seems that this plugin limits the dashboard availability to admins only. I thought to allow site owners, without admin rule to be able to see the logs too.

    Is there a way to allow this ? A wp-config additional code or an option to be added to select user roles.. ?

    Regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    The way it works “under the hood” is that only roles/users that have the manage_options capability can see the dashboard widget. I wouldn’t recommend giving this capability to non-admins because it would also give them access to a number of other admin features.

    You can change the required capability by using the elm_show_dashboard_widget filter. For example:

    
    function elm_allow_other_roles() {
        //Allow any role that can publish posts.
        return 'publish_posts'; 
    }
    add_filter('elm_show_dashboard_widget', 'elm_allow_other_roles', 10, 0);
    

    Has something changed with how this filter works?

    I need to give editors the capability to manage_options on a client’s site, but using the add_filter code posted above, with ‘update_core’ as the returned value, doesn’t have any effect on whether the editors can see the dashboard widget (they still can).

    Plugin Author Janis Elsts

    (@whiteshadow)

    The filter hasn’t changed, it’s actually my original example code that was wrong. Instead of returning a capability name, the filter should perform the capability check and return true or false. Like this:

    function elm_allow_other_roles() {
        return current_user_can('update_core'); 
    }
    add_filter('elm_show_dashboard_widget', 'elm_allow_other_roles', 10, 0);

    That seems to be working. Thanks much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show logs to all users’ is closed to new replies.