[wpmu-trac] [WordPress MU Trac] #1093: Post/page author dropdown field not displayed on edit post/page screen for site admins

WordPress MU Trac wpmu-trac at lists.automattic.com
Fri Sep 11 20:31:44 UTC 2009


#1093: Post/page author dropdown field not displayed on edit post/page screen for
site admins
----------------------------+-----------------------------------------------
 Reporter:  jamescollins    |       Owner:  somebody
     Type:  defect          |      Status:  new     
 Priority:  high            |   Milestone:          
Component:  Administration  |     Version:          
 Severity:  major           |    Keywords:          
----------------------------+-----------------------------------------------

Comment(by deannas):

 Oops, I had a redundant is_site_admin() in there from some earlier
 testing. Try this:


 {{{
 function get_editable_user_ids( $user_id, $exclude_zeros = true,
 $post_type = 'post' ) {
         global $wpdb;

         $user = new WP_User( $user_id );

         if (is_site_admin()) {
                 $level_key = $wpdb->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 !=
 'a:1:{s:10:\"subscriber\";b:1;}'";

                 $return = $wpdb->get_col( $query );
                 array_push($return, $user_id);

                 return $return;

         }

         if ( ! $user->has_cap("edit_others_{$post_type}s") ) {
                 if ( $user->has_cap("edit_{$post_type}s") ||
 $exclude_zeros == false )
                         return array($user->id);
                 else {
                         return array();
                         }
         }



 }
 }}}

-- 
Ticket URL: <http://trac.mu.wordpress.org/ticket/1093#comment:8>
WordPress MU Trac <http://mu.wordpress.org/>
WordPress Multiuser


More information about the wpmu-trac mailing list