private function init_job() { $this->job = false; $this->translator_has_job_language_pairs = false; $this->user_can_take_this_job = false; $this->job_id = WPML_Translation_Editor::get_job_id_from_request(); if ($this->job_id) { WPML_Translation_Job_Terms::set_translated_term_values($this->job_id); $this->job = $this->sitepressTM->get_translation_job($this->job_id, false, true, 1); if ($this->job) { $this->user_can_take_this_job = $this->job->translator_id == 0 || $this->job->translator_id == $this->current_user->ID; $this->job_language_pairs = array('lang_from' => $this->job->source_language_code, 'lang_to' => $this->job->language_code); $this->translator_has_job_language_pairs = $this->sitepressTM->is_translator($this->current_user->ID, $this->job_language_pairs); } } $this->is_valid_job = !$this->job || (!$this->user_can_take_this_job || !$this->translator_has_job_language_pairs) && !current_user_can('manage_options'); }