From: Steve Sutton Date: Wed, 2 May 2018 13:22:47 +0000 (-0400) Subject: Update so all changes to jobs are moderated. X-Git-Tag: v1.0.0~1^2~7 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=6bf8180787ed1bf051c5dbf4c527d040f7370eeb;p=WP-Plugins%2Fglm-member-db-jobs.git Update so all changes to jobs are moderated. Migcsa has to approve all changes to jobs. --- diff --git a/models/admin/jobs/index.php b/models/admin/jobs/index.php index 326fe89..0d0fbfc 100644 --- a/models/admin/jobs/index.php +++ b/models/admin/jobs/index.php @@ -91,10 +91,10 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs { $members = new GlmDataMembers($this->wpdb, $this->config); $member_list = $members->getList(false, 'name'); - + $job_titles = new GlmDataJobTitles($this->wpdb,$this->config); - - + + $success_message = ""; $haveJob = false; $option = false; @@ -110,24 +110,24 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs $memberID = false; $haveMember = false; $where = ' TRUE '; - - + + $isPending = ( !empty( $_REQUEST['pending-job'] ) ) ? true : false; $textSearch = ( !empty( $_REQUEST['text-search'] ) ) ? filter_var($_REQUEST['text-search'], FILTER_SANITIZE_STRING) : false; - + // Load Notifications from the helper classes include_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH. '/helper/notifications.php'; $notification = new GlmMembersAdmin_jobs_notification( $this->wpdb, $this->config ); - - + + // Check if there's a logged in user who is locked to their own entity $lockedToMember = apply_filters('glm_members_locked_to_member_id', false); if ($lockedToMember) { - $isModerated = apply_filters('glm_user_is_moderated', $lockedToMember); + $isModerated = true;//apply_filters('glm_user_is_moderated', $lockedToMember); $memberID = $lockedToMember; - + $this->fields['admin_name']['required'] = true; $this->fields['admin_email']['required'] = true; $this->fields['admin_phone']['required'] = true; @@ -157,7 +157,7 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs // Get base member information require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php'; - + $memberData = $members->getEntry($memberID); $where .= "AND member = $memberID"; if (!$memberData) { @@ -176,18 +176,18 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs } } - + if($isPending){ $where .= " AND active = 0 "; } else if($textSearch){ $where .= " AND (title LIKE '%$textSearch%' OR company LIKE '%$textSearch%') "; } - + if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { $option = $_REQUEST['option']; } - + // get the Job id for use in the edit, add and delete options // Get obit ID if supplied if (isset($_REQUEST['job'])) { @@ -199,25 +199,25 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs $this->job_id = false; } } - + switch ($option) { case 'add': - + $job = $this->newEntry(); $view_file = 'edit'; $job_titles = $job_titles->getList(); $job_data = $this->getList($where); - + break; case 'insert': - + $job = $this->insertEntry(); $this->job_id = $job['fieldData']['id']; $this->checkNewJobTitles(); $updated = $this->getUpdatedTime($this->job_id); - + if ($job['status']) { $haveJob = true; $jobAdded = true; @@ -230,17 +230,17 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs $job = $this->editEntry($this->job_id); $this->updateTimestamp('updated', $this->job_id,$job,$updated); // $job = $this->addNewTitle($job); - + $option = 'edit'; $jobAdded = true; - - + + } else { $option = 'add'; $jobAddError = true; } - + $job_data = $this->getList($where); $view_file = 'edit'; @@ -253,10 +253,10 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs break; case 'edit': - + $job = $this->editEntry($this->job_id); - - + + // If we're locked to a member as a contact user and the event member doesn't equal the contact member if ($lockedToMember && $job['fieldData']['member']['value'] != $lockedToMember) { $haveJob = false; @@ -277,12 +277,12 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs // Try to update this Job $job = $this->updateEntry($this->job_id); $this->checkNewJobTitles(); - + // Check if that was successful if ($job['status']) { $jobUpdated = true; $job = $this->editEntry($this->job_id); - + } else { $jobUpdateError = true; } @@ -291,7 +291,7 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs $this->updateTimestamp('updated', $this->job_id,$job,$updated); $haveJob = true; $view_file = 'edit'; - + break; case 'delete': @@ -307,7 +307,7 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs default: $job_data = $this->getList($where, "post_date DESC"); $view_file = 'index'; - + break; } // echo $where; @@ -332,7 +332,7 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs 'isPending' => $isPending, 'textSearch' => $textSearch, 'assetsUrl' => GLM_MEMBERS_JOBS_PLUGIN_URL . 'assets/', - + ); // Return status, any suggested view, and any data to controller @@ -353,21 +353,21 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs */ public function checkNewJobTitles() { - + // If we have a member ID and this was a submission with a new city (id < 0) if (isset($_REQUEST['new_job_title']) && trim($_REQUEST['new_job_title']) != '') { - + // Clean up job titlename $jName = trim(filter_var($_REQUEST['new_job_title'])); - - // Try to add the job title + + // Try to add the job title require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobTitles.php'; $jobTitles = new GlmDataJobTitles($this->wpdb, $this->config); $jID = $jobTitles->addJobTitles($jName); - + // If we got a job title id back if (is_int($jID) && $jID > 0) { - + // Update the job title selected for this job record $sql = " UPDATE ".GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX."jobs @@ -375,11 +375,11 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs WHERE id = ".$this->job_id." ;"; $insert = $this->wpdb->query($sql); - - + + // Update submitted job title value to use the new ID $_REQUEST['new_job_title'] = $jID; - + } } }