Title: calling current_user_can() function incorrectly.
Last modified: January 30, 2018

---

# calling current_user_can() function incorrectly.

 *  Resolved [Paul Menard](https://wordpress.org/support/users/pmenard/)
 * (@pmenard)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/calling-current_user_can-function-incorrectly/)
 * I posted this to another thread but then noticed it was already marked as resolved.
   So this might be seen as a duplicate. Apologies.
 * In version 6.2.7 of your plugin. In the file class-am-notifications.php in the
   function get_remote_notifications() line 92 you have the following:
 * if ( ! current_user_can( apply_filters( ‘am_notifications_display’, is_super_admin()))){
 *  In the inner command you have a filter which will return true or false.
    apply_filters(‘
   am_notifications_display’, is_super_admin() )
 * Then you are passing this true/false into the current_user_can() as the first
   parameter. This is wrong. You should be passing a string like ‘manage_options’
   or ‘edit_posts’ etc. a capability.
 * Down the line when other plugins who are subscribed to the ‘map_meta_cap’ filter
   receive true or false as the $cap parameter (second) instead of a string.

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

 *  Plugin Author [chriscct7](https://wordpress.org/support/users/chriscct7/)
 * (@chriscct7)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/calling-current_user_can-function-incorrectly/#post-9918788)
 * Hi there,
    The current_user_can part isn’t supposed to be there. Not sure how
   that got there but it just needs to be removed. We’ll get a fix issued for this
   right away
 * -Chris
    -  This reply was modified 8 years, 4 months ago by [chriscct7](https://wordpress.org/support/users/chriscct7/).
 *  Plugin Author [chriscct7](https://wordpress.org/support/users/chriscct7/)
 * (@chriscct7)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/calling-current_user_can-function-incorrectly/#post-9918833)
 * Hi there,
    A fix for this has been issued as 6.2.8.
 * -Chris
 *  Thread Starter [Paul Menard](https://wordpress.org/support/users/pmenard/)
 * (@pmenard)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/calling-current_user_can-function-incorrectly/#post-9919033)
 * Thanks for the quick fix.
 *  [daxelrod](https://wordpress.org/support/users/daxelrod/)
 * (@daxelrod)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/calling-current_user_can-function-incorrectly/#post-9949741)
 * Sorry to re-open, but this is only fixed on line 92.
 * The exact same bug still remains on lines 189 and 428 of the same file (class-
   am-notification.php). Hopefully another quick fix.
 * [https://plugins.trac.wordpress.org/browser/google-analytics-for-wordpress/trunk/assets/lib/pandora/class-am-notification.php#L189](https://plugins.trac.wordpress.org/browser/google-analytics-for-wordpress/trunk/assets/lib/pandora/class-am-notification.php#L189)
 * [https://plugins.trac.wordpress.org/browser/google-analytics-for-wordpress/trunk/assets/lib/pandora/class-am-notification.php#L428](https://plugins.trac.wordpress.org/browser/google-analytics-for-wordpress/trunk/assets/lib/pandora/class-am-notification.php#L428)
 *  Plugin Author [chriscct7](https://wordpress.org/support/users/chriscct7/)
 * (@chriscct7)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/calling-current_user_can-function-incorrectly/#post-9951293)
 * Those have been fixed in the next scheduled release for MonsterInsights Lite.

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

The topic ‘calling current_user_can() function incorrectly.’ is closed to new replies.

 * ![](https://ps.w.org/google-analytics-for-wordpress/assets/icon.svg?rev=2976619)
 * [MonsterInsights - Google Analytics Dashboard for WordPress (Website Stats Made Easy)](https://wordpress.org/plugins/google-analytics-for-wordpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-analytics-for-wordpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-analytics-for-wordpress/)
 * [Active Topics](https://wordpress.org/support/plugin/google-analytics-for-wordpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-analytics-for-wordpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-analytics-for-wordpress/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [chriscct7](https://wordpress.org/support/users/chriscct7/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/calling-current_user_can-function-incorrectly/#post-9951293)
 * Status: resolved