add_session(ERROR_TOKEN_EXPIRED_PLEASE_RESUBMIT, 'error'); zen_redirect(zen_href_link(FILENAME_ADMIN_ACCOUNT)); } // act upon any specific action specified switch ($action) { case 'edit': // display populated form for editing existing user $formAction = 'update'; $profilesList = array_merge(array(array('id'=>0,'text'=>'Choose Profile')), zen_get_profiles()); break; case 'password': // display unpopulated form for resetting existing user's password $formAction = 'reset'; break; case 'update': // update existing user's details in database. Post data is prep'd for db in the first function call $errors = zen_update_user(FALSE, $_POST['email'], $_POST['id'], $_POST['profile']); if (sizeof($errors) > 0) { foreach ($errors as $error) { $messageStack->add($error, 'error'); } $action = 'edit'; $formAction = 'update'; $profilesList = array_merge(array(array('id'=>0,'text'=>'Choose Profile')), zen_get_profiles()); } else { $action = ''; $messageStack->add(SUCCESS_USER_DETAILS_UPDATED, 'success'); } break; case 'reset': // reset existing user's password in database. Post data is prep'd for db in the first function call $errors = zen_reset_password($_POST['user'], $_POST['password'], $_POST['confirm']); if (sizeof($errors) > 0) { foreach ($errors as $error) { $messageStack->add($error, 'error'); } $action = 'password'; $formAction = 'reset'; } else { $action = ''; $messageStack->add(SUCCESS_PASSWORD_UPDATED, 'success'); } break; default: // no action, simply drop through and display existing users } // get this user's details $userList = zen_get_users($_SESSION['admin_id']); $userDetails = $userList[0]; ?> >