/** * Check if the IDs of all possible owners match on the quizzes * and person creating/who created the AB Test * @param $ab_test_owner_id (int/string) ID of the person creating/who created the ab_test * @param $quiz_id_a (int/string) ID of Quiz A * @param $quiz_id_b (int/string) ID of Quiz B * @return $valid (BOOLEAN) true if OK, false if fails */ protected function validate_ab_test_owner($ab_test_owner_id, $quiz_id_a, $quiz_id_b) { $valid = false; $quiz_a = new Enp_quiz_Quiz($quiz_id_a); $quiz_b = new Enp_quiz_Quiz($quiz_id_b); $quiz_a_owner = $quiz_a->get_quiz_owner(); $quiz_b_owner = $quiz_b->get_quiz_owner(); if ((int) $quiz_a_owner === (int) $quiz_b_owner && (int) $quiz_a_owner === (int) $ab_test_owner_id) { $valid = true; } else { $this->add_error('You are not the owner of one or more of the quizzes.'); } return $valid; }