[wp-trac] [WordPress Trac] #22624: New current_user_has_role function to work for roles like current_user_can does for caps
WordPress Trac
noreply at wordpress.org
Fri Sep 27 16:53:05 UTC 2013
#22624: New current_user_has_role function to work for roles like current_user_can
does for caps
-----------------------------+----------------------
Reporter: sc0ttkclark | Owner:
Type: feature request | Status: closed
Priority: normal | Milestone:
Component: Users | Version:
Severity: normal | Resolution: wontfix
Keywords: |
-----------------------------+----------------------
Changes (by SergeyBiryukov):
* keywords: close =>
* status: new => closed
* resolution: => wontfix
* milestone: Awaiting Review =>
Comment:
Going to close per comment:10. Here's a simple function I would use to get
a user role:
{{{
function get_user_role( $user_id = 0 ) {
$user = ( $user_id ) ? get_userdata( $user_id ) :
wp_get_current_user();
return current( $user->roles );
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22624#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list