當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PMF_Category::moveOwnership方法代碼示例

本文整理匯總了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();
開發者ID:ae120,項目名稱:phpMyFAQ,代碼行數:31,代碼來源:ajax.user.php

示例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')) {
開發者ID:maggiofrancesco,項目名稱:phpMyFAQ,代碼行數:31,代碼來源:user.php


注:本文中的PMF_Category::moveOwnership方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。