posts.*, display_name as name FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->posts.post_author=$wpdb->users.ID "; switch ($widget_options['showwhat']) { case 'Draft': $what = "draft"; break; case 'Review': $what = "pending"; break; default: $what = "draft', 'pending"; } switch ($widget_options['sortorder']) { case 'Date': $sortby = "post_date"; break; case 'ID': $sortby = "ID"; break; case 'AuthorDate': $sortby = "post_author, post_date"; break; default: $sortby = "post_author, ID"; } switch ($widget_options['showpages']) { case 1: $request .= "WHERE post_status IN ('".$what."') AND post_type IN ('post') "; break; default: $request .= "WHERE post_status IN ('".$what."') AND post_type IN ('post','page') "; } $request .= "ORDER BY ".$sortby." ".$widget_options['ascdesc']." LIMIT ".$widget_options['items_view_count']; $posts = $wpdb->get_results($request); if ( $posts ) { echo "\n"; } else { echo '

' . _e( "No pending posts found.", AvDashboard_DraftReview_DOMAIN ) . "

\n"; } } /** * Setup the widget. * - reads the saved options from the database */ function AvDashboardDraftReview_Setup() { $options = AvDashboardDraftReview_Options(); if ( 'post' == strtolower($_SERVER['REQUEST_METHOD']) && isset( $_POST['widget_id'] ) && AvDashboard_DraftReview_WidgetID == $_POST['widget_id'] ) { foreach ( array( 'items_view_count', 'showpages', 'showwhat', 'showtime', 'formattime', 'fhovertime', 'showauthor', 'sortorder', 'ascdesc' ) as $key ) $options[$key] = $_POST[$key]; update_option( AvDashboard_DraftReview_OPTION_NAME, $options ); } ?>

5, 'showpages' => 1, 'showwhat' => 'Draft', 'showtime' => 1, 'formattime' => 'D, j.M Y', 'fhovertime' => 'l, j. F Y G:i', 'showauthor' => 1, 'sortorder' => 'Date', 'ascdesc' => 'DESC'); if ( ( !$options = get_option( AvDashboard_DraftReview_OPTION_NAME ) ) || !is_array($options) ) $options = array(); return array_merge( $defaults, $options ); } /** initial the widget */ function AvDashboardDraftReview_Init() { wp_add_dashboard_widget( AvDashboard_DraftReview_WidgetID, __('Drafts & Pending Reviews', AvDashboard_DraftReview_DOMAIN), 'AvDashboardDraftReview_Main', 'AvDashboardDraftReview_Setup'); } //******************************************************************* // Start main //******************************************************************* { //Check WP Content Url // Pre-2.6 compatibility if ( !defined('WP_CONTENT_URL') ) define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); if ( !defined('WP_CONTENT_DIR') ) define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); //Init the language files AvDashboardDraftReviewInitLanguageFiles(); /** use hook, to integrate the widget */ add_action('wp_dashboard_setup', 'AvDashboardDraftReview_Init'); } // end main ?>