if ($post_id) { // set metadata update_post_meta($post_id, 'fwp_name', esc_attr($submitterName)); update_post_meta($post_id, 'submitter_email', esc_attr($submitterEmail)); // set url if provided in form if ($assignmentExampleOpts < 3) { update_post_meta($post_id, 'fwp_url', esc_url_raw($_POST['assignmentURL'])); } // give twitter credit if used if ($submitterTwitter) { update_post_meta($post_id, 'submitter_twitter', esc_attr($submitterTwitter)); } // set the term for the type of assignment wp_set_object_terms($post_id, $assignmentType, 'assignmenttypes'); // update the new tags update_assignment_tags($post_id); // update post meta for the initial rating, the average and score = the entered value update_post_meta($post_id, 'ratings_average', $assignmentRating); update_post_meta($post_id, 'ratings_score', $assignmentRating); // the rating count set to 1 update_post_meta($post_id, 'ratings_users', 1); // give it a count update_post_meta($post_id, 'assignment_visits', 1); if ($use_difficulty_rating) { update_post_meta($post_id, 'assignment_difficulty', $assignmentDifficulty); } // user selected license if ($my_cc_mode == 'user') { update_post_meta($post_id, 'cc', $assignmentCC); } // if we got an attachment id, then update meta data to indicate thumbnal
function set_assignment_tag($post_id) { // on saving an assignment make sure it is assigned unique tags // based on type of assignment and post ID // code from http://codex.wordpress.org/Plugin_API/Action_Reference/save_post // skip if not an assignment post type or it is a revision if ($_POST['post_type'] != 'assignments' or wp_is_post_revision($post_id)) { return; } /* Request passes all checks; update the things's taxonomy */ update_assignment_tags($post_id); }