当前位置: 首页>>代码示例>>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;未经允许,请勿转载。