Make WordPress Core

Ticket #8208: 8208.2.diff

File 8208.2.diff, 1.9 KB (added by DD32, 16 years ago)
  • wp-admin/edit-page-form.php

     
    356356}
    357357add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', 'core');
    358358
    359 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
     359$authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
    360360if ( $post->post_author && !in_array($post->post_author, $authors) )
    361361        $authors[] = $post->post_author;
    362362if ( $authors && count( $authors ) > 1 ) {
     
    369369         */
    370370        function page_author_meta_box($post){
    371371                global $current_user, $user_ID;
    372                 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
     372                $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
    373373                if ( $post->post_author && !in_array($post->post_author, $authors) )
    374374                        $authors[] = $post->post_author;
    375375?>
  • wp-admin/includes/user.php

     
    220220 * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
    221221 * @return unknown
    222222 */
    223 function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
     223function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
    224224        global $wpdb;
    225225
    226226        $user = new WP_User( $user_id );
    227227
    228         if ( ! $user->has_cap('edit_others_posts') ) {
    229                 if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
     228        if ( ! $user->has_cap("edit_others_{$post_type}s") ) {
     229                if ( $user->has_cap("edit_{$post_type}s") || $exclude_zeros == false )
    230230                        return array($user->id);
    231231                else
    232232                        return false;