Example #1
0
 /**
  * getInstance method
  *
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public function disput_opened($user_id, $project_info_output)
 {
     $user = get_userdata($user_id);
     $subject = __('Project suspended', 'aecore-class-ae-mailing-backend');
     $content = ae_get_option('ae_disput_mail_' . ICL_LANGUAGE_CODE);
     if ($project_info_output['current_user_id'] == $user_id) {
         $this->wp_mail($project_info_output['e_mail'], $subject, $content, array('user_id' => $user_id, 'post' => $project_info_output['ID']));
     } else {
         $this->wp_mail($user->user_email, $subject, $content, array('user_id' => $user_id, 'post' => $project_info_output['ID']));
     }
     Fre_Notification::project_suspended($user_id, $project_info_output['ID'], $project_info_output['current_user_id']);
     return true;
 }
 /**
  * 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);
 }