diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php new file mode 100644 index 0000000000..78e803c864 --- /dev/null +++ b/wp-admin/admin-db.php @@ -0,0 +1,29 @@ +posts WHERE post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC"; + $query = apply_filters('get_users_drafts', $query); + return $wpdb->get_results( $query ); +} + +function get_others_drafts( $user_id ) { + global $wpdb; + $user = get_userdata( $user_id ); + $level_key = $wpdb->prefix . 'user_level'; + if ( 1 < $user->user_level ) { + $editable = $wpdb->get_col("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value <= '$user->user_level' AND user_id != $user_id"); + if( is_array( $editable ) == false ) + $other_drafts = ''; + else { + $editable = join(',', $editable); + $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author IN ($editable) "); + } + } else { + $other_drafts = false; + } + return apply_filters('get_others_drafts', $other_drafts); +} + +?> \ No newline at end of file diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 7ac6ef6d3a..47c49b2fb1 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1388,4 +1388,8 @@ function pimp_firefox() { } add_action('admin_footer', 'pimp_firefox'); +function documentation_link( $for ) { + return; +} + ?> \ No newline at end of file diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 291564b44c..64e602afe4 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -5,6 +5,7 @@ else require_once('../wp-config.php'); require_once(ABSPATH . 'wp-admin/admin-functions.php'); +require_once(ABSPATH . 'wp-admin/admin-db.php'); auth_redirect(); nocache_headers(); diff --git a/wp-admin/edit.php b/wp-admin/edit.php index cb821a6cb7..7f41629f16 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -9,18 +9,8 @@ $_GET['m'] = (int) $_GET['m']; get_currentuserinfo(); -$drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID"); -if (1 < $user_level) { - $editable = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_level <= '$user_level' AND ID != $user_ID"); - if( is_array( $editable ) == false ) - $other_drafts = ''; - else { - $editable = join(',', $editable); - $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author IN ($editable) "); - } -} else { - $other_drafts = false; -} +$drafts = get_users_drafts( $user_ID ); +$other_drafts = get_others_drafts( $user_ID); if ($drafts || $other_drafts) { ?> diff --git a/wp-admin/index.php b/wp-admin/index.php index 52de37c79f..37dbef65b5 100644 --- a/wp-admin/index.php +++ b/wp-admin/index.php @@ -51,6 +51,16 @@ if ( $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, ?>
+ + +- post_title = stripslashes($draft->post_title); - if ($draft->post_title == '') - $draft->post_title = sprintf(__('Post #%s'), $draft->ID); - echo "$draft->post_title"; - ++$i; - } - ?> - .
-View site »'), get_bloginfo('home')); ?>
post_title = stripslashes($draft->post_title); - if ($draft->post_title == '') + if ( empty($draft->post_title) ) $draft->post_title = sprintf(__('Post # %s'), $draft->ID); echo "$draft->post_title"; - ++$i; - } - ?>.
+ } + ?> + + , » + + .