/** * notify employer/freelancer when project suspended * @param int $bid_id the id of bid * @since 1.2 * @author Dakachi */ function project_suspended($user_id, $project_id, $started_by) { // $bid = get_post($bid_id); // if (!$bid || is_wp_error($bid)) return; // // $project_id = $bid->post_parent; $project = get_post($project_id); $user = get_userdata($started_by); // if (!$project || is_wp_error($project)) return; $content = 'type=project_suspended&started_by=' . $started_by . '&project=' . $project_id; // insert notification $notification = array('post_type' => 'notify', 'post_parent' => $project_id, 'post_content' => $content, 'post_excerpt' => $content, 'post_status' => 'publish', 'post_author' => $user_id, 'post_title' => sprintf(__("%s ", 'notification-backend'), '')); return Fre_Notification::insert($notification); }