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


PHP UserList::filterByAttribute方法代碼示例

本文整理匯總了PHP中UserList::filterByAttribute方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserList::filterByAttribute方法的具體用法?PHP UserList::filterByAttribute怎麽用?PHP UserList::filterByAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserList的用法示例。


在下文中一共展示了UserList::filterByAttribute方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: do_login

 protected function do_login()
 {
     $ul = new UserList();
     $ul->filterByAttribute("{$this->network}_id", $this->user->identifier);
     $list = $ul->get(1);
     $user = $list[0];
     $response = false;
     if ($user != null) {
         $response = User::loginByUserID($user->getUserID());
     }
     return $response;
 }
開發者ID:remo,項目名稱:social,代碼行數:12,代碼來源:controller.php

示例2: function

 */
$getMembers = function ($filters) use($av) {
    // Filter to show only the staff members, or customize
    // by 'custom template' and choose a block name
    $ul = new UserList();
    $defaultAttribute = ['', true, '='];
    foreach ($filters as $k => $filter) {
        if ($k === 'groups') {
            foreach ($filter as $group) {
                $ul->filterByGroup($group);
            }
        } elseif ($k === 'attributes') {
            // $attribute keys: 'id', 'value', 'compare'
            foreach ($filter as $attribute) {
                list($handle, $value, $comparison) = array_replace($defaultAttribute, $attribute);
                $ul->filterByAttribute($handle, $value, $comparison);
            }
        }
        $ul->sortBy('ak_order', 'asc');
    }
    /**
     * Build doc with all the 'member's in it, and load the values we'll
     * need to display.
     */
    return array_map(function ($member) use($av) {
        return ['id' => $member->getUserID(), 'img' => $av->getImagePath($member), 'name' => trim($member->getAttribute('first_name') . ' ' . $member->getAttribute('last_name')), 'title' => $member->getAttribute('job_title') ?: "Jane's Walk", 'email' => $member->getUserEmail(), 'description' => $member->getAttribute('bio')];
    }, $ul->get(100));
};
echo $controller->getContent();
?>
<ul class="ccm-staff-list">
開發者ID:r-bansal,項目名稱:janeswalk-web-1,代碼行數:31,代碼來源:staff_list.php


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