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', 'Assignment Desk Overview', array(&$this, 'overview_widget')); // } } wp_add_dashboard_widget('ad_assignments', 'Assignments', array(&$this, 'assignments_widget')); } /** * Return the number of objects associated with this status * $status is a term */ function count_pitches($status){ global $assignment_desk, $wpdb; $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, $status->term_id)); $count = $count ? $count : 0; return $count; } function 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 "
"; } } ?>| " . count(get_unassigned_posts()) . " | "; echo "" . _('Unassigned', 'assignment-desk') . " |
| " . count(get_inprogress_posts()) . " | "; echo "" . _('In Progress', 'assignment-desk') . " |
| $q->found_posts | "; echo "" . _('Published this month', 'assignment-desk') . " |
pending assignment.
ID || $user_ID != $post_id) { $_REQUEST['ad-dashboard-assignment-messages'][] = _('Unauthorized assignment response. This is fishy.'); } $_REQUEST['ad-dashboard-assignment-messages'] = array(); if ($response && $post_id && $role_id){ $participant_record = get_post_meta($post_id, "_ad_participant_role_$role_id", true); // This will not evaluate to true unless the user is currently pending for this role on this post. if($participant_record && $participant_record[$current_user->ID] == 'pending'){ $participant_record[$current_user->ID] = $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); } $user_participant = get_post_meta($post_id, "_ad_participant_$current_user->ID", true); if(!$user_participant){ $user_participant = array(); } $user_participant[] = $role_id; update_post_meta($post_id, "_ad_participant_$current_user->ID", $user_participant); } else if($response == 'declined'){ $_REQUEST['ad-dashboard-assignment-messages'][] = _('Sorry!.'); } } update_post_meta($post_id, "_ad_participant_role_$role_id", $participant_record); } } } ?>