From 1788d5840f01a32a8ed102b4f065a5d4496d5ca1 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 5 Dec 2013 21:23:10 +0000 Subject: [PATCH] Dashboard backwards compatibility updates. * Restore missing wp_dashboard_rss_control() helper. * Restore all original 3.7 functions, deprecating many, reusing others. * Rename and remove functions so as not to clash with the original dash plugin. * Filter cleanup/restoration. see #25824, #26334. Built from https://develop.svn.wordpress.org/trunk@26690 git-svn-id: http://core.svn.wordpress.org/trunk@26580 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/dashboard.php | 138 ++++++++++++++++++++----------- wp-admin/includes/deprecated.php | 25 ++++++ 2 files changed, 113 insertions(+), 50 deletions(-) diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index f78d595ab5..f86d39a334 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -44,7 +44,7 @@ function wp_dashboard_setup() { // Activity Widget if ( is_blog_admin() ) { - wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_activity' ); + wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' ); } // QuickPress Widget @@ -343,17 +343,28 @@ function wp_dashboard_quick_press( $error_msg = false ) { 'post', - 'post_status' => 'draft', - 'author' => get_current_user_id(), - 'posts_per_page' => 4, - 'orderby' => 'modified', - 'order' => 'DESC' - ); - $drafts = get_posts( $query_args ); + wp_dashboard_recent_drafts(); +} + +/** + * Show recent drafts of the user on the dashboard. + * + * @since 2.7.0 + */ +function wp_dashboard_recent_drafts( $drafts = false ) { if ( ! $drafts ) { - return; + $query_args = array( + 'post_type' => 'post', + 'post_status' => 'draft', + 'author' => get_current_user_id(), + 'posts_per_page' => 4, + 'orderby' => 'modified', + 'order' => 'DESC' + ); + $drafts = get_posts( $query_args ); + if ( ! $drafts ) { + return; + } } echo '
'; @@ -475,13 +486,11 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { * * @since 3.8.0 */ -function wp_dashboard_activity() { +function wp_dashboard_site_activity() { echo '
'; - do_action( 'dashboard_activity_beginning' ); - - $future_posts = dashboard_show_published_posts( array( + $future_posts = wp_dashboard_recent_posts( array( 'display' => 2, 'max' => 5, 'status' => 'future', @@ -489,7 +498,7 @@ function wp_dashboard_activity() { 'title' => __( 'Publishing Soon' ), 'id' => 'future-posts', ) ); - $recent_posts = dashboard_show_published_posts( array( + $recent_posts = wp_dashboard_recent_posts( array( 'display' => 2, 'max' => 5, 'status' => 'publish', @@ -498,9 +507,7 @@ function wp_dashboard_activity() { 'id' => 'published-posts', ) ); - do_action( 'dashboard_activity_middle' ); - - $recent_comments = dashboard_comments(); + $recent_comments = wp_dashboard_recent_comments(); if ( !$future_posts && !$recent_posts && !$recent_comments ) { echo '
'; @@ -509,8 +516,6 @@ function wp_dashboard_activity() { echo '
'; } - do_action( 'dashboard_activity_end' ); - echo '
'; } @@ -521,8 +526,7 @@ function wp_dashboard_activity() { * * @param array $args */ -function dashboard_show_published_posts( $args ) { - +function wp_dashboard_recent_posts( $args ) { $query_args = array( 'post_type' => 'post', 'post_status' => $args['status'], @@ -532,7 +536,6 @@ function dashboard_show_published_posts( $args ) { 'no_found_rows' => true, 'cache_results' => false ); - $query_args = apply_filters( 'dash_show_published_posts_query_args', $query_args ); $posts = new WP_Query( $query_args ); if ( $posts->have_posts() ) { @@ -548,12 +551,25 @@ function dashboard_show_published_posts( $args ) { echo '