本文整理汇总了PHP中PMF_Category::moveOwnership方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Category::moveOwnership方法的具体用法?PHP PMF_Category::moveOwnership怎么用?PHP PMF_Category::moveOwnership使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Category
的用法示例。
在下文中一共展示了PMF_Category::moveOwnership方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$user->getUserById($userId);
$response->setData($user->perm->getUserRights($userId));
break;
case 'activate_user':
$user->getUserById($userId);
$user->setStatus('active');
echo json_encode($user->getStatus());
break;
case 'delete_user':
$user->getUserById($userId);
if ($user->getStatus() == 'protected' || $userId == 1) {
$message = '<p class="error">' . $PMF_LANG['ad_user_error_protectedAccount'] . '</p>';
} else {
if (!$user->deleteUser()) {
$message = $PMF_LANG['ad_user_error_delete'];
} else {
$category = new PMF_Category($faqConfig, [], false);
$category->moveOwnership($userId, 1);
// Remove the user from groups
if ('medium' == $faqConfig->get('security.permLevel')) {
$permissions = PMF_Perm::selectPerm('medium', $faqConfig);
$permissions->removeFromAllGroups($userId);
}
$message = '<p class="success">' . $PMF_LANG['ad_user_deleted'] . '</p>';
}
}
$response->setData($message);
break;
}
}
$response->send();
示例2: sprintf
}
$userAction = $defaultUserAction;
if ($userId == 0 && !$csrfOkay) {
$message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']);
} else {
if (!$user->getUserById($userId)) {
$message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']);
}
if (!$user->deleteUser()) {
$message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_delete']);
} else {
// Move the categories ownership to admin (id == 1)
$oCat = new PMF_Category($faqConfig, [], false);
$oCat->setUser($currentAdminUser);
$oCat->setGroups($currentAdminGroups);
$oCat->moveOwnership($userId, 1);
// Remove the user from groups
if ('medium' == $faqConfig->get('security.permLevel')) {
$oPerm = PMF_Perm::selectPerm('medium', $faqConfig);
$oPerm->removeFromAllGroups($userId);
}
$message .= sprintf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_user_deleted']);
}
$userError = $user->error();
if ($userError != "") {
$message .= sprintf('<p class="alert alert-danger">%s</p>', $userError);
}
}
}
// save new user
if ($userAction == 'addsave' && $user->perm->checkRight($user->getUserId(), 'adduser')) {