Members
in package
implements
ActionInterface
Uses
BackwardCompatibility
Shows a list of members or a selection of members.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $activation_numbers : array<string|int, mixed>
- $awaiting_activation : int
- $awaiting_approval : int
- $current_filter : int
- $membergroups : array<string|int, mixed>
- $postgroups : array<string|int, mixed>
- $show_activate : bool
- $show_approve : bool
- $subaction : string
- $subactions : array<string|int, mixed>
- $obj : object
- $backcompat : array<string|int, mixed>
Methods
- adminApprove() : void
- Backward compatibility wrapper for the approve sub-action.
- approve() : mixed
- This method handles the approval, rejection, activation or deletion of members.
- browse() : mixed
- Lists all members who are awaiting approval/activation, sortable on different columns.
- call() : void
- Convenience method to load() and execute() an instance of this class.
- execute() : void
- Dispatcher to whichever sub-action method is necessary.
- exportStatic() : void
- Provides a way to export a class's public static properties and methods to global namespace.
- list_getMembers() : array<string|int, mixed>
- Callback for SMF\ItemList().
- list_getNumMembers() : int
- Callback for SMF\ItemList().
- load() : object
- Static wrapper for constructor.
- membersAwaitingActivation() : void
- Backward compatibility wrapper for the browse sub-action.
- search() : mixed
- Search the member list, using one or more criteria.
- searchMembers() : void
- Backward compatibility wrapper for the search sub-action.
- view() : mixed
- View all members list. It allows sorting on several columns, and deletion of selected members. It also handles the search query sent by ?action=admin;area=viewmembers;sa=search.
- viewMemberlist() : void
- Backward compatibility wrapper for the all sub-action.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- getActivationCounts() : mixed
- Fetches all the activation counts for ViewMembers.
- populateDuplicateMembers() : mixed
- Find potential duplicate registration members based on the same IP address
Properties
$activation_numbers
public
array<string|int, mixed>
$activation_numbers
= []
$awaiting_activation
public
int
$awaiting_activation
= 0
$awaiting_approval
public
int
$awaiting_approval
= 0
$current_filter
public
int
$current_filter
= -1
$membergroups
public
array<string|int, mixed>
$membergroups
= []
$postgroups
public
array<string|int, mixed>
$postgroups
= []
$show_activate
public
bool
$show_activate
= false
$show_approve
public
bool
$show_approve
= false
$subaction
public
string
$subaction
= 'all'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['all' => ['view', 'moderate_forum'], 'approve' => ['approve', 'moderate_forum'], 'browse' => ['browse', 'moderate_forum'], 'search' => ['search', 'moderate_forum'], 'query' => ['view', 'moderate_forum']]
Available sub-actions.
Format: 'sa' => array('method', 'required_permission')
$obj
protected
static object
$obj
An instance of this class. This is used by the load() method to prevent mulitple instantiations.
$backcompat
private
static array<string|int, mixed>
$backcompat
= ['func_names' => ['call' => 'ViewMembers', 'list_getMembers' => 'list_getMembers', 'list_getNumMembers' => 'list_getNumMembers', 'viewMemberlist' => 'ViewMemberlist', 'adminApprove' => 'AdminApprove', 'membersAwaitingActivation' => 'MembersAwaitingActivation', 'searchMembers' => 'SearchMembers']]
BackwardCompatibility settings for this class.
Methods
adminApprove()
Backward compatibility wrapper for the approve sub-action.
public
static adminApprove() : void
approve()
This method handles the approval, rejection, activation or deletion of members.
public
approve() : mixed
Called by ?action=admin;area=viewmembers;sa=approve. Requires the moderate_forum permission. Redirects to ?action=admin;area=viewmembers;sa=browse with the same parameters as the calling page.
browse()
Lists all members who are awaiting approval/activation, sortable on different columns.
public
browse() : mixed
It allows instant approval or activation of (a selection of) members. Called by ?action=admin;area=viewmembers;sa=browse;type=approve or ?action=admin;area=viewmembers;sa=browse;type=activate. The form submits to ?action=admin;area=viewmembers;sa=approve. Requires the moderate_forum permission.
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
execute()
Dispatcher to whichever sub-action method is necessary.
public
execute() : void
exportStatic()
Provides a way to export a class's public static properties and methods to global namespace.
public
static exportStatic() : void
To do so:
- Use this trait in the class.
- At the END of the class's file, call its exportStatic() method.
Although it might not seem that way at first glance, this approach conforms to section 2.3 of PSR 1, since executing this method is simply a dynamic means of declaring functions when the file is included; it has no other side effects.
Regarding the $backcompat items:
A class's static properties are not exported to global variables unless explicitly included in $backcompat['prop_names']. Likewise, a class's static methods are not exported as global functions unless explicitly included in $backcompat['func_names'].
$backcompat['prop_names'] is a simple array where the keys are the names of one or more of a class's static properties, and the values are the names of global variables. In each case, the global variable will be set to a reference to the static property. Static properties that are not named in this array will not be exported.
$backcompat['func_names'] is a simple array where the keys are the names of one or more of a class's static methods, and the values are the names that should be used for global functions that will encapsulate those methods. Methods that are not named in this array will not be exported.
Adding non-static properties or methods to the $backcompat arrays will produce runtime errors. It is the responsibility of the developer to make sure not to do this.
list_getMembers()
Callback for SMF\ItemList().
public
static list_getMembers(int $start, int $items_per_page, string $sort, string $where[, array<string|int, mixed> $where_params = [] ][, bool $get_duplicates = false ]) : array<string|int, mixed>
Parameters
- $start : int
-
Which item to start with (for pagination purposes)
- $items_per_page : int
-
How many items to show per page
- $sort : string
-
An SQL query indicating how to sort the results
- $where : string
-
An SQL query used to filter the results
- $where_params : array<string|int, mixed> = []
-
An array of parameters for $where
- $get_duplicates : bool = false
-
Whether to get duplicates (used for the admin member list)
Return values
array<string|int, mixed> —An array of information for displaying the list of members
list_getNumMembers()
Callback for SMF\ItemList().
public
static list_getNumMembers(string $where[, array<string|int, mixed> $where_params = [] ]) : int
Parameters
- $where : string
-
An SQL query to filter the results
- $where_params : array<string|int, mixed> = []
-
An array of parameters for $where
Return values
int —The number of members matching the given situation
load()
Static wrapper for constructor.
public
static load() : object
Return values
object —An instance of this class.
membersAwaitingActivation()
Backward compatibility wrapper for the browse sub-action.
public
static membersAwaitingActivation() : void
search()
Search the member list, using one or more criteria.
public
search() : mixed
Called by ?action=admin;area=viewmembers;sa=search. Requires the moderate_forum permission. The form is submitted to action=admin;area=viewmembers;sa=query.
searchMembers()
Backward compatibility wrapper for the search sub-action.
public
static searchMembers() : void
view()
View all members list. It allows sorting on several columns, and deletion of selected members. It also handles the search query sent by ?action=admin;area=viewmembers;sa=search.
public
view() : mixed
Called by ?action=admin;area=viewmembers;sa=all or ?action=admin;area=viewmembers;sa=query. Requires the moderate_forum permission.
viewMemberlist()
Backward compatibility wrapper for the all sub-action.
public
static viewMemberlist() : void
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
getActivationCounts()
Fetches all the activation counts for ViewMembers.
protected
getActivationCounts() : mixed
populateDuplicateMembers()
Find potential duplicate registration members based on the same IP address
protected
static populateDuplicateMembers(array<string|int, mixed> &$members) : mixed
Parameters
- $members : array<string|int, mixed>
-
An array of members