本文整理汇总了PHP中SJB_UserManager::getUserInfoByUserName方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_UserManager::getUserInfoByUserName方法的具体用法?PHP SJB_UserManager::getUserInfoByUserName怎么用?PHP SJB_UserManager::getUserInfoByUserName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_UserManager
的用法示例。
在下文中一共展示了SJB_UserManager::getUserInfoByUserName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public static function login($request)
{
$blogPath = SJB_Settings::getSettingByName('blog_path');
if (empty($blogPath)) {
return;
}
$username = $request['username'];
$password = $request['password'];
$userInfo = SJB_UserManager::getUserInfoByUserName($username);
$userInfo = $userInfo ? base64_encode(serialize($userInfo)) : false;
$url = SJB_System::getSystemSettings('SITE_URL') . $blogPath . '/wp-login.php';
$client = new Zend_Http_Client($url, array('useragent' => SJB_Request::getUserAgent(), 'maxredirects' => 0));
$client->setCookieJar();
$client->setCookie($_COOKIE);
$client->setMethod(Zend_Http_Client::POST);
$client->setParameterPost(array('log' => $username, 'pwd' => $password, 'noSJB' => 1, 'userInfo' => $userInfo, 'wp-submit' => 'Log in'));
try {
$response = $client->request();
foreach ($response->getHeaders() as $key => $header) {
if ('set-cookie' == strtolower($key)) {
if (is_array($header)) {
foreach ($header as $val) {
header("Set-Cookie: " . $val, false);
}
} else {
header("Set-Cookie: " . $header, false);
}
}
}
$_SESSION['wp_cookie_jar'] = @serialize($client->getCookieJar());
} catch (Exception $ex) {
}
}
示例2: execute
public function execute()
{
$template_processor = SJB_System::getTemplateProcessor();
$username = SJB_Request::getVar('username', null);
$verification_key = SJB_Request::getVar('verification_key', null);
$ERRORS = array();
$password_was_changed = false;
$user_info = SJB_UserManager::getUserInfoByUserName($username);
if (empty($user_info)) {
$ERRORS['EMPTY_USERNAME'] = 1;
} elseif (empty($verification_key)) {
$ERRORS['EMPTY_VERIFICATION_KEY'] = 1;
} elseif ($user_info['verification_key'] != $verification_key) {
$ERRORS['WRONG_VERIFICATION_KEY'] = 1;
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (!empty($_REQUEST['password']) && $_REQUEST['password'] == $_REQUEST['confirm_password']) {
$password_was_changed = SJB_UserManager::changeUserPassword($user_info['sid'], $_REQUEST['password']);
} else {
$ERRORS['PASSWORD_NOT_CONFIRMED'] = 1;
}
}
if ($password_was_changed) {
$template_processor->display('successful_password_change.tpl');
} else {
$template_processor->assign('username', $username);
$template_processor->assign('verification_key', $verification_key);
$template_processor->assign('errors', $ERRORS);
$template_processor->display('change_password.tpl');
}
}
示例3: updateCurrentUserSession
public static function updateCurrentUserSession()
{
if (SJB_Authorization::isUserLoggedIn()) {
$subuser = array();
$sessionCurrentUser = SJB_Session::getValue('current_user');
if (isset($sessionCurrentUser['subuser'])) {
$subuser = $sessionCurrentUser['subuser'];
}
$currentUserInfo = SJB_UserManager::getUserInfoByUserName($sessionCurrentUser['username']);
if (!empty($subuser)) {
$currentUserInfo['subuser'] = $subuser;
}
SJB_Session::setValue('current_user', $currentUserInfo);
}
}
示例4: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$errors = array();
$activated = SJB_Request::getVar('account_activated', '') == 'yes';
if (SJB_Request::getVar('returnToShoppingCart', false)) {
SJB_Session::setValue('fromAnonymousShoppingCart', 1);
}
if (!$activated) {
if (!isset($_REQUEST['username'], $_REQUEST['activation_key'])) {
$errors['PARAMETERS_MISSED'] = 1;
} elseif (!($userInfo = SJB_UserManager::getUserInfoByUserName($_REQUEST['username']))) {
$errors['USER_NOT_FOUND'] = 1;
} elseif ($userInfo['activation_key'] != $_REQUEST['activation_key']) {
$errors['INVALID_ACTIVATION_KEY'] = true;
} elseif ($userInfo['approval'] == 'Rejected') {
SJB_UserDBManager::deleteActivationKeyByUsername($_REQUEST['username']);
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/system/users/activate_account/?account_activated=no&approval_status=Rejected');
} else {
if (SJB_UserManager::activateUserByUserName($_REQUEST['username'])) {
SJB_UserDBManager::deleteActivationKeyByUsername($_REQUEST['username']);
if (!SJB_Authorization::isUserLoggedIn()) {
SJB_Authorization::login($_REQUEST['username'], false, false, $errors, true, true);
if (!SJB_SocialPlugin::getProfileSocialID($userInfo['sid'])) {
SJB_Notifications::sendUserWelcomeLetter($userInfo['sid']);
}
$requireApprove = SJB_UserGroupManager::isApproveByAdmin($userInfo['user_group_sid']);
if ($requireApprove && !empty($userInfo['approval'])) {
$approvalStatus = $userInfo['approval'];
} else {
$userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($userInfo['user_group_sid']);
$pageId = !empty($userGroupInfo['after_registration_redirect_to']) ? $userGroupInfo['after_registration_redirect_to'] : '';
$redirectUrl = SJB_UserGroupManager::getRedirectUrlByPageID($pageId);
SJB_HelperFunctions::redirect($redirectUrl . 'account_activated=yes');
}
}
$activated = 1;
} else {
$errors['CANNOT_ACTIVATE'] = TRUE;
}
}
}
$tp->assign('activated', $activated);
$tp->assign('errors', $errors);
$tp->assign('approvalStatus', !empty($approvalStatus) ? $approvalStatus : SJB_Request::getVar('approval_status', ''));
$tp->assign('isLoggedIn', SJB_Authorization::isUserLoggedIn());
$tp->display('activate_account.tpl');
}
示例5: execute
public function execute()
{
$username = SJB_Request::getVar('username', '');
$password = SJB_Request::getVar('password', '');
$user_exists_by_username = SJB_DB::queryValue('SELECT count(*) FROM `users` WHERE `username` = ?s', $username);
if ($user_exists_by_username) {
$user_exists_by_password = SJB_DB::queryValue('SELECT count(*) FROM `users` WHERE `username` = ?s AND `password` = ?s', $username, $password);
if ($user_exists_by_password) {
$user_info = SJB_UserManager::getUserInfoByUserName($username);
if (!$user_info['active']) {
echo '<br>' . $username . '<br><br><font color="red">Your account is not active</font>';
}
} else {
echo '<br><font color="red">Incorrect username or/and password</font>';
}
} else {
echo '<br><font color="red">Incorrect username or/and password</font>';
}
exit;
}
示例6: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$errors = array();
$info = '';
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
$to = SJB_Request::getVar('to');
// POST and check for errors form_to form_subject form_message
if (isset($_POST['form_to'])) {
$to_user_name = SJB_Request::getVar('form_to', null, 'POST');
$to_user_info = null;
// trying to get user info by user id
if (intval($to_user_name)) {
$to_user_info = SJB_UserManager::getUserInfoBySID($to_user_name);
}
/*
* в функции compose private message функцию отправки
* сообщения по имени пользователя оставить рабочей
*/
if (is_null($to_user_info)) {
$to_user_info = SJB_UserManager::getUserInfoByUserName($to_user_name);
}
// trying to get user info by user id
if (intval($to_user_name)) {
$to_user_info = SJB_UserManager::getUserInfoBySID($to_user_name);
}
/*
* в функции compose private message функцию отправки
* сообщения по имени пользователя оставить рабочей
*/
if (is_null($to_user_info)) {
$to_user_info = SJB_UserManager::getUserInfoByUserName($to_user_name);
}
$to_user = isset($to_user_info['sid']) ? $to_user_info['sid'] : 0;
$subject = isset($_POST['form_subject']) ? strip_tags($_POST['form_subject']) : '';
$message = isset($_POST['form_message']) ? SJB_PrivateMessage::cleanText($_POST['form_message']) : '';
$save = isset($_POST['form_save']) ? true : false;
if ($to_user == 0) {
$errors['form_to'] = 'You specified wrong username';
}
if (empty($subject)) {
$errors['form_subject'] = 'Please, enter message subject';
}
if (empty($message)) {
$errors['form_message'] = 'Please, enter message';
}
if (count($errors) == 0) {
$anonym = SJB_Request::getVar('anonym');
SJB_PrivateMessage::sendMessage($user_id, $to_user, $subject, $message, $save, false, false, $anonym);
$info = 'The message was sent successfully';
$to = '';
// save to contacts
if (!$anonym) {
SJB_PrivateMessage::saveContact($user_id, $to_user);
SJB_PrivateMessage::saveContact($to_user, $user_id);
}
} else {
$tp->assign("form_to", htmlentities($to_user_name, ENT_QUOTES, "UTF-8"));
$tp->assign("form_subject", htmlentities($subject, ENT_QUOTES, "UTF-8"));
$tp->assign("form_message", $message);
$tp->assign("form_save", $save);
$tp->assign("errors", $errors);
}
}
$display_to = '';
// get display name for "Message to" field
SJB_UserManager::getComposeDisplayName($to, $display_to);
$tp->assign('info', $info);
$tp->assign('to', $to);
$tp->assign('anonym', SJB_Request::getVar('anonym'));
$tp->assign('display_to', $display_to);
$tp->assign('include', 'new_message.tpl');
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
$tp->display('main.tpl');
} else {
$tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
$tp->assign('ajaxRelocate', true);
$tp->display('../users/login.tpl');
}
}
示例7: CreateListing
private function CreateListing($listing_info, $listing_type_id)
{
$listing_type_sid = SJB_ListingTypeManager::getListingTypeSIDByID($listing_type_id);
$listing = new SJB_Listing($listing_info, $listing_type_sid);
$userInfo = array();
if (!empty($listing_info['extUserID'])) {
$userInfo = SJB_UserManager::getUserInfoByExtUserID($listing_info['extUserID'], $listing_type_id);
if ($userInfo) {
$listing->setUserSID($userInfo['sid']);
}
}
if (!$userInfo && !empty($listing_info['username'])) {
$userInfo = SJB_UserManager::getUserInfoByUserName($listing_info['username']);
$listing->setUserSID($userInfo['sid']);
}
return $listing;
}
示例8: getComposeDisplayName
/**
* define displayName ("Message to" field ) for Private Messages
* @param string|integer $to
* @param string $displayName
* @return string or null
*/
public static function getComposeDisplayName($to, &$displayName)
{
if (empty($to)) {
return null;
}
// by user's id
$oReceiverInfo = SJB_UserManager::getUserInfoBySID((int) $to);
// by username
if (is_null($oReceiverInfo)) {
$oReceiverInfo = SJB_UserManager::getUserInfoByUserName($to);
}
// Message to: отображать там если есть то CompanyName
// если нет, то FirstName LastName
// если нет и того ни другого, то можно написать username
if (!empty($oReceiverInfo['CompanyName'])) {
$displayName = $oReceiverInfo['CompanyName'];
} elseif (!empty($oReceiverInfo['FirstName'])) {
$displayName = $oReceiverInfo['FirstName'] . (!empty($oReceiverInfo['LastName']) ? ' ' . $oReceiverInfo['LastName'] : '');
} elseif (!empty($oReceiverInfo['username'])) {
$displayName = $oReceiverInfo['username'];
}
}
示例9: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
$errors = array();
$info = '';
$to = SJB_Request::getVar('to', '', 'GET');
// POST and check for errors form_to form_subject form_message
if (isset($_POST['act'])) {
$to_user_name = SJB_Request::getVar('form_to', '', 'POST');
$to_user_info = null;
if (intval($to_user_name)) {
$to_user_info = SJB_UserManager::getUserInfoBySID($to_user_name);
}
// в функции compose private message функцию отправки
// сообщения по имени пользователя оставить рабочей
if (is_null($to_user_info)) {
$to_user_info = SJB_UserManager::getUserInfoByUserName($to_user_name);
}
$cc = SJB_Request::getVar('cc', false);
if ($cc !== false) {
if (intval($cc)) {
$cc_info = SJB_UserManager::getUserInfoBySID($cc);
}
// в функции compose private message функцию отправки
// сообщения по имени пользователя оставить рабочей
if (is_null($cc_info)) {
$cc_info = SJB_UserManager::getUserInfoByUserName($cc);
}
if (!empty($cc_info)) {
$cc = $cc_info['sid'];
}
}
$to_user = isset($to_user_info['sid']) ? $to_user_info['sid'] : 0;
$subject = isset($_POST['form_subject']) ? strip_tags($_POST['form_subject']) : '';
$message = isset($_POST['form_message']) ? SJB_PrivateMessage::cleanText($_POST['form_message']) : '';
$save = isset($_POST['form_save']) ? $_POST['form_save'] == 1 ? true : false : false;
if ($to_user == 0) {
$errors['form_to'] = 'Please enter correct username';
}
if (empty($subject)) {
$errors['form_subject'] = 'Please, enter message subject';
}
if (empty($message)) {
$errors['form_message'] = 'Please, enter message';
}
if (count($errors) == 0) {
$anonym = SJB_Request::getVar('anonym');
SJB_PrivateMessage::sendMessage($user_id, $to_user, $subject, $message, $save, false, $cc, $anonym);
// save to contacts
if (!$anonym) {
SJB_PrivateMessage::saveContact($user_id, $to_user);
SJB_PrivateMessage::saveContact($to_user, $user_id);
}
echo '<p class="message">' . SJB_I18N::getInstance()->gettext(null, 'The message was sent successfully') . '</p>';
exit;
}
}
$display_to = '';
// get display name for 'Message to' field
SJB_UserManager::getComposeDisplayName($to, $display_to);
$tp->assign('errors', $errors);
$tp->assign('info', $info);
$tp->assign('to', $to);
$tp->assign('display_to', $display_to);
$tp->assign('anonym', SJB_Request::getVar('anonym'));
$tp->assign('cc', SJB_Request::getVar('cc', ''));
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
$tp->display('new_message_ajax.tpl');
} else {
$tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
$tp->assign('ajaxRelocate', true);
$tp->display('../users/login.tpl');
}
}
示例10: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$template = SJB_Request::getVar('template', 'users.tpl');
$searchTemplate = SJB_Request::getVar('search_template', 'user_search_form.tpl');
$passedParametersViaUri = SJB_UrlParamProvider::getParams();
$userGroupID = $passedParametersViaUri ? array_shift($passedParametersViaUri) : false;
$userGroupSID = $userGroupID ? SJB_UserGroupManager::getUserGroupSIDByID($userGroupID) : null;
$errors = array();
/********** A C T I O N S W I T H U S E R S **********/
$action = SJB_Request::getVar('action_name');
if (!empty($action)) {
$users_sids = SJB_Request::getVar('users', array());
$_REQUEST['restore'] = 1;
switch ($action) {
case 'approve':
foreach ($users_sids as $user_sid => $value) {
$username = SJB_UserManager::getUserNameByUserSID($user_sid);
SJB_UserManager::setApprovalStatusByUserName($username, 'Approved');
SJB_UserManager::activateUserByUserName($username);
SJB_UserDBManager::deleteActivationKeyByUsername($username);
if (!SJB_SocialPlugin::getProfileSocialID($user_sid)) {
SJB_Notifications::sendUserWelcomeLetter($user_sid);
} else {
SJB_Notifications::sendUserApprovedLetter($user_sid);
}
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
break;
case 'reject':
$rejection_reason = SJB_Request::getVar('rejection_reason', '');
foreach ($users_sids as $user_sid => $value) {
$username = SJB_UserManager::getUserNameByUserSID($user_sid);
SJB_UserManager::setApprovalStatusByUserName($username, 'Rejected', $rejection_reason);
SJB_UserManager::deactivateUserByUserName($username);
SJB_Notifications::sendUserRejectedLetter($user_sid);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
break;
case 'activate':
foreach ($users_sids as $user_sid => $value) {
$username = SJB_UserManager::getUserNameByUserSID($user_sid);
$userinfo = SJB_UserManager::getUserInfoByUserName($username);
SJB_UserManager::activateUserByUserName($username);
if ($userinfo['approval'] == 'Approved') {
SJB_UserDBManager::deleteActivationKeyByUsername($username);
SJB_Notifications::sendUserApprovedLetter($user_sid);
}
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
break;
case 'deactivate':
foreach ($users_sids as $user_sid => $value) {
$username = SJB_UserManager::getUserNameByUserSID($user_sid);
SJB_UserManager::deactivateUserByUserName($username);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
break;
case 'delete':
foreach (array_keys($users_sids) as $user_sid) {
try {
SJB_UserManager::deleteUserById($user_sid);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
break;
case 'send_activation_letter':
foreach ($users_sids as $user_sid => $value) {
SJB_Notifications::sendUserActivationLetter($user_sid);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
break;
case 'change_product':
$productToChange = SJB_Request::getVar('product_to_change');
if (empty($productToChange)) {
$productToChange = 0;
}
foreach ($users_sids as $user_sid => $value) {
$user = SJB_UserManager::getObjectBySID($user_sid);
// UNSUBSCRIBE selected
if ($productToChange == 0) {
SJB_ContractManager::deleteAllContractsByUserSID($user_sid);
} else {
$productInfo = SJB_ProductsManager::getProductInfoBySID($productToChange);
$listingNumber = SJB_Request::getVar('number_of_listings', null);
if (is_null($listingNumber) && !empty($productInfo['number_of_listings'])) {
$listingNumber = $productInfo['number_of_listings'];
}
$contract = new SJB_Contract(array('product_sid' => $productToChange, 'numberOfListings' => $listingNumber, 'is_recurring' => 0));
$contract->setUserSID($user_sid);
$contract->saveInDB();
if ($contract->isFeaturedProfile()) {
SJB_UserManager::makeFeaturedBySID($user_sid);
}
}
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
break;
//.........这里部分代码省略.........
示例11: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
$id = SJB_Request::getInt('id', 0, 'GET');
if ($id > 0) {
$errors = array();
if (isset($_POST['form_to'])) {
$to_user_name = isset($_POST['form_to']) ? strip_tags($_POST['form_to']) : '';
$to_user_info = SJB_UserManager::getUserInfoByUserName($to_user_name);
$to_user = isset($to_user_info['sid']) ? $to_user_info['sid'] : 0;
$subject = isset($_POST['form_subject']) ? strip_tags($_POST['form_subject']) : '';
$text = isset($_POST['form_message']) ? SJB_PrivateMessage::cleanText($_POST['form_message']) : '';
$save = isset($_POST['form_save']) ? true : false;
$reply_id = isset($_POST['reply_id']) ? $_POST['reply_id'] : false;
if ($to_user == 0) {
$errors['form_to'] = 'You specified wrong username';
}
if (empty($subject)) {
$errors['form_subject'] = 'Please, enter message subject';
}
if (empty($text)) {
$errors['form_message'] = 'Please, enter message';
}
if (count($errors) == 0) {
$anonym = SJB_Request::getVar('anonym');
SJB_PrivateMessage::sendMessage($user_id, $to_user, $subject, $text, $save, $reply_id, false, $anonym);
// save to contacts
if (!$anonym) {
SJB_PrivateMessage::saveContact($user_id, $to_user);
SJB_PrivateMessage::saveContact($to_user, $user_id);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
} else {
$message['to_name'] = htmlentities($to_user_name, ENT_QUOTES, "UTF-8");
$message['subject'] = htmlentities($subject, ENT_QUOTES, "UTF-8");
$message['message'] = $text;
$tp->assign('save', $save);
}
} else {
if (SJB_PrivateMessage::isMyMessage($id)) {
$message = SJB_PrivateMessage::readMessage($id);
} else {
$errors['NOT_EXISTS_MESSAGE'] = 1;
$message = '';
}
if ($message) {
$message['to_name'] = htmlentities($message['from_name'], ENT_QUOTES, "UTF-8");
$message['subject'] = 'RE: ' . htmlentities($message['subject'], ENT_QUOTES, "UTF-8");
$message['message'] = '<p> </p><blockquote class="pmQuote">' . $message['message'] . '</blockquote>';
}
$tp->assign('reply_id', $id);
}
}
$tp->assign('errors', $errors);
$tp->assign('include', 'reply_message.tpl');
$tp->assign('message', $message);
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
$tp->display('main.tpl');
} else {
$tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
$tp->display('../users/login.tpl');
}
}