wpseek.com
A WordPress-centric search engine for devs and theme authors
get_editable_user_ids is deprecated since version 3.1.0!
Alternative: get_users()
Alternative: get_users()
get_editable_user_ids › WordPress Function
Sincen/a
Deprecated3.1.0
› get_editable_user_ids ( $user_id, $exclude_zeros = true, $post_type = 'post' )
Parameters: (2) |
|
Returns: |
|
Defined at: |
|
Codex: |
Gets the IDs of any users who can edit posts.
Related Functions: get_editable_authors, get_editable_roles, get_edit_user_link, get_author_user_ids, get_current_user_id
Source
function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; if ( ! $user = get_userdata( $user_id ) ) return array(); $post_type_obj = get_post_type_object($post_type); if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) { if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros ) return array($user->ID); else return array(); } if ( !is_multisite() ) $level_key = $wpdb->get_blog_prefix() . 'user_level'; else $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels. $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); if ( $exclude_zeros ) $query .= " AND meta_value != '0'"; return $wpdb->get_col( $query ); }