当前位置: 首页>>代码示例>>PHP>>正文


PHP UserGroup::getByName方法代码示例

本文整理汇总了PHP中UserGroup::getByName方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::getByName方法的具体用法?PHP UserGroup::getByName怎么用?PHP UserGroup::getByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserGroup的用法示例。


在下文中一共展示了UserGroup::getByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

if (!$superadmin_reg && !$session->allow_registrations) {
    return;
}
// Handle new user registrations
if (isset($_POST['register_usr']) && isset($_POST['register_pwd']) && isset($_POST['register_pwd2'])) {
    $reg = UserHandler::getInstance();
    $user_id = $reg->register($_POST['register_usr'], $_POST['register_pwd'], $_POST['register_pwd2']);
    if ($user_id) {
        if ($superadmin_reg) {
            if (!UserGroup::getAll()) {
                // If no UserGroup:s exist, create them
                UserGroup::create('Webmasters', 1);
                UserGroup::create('Admins', 2);
                $sadmin_id = UserGroup::create('Super Admins', 3);
            } else {
                $grp = UserGroup::getByName('Super Admins');
                $sadmin_id = $grp['groupId'];
            }
            if (!$sadmin_id) {
                throw new \Exception('super admin group not found');
            }
            // Add this user to Super Admin group
            UserGroupHandler::addToGroup($user_id, $sadmin_id);
        }
        if ($session->login($_POST['register_usr'], $_POST['register_pwd'])) {
            $session->showStartPage();
        }
    }
    // after form submit failed, put focus back to the register form <div> to show error
    $header->embedJsOnload('show_reg_form();');
}
开发者ID:martinlindhe,项目名称:core_dev,代码行数:31,代码来源:register.php

示例2: arcGetMenu

 public static function arcGetMenu()
 {
     $menu = [];
     $pages = \Page::getAllPages();
     $groups[] = \UserGroup::getByName("Guests");
     if (self::arcIsUserLoggedIn() == true) {
         $groups = array_merge($groups, self::arcGetUser()->getGroups());
     }
     foreach ($pages as $page) {
         if ($page->hidefrommenu == true || $page->hideonlogin == true && self::arcIsUserLoggedIn() == true) {
             continue;
         }
         if (\UserPermission::hasPermission($groups, $page->seourl)) {
             $data = explode("/", $page->seourl);
             $menu[ucwords($data[0])][$page->title]["name"] = $page->title;
             $menu[ucwords($data[0])][$page->title]["url"] = $page->seourl;
             $menu[ucwords($data[0])][$page->title]["icon"] = $page->iconclass;
         }
     }
     return $menu;
 }
开发者ID:DeltaWolf7,项目名称:Arc,代码行数:21,代码来源:Helper.php

示例3: getGroups

 /**
  * 
  * @return \UserGroup Gets the group of the user
  */
 public function getGroups()
 {
     $groups = [];
     foreach (json_decode($this->groups) as $group) {
         $grp = UserGroup::getByName($group);
         if ($grp->id != 0) {
             $groups[] = $grp;
         }
     }
     return $groups;
 }
开发者ID:DeltaWolf7,项目名称:Arc,代码行数:15,代码来源:User.class.php


注:本文中的UserGroup::getByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。