Class humhub\modules\user\models\UserPicker

Inheritancehumhub\modules\user\models\UserPicker
Available since version1.2

This class can be used to filter results for a user picker search query by calling the static filter method.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
asJSON() Creates an json result with user information arrays. A user will be marked as disabled, if the permission check fails on this user. humhub\modules\user\models\UserPicker
filter() Creates a json user array used in the userpicker js frontend. humhub\modules\user\models\UserPicker

Method Details

asJSON() public static method

Creates an json result with user information arrays. A user will be marked as disabled, if the permission check fails on this user.

public static \humhub\modules\user\models\type asJSON ( $users, $permission null, $priority null, $disabledText null )
$users \humhub\modules\user\models\type
$permission \humhub\modules\user\models\type
$priority
$disabledText
filter() public static method

Creates a json user array used in the userpicker js frontend.

The $cfg is used to specify the filter values the following values are available:

query - (ActiveQuery) The initial query which is used to append additional filters. - default = User Friends if friendship module is enabled else User::find()

active - (boolean) Specifies if only active user should be included in the result - default = true

maxResults - (int) The max number of entries returned in the array - default = 10

keyword - (string) A keyword which filters user by username, firstname, lastname, email and title

permission - (BasePermission) An additional permission filter

fillQuery - (ActiveQuery) Can be used to fill the result array if the initial query does not return the maxResults, these results will have a lower priority

fillUser - (boolean) When set to true and no fillQuery is given the result is filled with User::find() results

disableFillUser - Specifies if the results of the fillQuery should be disabled in the userpicker results - default = true

public static \humhub\modules\user\models\type filter ( $cfg null )
$cfg \humhub\modules\user\models\type

Filter configuration

return \humhub\modules\user\models\type

Json representation used by the userpicker

throws Throwable