has_cap('publish_posts')) { // Add the editor_overview_widget widget, if enabled // if ($assignment_desk->get_plugin_option('editor_overview_widget_enabled')) { wp_add_dashboard_widget('ad_editor_overview', 'Story Pitches', array(&$this, 'editor_overview_widget')); // } } } function count_pitches($status){ global $assignment_desk, $wpdb; $term_id = $wpdb->get_var("SELECT term_id FROM $wpdb->terms WHERE name=$status"); $count = $wpdb->get_var($wpdb->prepare("SELECT count FROM $wpdb->term_taxonomy WHERE taxonomy = %s AND term_id = %d", $assignment_desk->custom_pitch_statuses->get_taxonomy_id(), $term_id)); $count = $count ? $count : 0; return $count; } function editor_overview_widget() { global $assignment_desk, $current_user, $wpdb; $new_pitches_count = $this->count_pitches('New'); $approved_post_count = $this->count_pitches('Approved'); ?>