本文整理汇总了PHP中qa_db_user_profile_set函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_db_user_profile_set函数的具体用法?PHP qa_db_user_profile_set怎么用?PHP qa_db_user_profile_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_db_user_profile_set函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qa_lang_sub
$errors['avatar'] = qa_lang_sub('main/image_too_big_x_pc', (int) ($toobig * 100));
} elseif (!qa_set_user_avatar($userid, file_get_contents($_FILES['file']['tmp_name']), $useraccount['avatarblobid'])) {
$errors['avatar'] = qa_lang_sub('main/image_not_read', implode(', ', qa_gd_image_formats()));
}
break;
}
}
if (count($inprofile)) {
$filtermodules = qa_load_modules_with('filter', 'filter_profile');
foreach ($filtermodules as $filtermodule) {
$filtermodule->filter_profile($inprofile, $errors, $useraccount, $userprofile);
}
}
foreach ($userfields as $userfield) {
if (!isset($errors[$userfield['fieldid']])) {
qa_db_user_profile_set($userid, $userfield['title'], $inprofile[$userfield['fieldid']]);
}
}
list($useraccount, $userprofile) = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true), qa_db_user_profile_selectspec($userid, true));
qa_report_event('u_save', $userid, $useraccount['handle'], qa_cookie_get());
if (empty($errors)) {
qa_redirect('account', array('state' => 'profile-saved'));
}
qa_logged_in_user_flush();
}
}
// Process change password if clicked
if (qa_clicked('dochangepassword')) {
require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
$inoldpassword = qa_post_text('oldpassword');
$innewpassword1 = qa_post_text('newpassword1');
示例2: qa_log_in_external_user
function qa_log_in_external_user($source, $identifier, $fields)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
require_once QA_INCLUDE_DIR . 'db/users.php';
$users = qa_db_user_login_find($source, $identifier);
$countusers = count($users);
if ($countusers > 1) {
qa_fatal_error('External login mapped to more than one user');
}
// should never happen
if ($countusers) {
// user exists so log them in
qa_set_logged_in_user($users[0]['userid'], $users[0]['handle'], false, $source);
} else {
// create and log in user
require_once QA_INCLUDE_DIR . 'app/users-edit.php';
qa_db_user_login_sync(true);
$users = qa_db_user_login_find($source, $identifier);
// check again after table is locked
if (count($users) == 1) {
qa_db_user_login_sync(false);
qa_set_logged_in_user($users[0]['userid'], $users[0]['handle'], false, $source);
} else {
$handle = qa_handle_make_valid(@$fields['handle']);
if (strlen(@$fields['email'])) {
// remove email address if it will cause a duplicate
$emailusers = qa_db_user_find_by_email($fields['email']);
if (count($emailusers)) {
qa_redirect('login', array('e' => $fields['email'], 'ee' => '1'));
unset($fields['email']);
unset($fields['confirmed']);
}
}
$userid = qa_create_new_user((string) @$fields['email'], null, $handle, isset($fields['level']) ? $fields['level'] : QA_USER_LEVEL_BASIC, @$fields['confirmed']);
qa_db_user_login_add($userid, $source, $identifier);
qa_db_user_login_sync(false);
$profilefields = array('name', 'location', 'website', 'about');
foreach ($profilefields as $fieldname) {
if (strlen(@$fields[$fieldname])) {
qa_db_user_profile_set($userid, $fieldname, $fields[$fieldname]);
}
}
if (strlen(@$fields['avatar'])) {
qa_set_user_avatar($userid, $fields['avatar']);
}
qa_set_logged_in_user($userid, $handle, false, $source);
}
}
}
示例3: ra_upload_cover
function ra_upload_cover($name)
{
if (isset($_FILES[$name]['name']) && getimagesize($_FILES[$name]['tmp_name']) > 0 && $_FILES[$name]['size'] > 0 && $_FILES[$name]['size'] < 1048576) {
require_once DUDE_THEME_DIR . '/inc/class.Images.php';
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
if (!file_exists(QA_BASE_DIR . 'images/')) {
mkdir(QA_BASE_DIR . 'images/');
}
$uploaddir = QA_BASE_DIR . 'images/';
$ext = pathinfo($_FILES[$name]['name'], PATHINFO_EXTENSION);
$file_name = md5(time() . uniqid());
$temp_name = $file_name . '_temp';
$temp_name_with_ext = $file_name . '_temp' . $ext;
$file_name_with_ext = $file_name . '.' . $ext;
move_uploaded_file($_FILES[$name]['tmp_name'], $uploaddir . $temp_name_with_ext);
$image = new Image($uploaddir . $temp_name_with_ext);
$image->resize(621, 300, 'crop', 'c', 't', 99);
$image->save($file_name, $uploaddir);
$thumb = new Image($uploaddir . $temp_name_with_ext);
$thumb->resize(278, 120, 'crop', 'c', 't', 99);
$thumb->save($file_name . '_s', $uploaddir);
unlink($uploaddir . $temp_name_with_ext);
if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
$prev_file = get_user_meta(qa_get_logged_in_handle(), 'cover');
} else {
$prev_file = ra_user_profile(qa_get_logged_in_handle(), 'cover');
}
if (strlen($prev_file)) {
$delete = $uploaddir . $prev_file;
$prev_file_name = explode('.', $prev_file);
if (file_exists($delete)) {
unlink($delete);
}
if (file_exists($uploaddir . $prev_file_name[0] . '_s.' . $prev_file_name[1])) {
unlink($uploaddir . $prev_file_name[0] . '_s.' . $prev_file_name[1]);
}
}
if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
update_user_meta(qa_get_logged_in_userid(), 'cover', $file_name_with_ext);
} else {
qa_db_user_profile_set(qa_get_logged_in_userid(), 'cover', $file_name_with_ext);
}
} else {
global $ra_error;
if ($_FILES[$name]['size'] > 1048576) {
$ra_error = _ra_lang('Upload failed, image size is bigger then 1MB');
} else {
$ra_error = _ra_lang('An error occurred when uploading, please try again.');
}
}
}
示例4: qw_save_notification_settings
function qw_save_notification_settings($data, $userid)
{
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
$key = 'qw_notification_settings';
qa_db_user_profile_set($userid, $key, $data);
}
示例5: qa_lang_sub
if ($toobig) {
$errors['avatar'] = qa_lang_sub('main/image_too_big_x_pc', (int) ($toobig * 100));
} elseif (!qa_set_user_avatar($qa_login_userid, file_get_contents($_FILES['file']['tmp_name']), $useraccount['avatarblobid'])) {
$errors['avatar'] = qa_lang_sub('main/image_not_read', implode(', ', qa_gd_image_formats()));
}
break;
}
}
$infield = array();
foreach ($userfields as $userfield) {
$fieldname = 'field_' . $userfield['fieldid'];
$fieldvalue = qa_post_text($fieldname);
$infield[$fieldname] = $fieldvalue;
qa_profile_field_validate($fieldname, $fieldvalue, $errors);
if (!isset($errors[$fieldname])) {
qa_db_user_profile_set($qa_login_userid, $userfield['title'], $fieldvalue);
}
}
list($useraccount, $userprofile) = qa_db_select_with_pending(qa_db_user_account_selectspec($qa_login_userid, true), qa_db_user_profile_selectspec($qa_login_userid, true));
qa_report_event('u_save', $qa_login_userid, $useraccount['handle'], $qa_cookieid);
if (empty($errors)) {
qa_redirect('account', array('state' => 'profile-saved'));
}
qa_logged_in_user_flush();
}
// Process change password if clicked
if (qa_clicked('dochangepassword')) {
require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
$inoldpassword = qa_post_text('oldpassword');
$innewpassword1 = qa_post_text('newpassword1');
$innewpassword2 = qa_post_text('newpassword2');
示例6: qa_log_in_external_user
function qa_log_in_external_user($source, $identifier, $fields)
{
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
$users = qa_db_user_login_find($source, $identifier);
$countusers = count($users);
if ($countusers > 1) {
qa_fatal_error('External login mapped to more than one user');
}
// should never happen
if ($countusers) {
// user exists so log them in
qa_set_logged_in_user($users[0]['userid'], $users[0]['handle'], false, $source);
} else {
// create and log in user
require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
$handle = qa_handle_make_valid(@$fields['handle']);
$userid = qa_create_new_user((string) @$fields['email'], null, $handle, isset($fields['level']) ? $fields['level'] : QA_USER_LEVEL_BASIC, @$fields['confirmed']);
qa_db_user_login_add($userid, $source, $identifier);
$profilefields = array('name', 'location', 'website', 'about');
foreach ($profilefields as $fieldname) {
if (strlen(@$fields[$fieldname])) {
qa_db_user_profile_set($userid, $fieldname, $fields[$fieldname]);
}
}
if (strlen(@$fields['avatar'])) {
qa_set_user_avatar($userid, $fields['avatar']);
}
qa_set_logged_in_user($userid, $handle, false, $source);
}
}
示例7: qa_log_in_external_user
/**
* Overrides the default mechanism of logging in from external sources.
*
* Adds a different way of tracking the sessions and performs some
* additional tasks when creating an user account (setting new fields,
* extra checks, etc).
*/
function qa_log_in_external_user($source, $identifier, $fields)
{
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
$remember = qa_opt('open_login_remember') ? true : false;
$users = qa_db_user_login_find($source, $identifier);
$countusers = count($users);
if ($countusers > 1) {
qa_fatal_error('External login mapped to more than one user');
}
// should never happen
/*
* To allow for more than one account from the same openid/openauth provider to be
* linked to an Q2A user, we need to override the way session source is stored
* Supposing userid 01 is linked to 2 yahoo accounts, the session source will be
* something like 'yahoo-xyz' when logging in with the first yahoo account and
* 'yahoo-xyt' when logging in with the other.
*/
$aggsource = qa_open_login_get_new_source($source, $identifier);
// prepare some data
if (empty($fields['handle'])) {
$ohandle = ucfirst($source);
} else {
$ohandle = preg_replace('/[\\@\\+\\/]/', ' ', $fields['handle']);
}
$oemail = null;
if (strlen(@$fields['email']) && $fields['confirmed']) {
// only if email is confirmed
$oemail = $fields['email'];
}
if ($countusers) {
// user exists so log them in
//always update email and handle
if ($oemail) {
qa_db_user_login_set__open($source, $identifier, 'oemail', $oemail);
}
qa_db_user_login_set__open($source, $identifier, 'ohandle', $ohandle);
qa_set_logged_in_user($users[0]['userid'], $users[0]['handle'], $remember, $aggsource);
} else {
// create and log in user
require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
qa_db_user_login_sync(true);
$users = qa_db_user_login_find($source, $identifier);
// check again after table is locked
if (count($users) == 1) {
//always update email and handle
if ($oemail) {
qa_db_user_login_set__open($source, $identifier, 'oemail', $oemail);
}
qa_db_user_login_set__open($source, $identifier, 'ohandle', $ohandle);
qa_db_user_login_sync(false);
qa_set_logged_in_user($users[0]['userid'], $users[0]['handle'], $remember, $aggsource);
} else {
$handle = qa_handle_make_valid(@$fields['handle']);
// check if email address already exists
$emailusers = array();
if (strlen(@$fields['email']) && $fields['confirmed']) {
// only if email is confirmed
$emailusers = qa_db_user_find_by_email_or_oemail__open($fields['email']);
if (count($emailusers)) {
// unset regular email to prevent duplicates
unset($fields['email']);
}
}
$userid = qa_create_new_user((string) @$fields['email'], null, $handle, isset($fields['level']) ? $fields['level'] : QA_USER_LEVEL_BASIC, @$fields['confirmed']);
qa_db_user_set($userid, 'oemail', $oemail);
qa_db_user_login_add($userid, $source, $identifier);
qa_db_user_login_set__open($source, $identifier, 'oemail', $oemail);
qa_db_user_login_set__open($source, $identifier, 'ohandle', $ohandle);
qa_db_user_login_sync(false);
$profilefields = array('name', 'location', 'website', 'about');
foreach ($profilefields as $fieldname) {
if (strlen(@$fields[$fieldname])) {
qa_db_user_profile_set($userid, $fieldname, $fields[$fieldname]);
}
}
if (strlen(@$fields['avatar'])) {
qa_set_user_avatar($userid, $fields['avatar']);
}
qa_set_logged_in_user($userid, $handle, $remember, $aggsource);
return count($emailusers);
}
}
return 0;
}