public function updateStaff() { $form = new AB_StaffMemberEditForm(); $form->bind($this->getPostParameters(), $_FILES); $result = $form->save(); $this->active_staff_id = 1; if ($result === false) { } else { $_SESSION['was_update'] = true; } }
/** * Update staff from POST request. * @see AB_Backend.php */ public function updateStaff() { if (!AB_Utils::isCurrentUserAdmin()) { // Check permissions to prevent one staff member from updating profile of another staff member. do { if (get_option('ab_settings_allow_staff_members_edit_profile')) { $staff = new AB_Staff(); $staff->load($this->getParameter('id')); if ($staff->get('wp_user_id') == get_current_user_id()) { unset($_POST['wp_user_id']); break; } } do_action('admin_page_access_denied'); wp_die(__('Bookly: You do not have sufficient permissions to access this page.', 'bookly')); } while (0); } $form = new AB_StaffMemberEditForm(); $form->bind($this->getPostParameters(), $_FILES); $result = $form->save(); // Set staff id to load the form for. $this->active_staff_id = $this->getParameter('id'); if ($result === false && array_key_exists('google_calendar', $form->getErrors())) { $errors = $form->getErrors(); $_SESSION['google_calendar_error'] = $errors['google_calendar']; } else { $_SESSION['bookly_updated'] = true; } }