本文整理汇总了PHP中SJB_UserManager::deactivateUserByUserName方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_UserManager::deactivateUserByUserName方法的具体用法?PHP SJB_UserManager::deactivateUserByUserName怎么用?PHP SJB_UserManager::deactivateUserByUserName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_UserManager
的用法示例。
在下文中一共展示了SJB_UserManager::deactivateUserByUserName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
//.........这里部分代码省略.........