Title: Function has_role()
Last modified: August 22, 2016

---

# Function has_role()

 *  Resolved [dobol10](https://wordpress.org/support/users/dobol10/)
 * (@dobol10)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/function-has_role/)
 * Hi,
 * I am using user-specific-content version 1.0.4.
 * The shortcode
 * [O_U user_role=”subscriber” blocked_message=”The content is block.”]Some content![/
   O_U]
 * Is not working.
 * The return in_array($role, (array) $user->roles) of the function has_role($role,
   $user_id = null) is returning NULL in the file user-specific-content/User-Specific-
   Content.php.
 * The user i am testing have the “subscriber” role.
 * If i change the plugin User Specific Content version to 1.0.1, it’s working.
 * Is it possible that the new has_role (replacing bausp_get_current_user_role) 
   function as a bug in it?
 * Thank you very much.
 * Dominic Bolduc
 * [https://wordpress.org/plugins/user-specific-content/](https://wordpress.org/plugins/user-specific-content/)

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

 *  [emiliengerbois](https://wordpress.org/support/users/emiliengerbois/)
 * (@emiliengerbois)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/function-has_role/#post-5716100)
 * Hi doblo10,
 * I’m facing the same problem as you and I came to the same conclusion that there
   is something wrong with the has_role function… I’m not a dev so I unfortunately
   can’t solve this on my own, and it looks like this plugins has been abandoned
   for months… at least for its support.
 * Did you come to a solution with this and/or did you find another actively developed
   plugin as an alternative?
 * Thank you so much in advance, have a nice day,
    Emilien
 *  [emiliengerbois](https://wordpress.org/support/users/emiliengerbois/)
 * (@emiliengerbois)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/function-has_role/#post-5716101)
 * I found something and posted it [here](https://wordpress.org/support/topic/here-is-a-fix-to-104-to-restore-shortcodes?replies=1#post-6751481)
   in case it could help.
 *  Plugin Author [Bainternet](https://wordpress.org/support/users/bainternet/)
 * (@bainternet)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/function-has_role/#post-5716102)
 * Yep there was a bug which is now fixed in 1.0.5
 *  [emiliengerbois](https://wordpress.org/support/users/emiliengerbois/)
 * (@emiliengerbois)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/function-has_role/#post-5716103)
 * Great! thank you for your responsiveness and for this fix! have a great day!

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

The topic ‘Function has_role()’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/user-specific-content_ffffff.svg)
 * [User Specific Content](https://wordpress.org/plugins/user-specific-content/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-specific-content/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-specific-content/)
 * [Active Topics](https://wordpress.org/support/plugin/user-specific-content/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-specific-content/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-specific-content/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [emiliengerbois](https://wordpress.org/support/users/emiliengerbois/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/function-has_role/#post-5716103)
 * Status: resolved