Make WordPress Core


Ignore:
Timestamp:
06/14/2007 04:24:28 PM (17 years ago)
Author:
markjaquith
Message:

Introducing post_status="pending". see #4446 and put any initial bug reports on that ticket

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/user.php

    r5566 r5707  
    182182}
    183183
    184 function get_others_drafts( $user_id ) {
     184function get_others_unpublished_posts($user_id, $type='any') {
    185185    global $wpdb;
    186186    $user = get_userdata( $user_id );
     
    189189    $editable = get_editable_user_ids( $user_id );
    190190
     191    if ( in_array($type, array('draft', 'pending')) )
     192        $type_sql = " post_status = '$type' ";
     193    else
     194        $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
     195
    191196    if( !$editable ) {
    192         $other_drafts = '';
     197        $other_unpubs = '';
    193198    } else {
    194199        $editable = join(',', $editable);
    195         $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
    196     }
    197 
    198     return apply_filters('get_others_drafts', $other_drafts);
     200        $other_unpubs = $wpdb->get_results("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != '$user_id' ");
     201    }
     202
     203    return apply_filters('get_others_drafts', $other_unpubs);
     204}
     205
     206function get_others_drafts($user_id) {
     207    return get_others_unpublished_posts($user_id, 'draft');
     208}
     209
     210function get_others_pending($user_id) {
     211    return get_others_unpublished_posts($user_id, 'pending');
    199212}
    200213
Note: See TracChangeset for help on using the changeset viewer.