Support » Plugin: SendGrid » stats display to any subscriber on dashboard

  • Hi Guys, the stats on the dashboard will currently show to any user that can access the dashboard, be it a subscriber or administrator.

    To fix this, add a line like so to lib/class-sendgrid-statistics.php as the first line within the Sendgrid_Statistics::add_sashboard_widget function

    if( !current_user_can('list_users') ) return;

    Alternatively you can create custom caps for this, but I think in most cases only admins should see this info, the above does that. This isn’t MultiSite compatible, I think all site admins will see the stats, maybe is_super_admin() would work as a check.

    https://wordpress.org/plugins/sendgrid-email-delivery-simplified/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Came here to stay the exact same thing. Was reported by one of my users as well. I had to drop this in and i made it for only people who can ‘manage_options’. Please fix this.

    Marcus

    (@netweblogic)

    @cklosows is right, manage_options is more appropriate actaully, or whatever cap SG uses to show their settings page

    if( !current_user_can('manage_options') ) return;

    I don’t need the stats there at all, so I used the following in my theme’s functions.php to remove the dashboard widget entirely:

    function doublee_remove_dashboard_widget() {
     	remove_meta_box( 'sendgrid_statistics_widget', 'dashboard', 'normal' );
    }
    add_action('wp_dashboard_setup', 'doublee_remove_dashboard_widget' );

    I imagine this can be combined with some if_user_can stuff to apply it only to the roles you don’t want to see it.

    Marcus

    (@netweblogic)

    considering sendgrid hasn’t acknowledged the bug I may end up doing that if they push out an update without fixing this.

    @marcus,

    They are aware of the issue. I’ve contacted them via Twitter. Their development staff is looking into fixing it.

    Marcus

    (@netweblogic)

    @cklosows, thx good to know

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘stats display to any subscriber on dashboard’ is closed to new replies.