Support » Plugin: Admin Dashboard Last Edits » Nice Plugin. But how can I display it based on user role?

  • Resolved li0817

    (@li0817)


    Hi, there.

    It’s a nice plugin, very useful and easy to use.
    But, I don’t want this plugin display for the subscriber role.
    How can I do that, Any idea?

    Many thanks
    Dennis

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

    (@wpdocde)

    Thank you for your feedback. You could fork the plugin and make a version of your own using current_user_can.

    After googling for 2 hours, I finally added the following snippet to my function.php file.
    But It doesn’t work.

    if( current_user_can( ‘read’ ) && !current_user_can( ‘edit_posts’ ) ) {
    function remove_dashboard_widgets() {
    remove_meta_box( ‘admin_dashboard_last_edits_register’, ‘dashboard’, ‘normal’);
    }
    add_action(‘wp_user_dashboard_setup’, ‘remove_dashboard_widgets’, 20);
    add_action(‘wp_dashboard_setup’, ‘remove_dashboard_widgets’, 20);
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Nice Plugin. But how can I display it based on user role?’ is closed to new replies.