Order pending posts nag by post_modified ASC, drafts by post_modified DESC
git-svn-id: http://svn.automattic.com/wordpress/trunk@5750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a05fcdcf23
commit
d50996b941
|
@ -193,11 +193,13 @@ function get_others_unpublished_posts($user_id, $type='any') {
|
||||||
else
|
else
|
||||||
$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
|
$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
|
||||||
|
|
||||||
|
$dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
|
||||||
|
|
||||||
if( !$editable ) {
|
if( !$editable ) {
|
||||||
$other_unpubs = '';
|
$other_unpubs = '';
|
||||||
} else {
|
} else {
|
||||||
$editable = join(',', $editable);
|
$editable = join(',', $editable);
|
||||||
$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' ");
|
$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' ORDER BY post_modified $dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters('get_others_drafts', $other_unpubs);
|
return apply_filters('get_others_drafts', $other_unpubs);
|
||||||
|
@ -231,7 +233,7 @@ function get_user_to_edit( $user_id ) {
|
||||||
function get_users_drafts( $user_id ) {
|
function get_users_drafts( $user_id ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$user_id = (int) $user_id;
|
$user_id = (int) $user_id;
|
||||||
$query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC";
|
$query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY post_modified DESC";
|
||||||
$query = apply_filters('get_users_drafts', $query);
|
$query = apply_filters('get_users_drafts', $query);
|
||||||
return $wpdb->get_results( $query );
|
return $wpdb->get_results( $query );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue