本文整理匯總了PHP中BuckysUser::saveUserBasicInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP BuckysUser::saveUserBasicInfo方法的具體用法?PHP BuckysUser::saveUserBasicInfo怎麽用?PHP BuckysUser::saveUserBasicInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BuckysUser
的用法示例。
在下文中一共展示了BuckysUser::saveUserBasicInfo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: saveBasicInfoAction
public function saveBasicInfoAction()
{
$data = $_POST;
$token = isset($data['TOKEN']) ? trim($data['TOKEN']) : null;
if (!$token) {
return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')];
}
if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) {
return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')];
}
$userData = BuckysUser::getUserData($userID);
if ($data['birthdate_year'] == '-') {
$data['birthdate_year'] = '';
}
if ($data['birthdate_month'] == '-') {
$data['birthdate_month'] = '';
}
if ($data['birthdate_day'] == '-') {
$data['birthdate_day'] = '';
}
switch ($data['relationship_status']) {
case 'Single':
$data['relationship_status'] = 1;
break;
case 'In a Relationship':
$data['relationship_status'] = 2;
break;
case '-':
default:
$data['relationship_status'] = 0;
break;
}
$data['timezone'] = $userData['timezone'];
if (BuckysUser::saveUserBasicInfo($userID, $data)) {
return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ['STATUS' => 'SUCCESS']];
} else {
return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('There was an error to saving your information.')];
}
exit;
}
示例2: buckys_redirect
$userData = BuckysUser::getUserBasicInfo($userID);
//Goto Homepage if the userID is not correct
if (!buckys_not_null($userData)) {
buckys_redirect('/index.php');
}
if (isset($_POST['action']) && $_POST['action'] == 'save_basic_info') {
//Check the user id is same with the current logged user id
if ($_POST['userID'] != $userID) {
echo 'Invalid Request!';
exit;
}
//Check first name and last name
if (trim($_POST['firstName']) == '' || trim($_POST['lastName']) == '') {
echo MSG_USERNAME_EMPTY_ERROR;
exit;
}
if (BuckysUser::saveUserBasicInfo($userID, $_POST)) {
echo 'Success';
exit;
} else {
echo $db->last_query;
echo $db->getLastError();
exit;
}
}
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('info.css');
buckys_enqueue_javascript('info.js');
$TNB_GLOBALS['content'] = 'info_basic';
$TNB_GLOBALS['title'] = "Basic Info - " . TNB_SITE_NAME;
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";