本文整理汇总了PHP中SJB_UserManager::saveUserPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_UserManager::saveUserPassword方法的具体用法?PHP SJB_UserManager::saveUserPassword怎么用?PHP SJB_UserManager::saveUserPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_UserManager
的用法示例。
在下文中一共展示了SJB_UserManager::saveUserPassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
//.........这里部分代码省略.........
foreach ($imported_data as $key => $importedColumn) {
if ($key == 1) {
$imported_user_processor = new SJB_ImportedUserProcessor($importedColumn, $user);
continue;
}
if (!$importedColumn) {
continue;
}
$userInfo = $imported_user_processor->getData($importedColumn);
$extUserID = isset($userInfo['extUserID']) ? $userInfo['extUserID'] : '';
$user = $this->CreateUser(array(), $user_group_id);
$user->addExtUserIDProperty();
$doc = new DOMDocument();
foreach ($user->getProperties() as $property) {
if ($property->id == 'active') {
$property->type->property_info['value'] = $property->value;
} elseif ($property->getType() == 'location') {
$locationFields = array($property->id . '.Country', $property->id . '.State', $property->id . '.City', $property->id . '.ZipCode', $property->id . '.Address');
$locationFieldAdded = array();
foreach ($locationFields as $locationField) {
if (array_key_exists($locationField, $userInfo)) {
switch ($locationField) {
case $property->id . '.Country':
$value = SJB_CountriesManager::getCountrySIDByCountryName($userInfo[$locationField]);
if (!$value) {
$value = SJB_CountriesManager::getCountrySIDByCountryCode($userInfo[$locationField]);
}
break;
case $property->id . '.State':
$value = SJB_StatesManager::getStateSIDByStateName($userInfo[$locationField]);
if (!$value) {
$value = SJB_StatesManager::getStateSIDByStateCode($userInfo[$locationField]);
}
break;
default:
$value = $userInfo[$locationField];
break;
}
unset($userInfo[$locationField]);
$userInfo[$property->id][str_replace($property->id . '.', '', $locationField)] = $value;
$locationFieldAdded[] = str_replace($property->id . '.', '', $locationField);
}
}
if ($property->id == 'Location') {
$locationFields = array('Country', 'State', 'City', 'ZipCode', 'Address');
foreach ($locationFields as $locationField) {
if (array_key_exists($locationField, $userInfo) && !in_array($locationField, $locationFieldAdded) && !$user->getProperty($locationField)) {
switch ($locationField) {
case 'Country':
$value = SJB_CountriesManager::getCountrySIDByCountryName($userInfo[$locationField]);
if (!$value) {
$value = SJB_CountriesManager::getCountrySIDByCountryCode($userInfo[$locationField]);
}
break;
case 'State':
$value = SJB_StatesManager::getStateSIDByStateName($userInfo[$locationField]);
if (!$value) {
$value = SJB_StatesManager::getStateSIDByStateCode($userInfo[$locationField]);
}
break;
default:
$value = $userInfo[$locationField];
break;
}
$userInfo[$property->id][$locationField] = $value;
unset($userInfo[$locationField]);
}
}
}
}
}
$user = $this->CreateUser($userInfo, $user_group_id);
$user->addExtUserIDProperty($extUserID);
$username = SJB_Array::get($userInfo, 'username');
if (empty($username)) {
$errors[] = 'Empty username is not allowed, record ignored.';
} elseif (!is_null(SJB_UserManager::getUserSIDbyUsername($username))) {
$errors[] = '\'' . $userInfo['username'] . '\' - this user name already exists, record ignored.';
} else {
$originalMd5Password = $user->getPropertyValue('password');
SJB_UserManager::saveUser($user);
$this->extraProperties($user, $userInfo, $usersID);
if (!empty($originalMd5Password)) {
SJB_UserManager::saveUserPassword($user->getSID(), $originalMd5Password);
}
$isApproveByAdmin = SJB_UserGroupManager::isApproveByAdmin($user_group_sid);
if ($isApproveByAdmin) {
SJB_UserManager::setApprovalStatusByUserName($user->getUserName(), 'Pending');
}
$count++;
}
}
if ($import_file_url) {
SJB_Filesystem::delete(SJB_System::getSystemSettings("IMPORT_FILES_DIRECTORY"));
}
$template_processor->assign('imported_users_count', $count);
$template_processor->assign('errors', $errors);
$template_processor->display('import_users_result.tpl');
}
}