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')); // } } wp_add_dashboard_widget('ad_assignments', 'Assignments', array(&$this, 'assignments_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_taxonomies->assignment_status_label, $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'); if($_REQUEST['ad-dashboard-editor-messages']){ foreach($_REQUEST['ad-dashboard-assignment-messages'] as $messages){ echo "
$message
"; } } ?>
New
Approved
» Go to Assignment Desk landing page.
$message"; } } // Find all of the posts this user participates in. $participant_posts = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_ad_participant_{$current_user->user_login}' ORDER BY post_id"); if ( ! $participant_posts ){ $participant_posts = array(); } $roles = $assignment_desk->custom_taxonomies->get_user_roles(); foreach($participant_posts as $post ){ foreach($roles as $user_role){ // Get all of the roles this user has for this post $participant_record = get_post_meta($post->post_id, "_ad_participant_role_$user_role->term_id", true); if($participant_record) { foreach ($participant_record as $user_login => $status ){ if( $user_login == $current_user->user_login && $status == 'pending' ){ $pending_posts[] = array($post->post_id, $user_role); } } } } } $count_pending = count($pending_posts); ?>

pending assignment.

post_title} | {$pending[1]->name}"; echo " Accept "; echo "Decline"; ?>
» Go to Assignment Desk landing page.
user_login] == 'pending'){ $participant_record[$current_user->user_login] = $response; if($response == 'accepted'){ $_REQUEST['ad-dashboard-assignment-messages'][] = _('Thank you.'); // Add as a co-author if($assignment_desk->coauthors_plus_exists()){ $coauthors_plus->add_coauthors($post_id, array($current_user->user_login), true); } } else if($response == 'declined'){ $_REQUEST['ad-dashboard-assignment-messages'][] = _('Sorry!.'); } } update_post_meta($post_id, "_ad_participant_role_$role_id", $participant_record); } } } ?>