fetchAllUsers (function)

Last updated: Wed, Jan 4, 2023 3:19 pm
Return to Knowledgebase

Purpose

Fetches an object of users based on the parameters included

Location

users/helpers/users.php

Version Information

First Introduced v2.5.0

See Also:

fetchUserDetails (function)
fetchUserName (function)

Parameters

# Parameter Data Type Required Description
1 $orderBy = null string No Comma separated params of order by clause to send to the database
2 $desc = false bool No An optional value to order the orderBy in a descending fashion
3 $disabled = true bool No Pass false to remove disabled users from the return

Returns

Data Type Description of Returned Data
array of objects Returns data from the users table based on the specific parameters.

Example

$users = fetchAllUsers();

Further Documentation:


$orderBy = \'lname DESC, fname\'; //orders by lname desc, fname
$desc = true; //forces last orderBy param to be desc as well, if no order by is passed, this doesnt do anything
$disabled = false; //removes users who are disabled, DB column permissions
// All the below parameters are optional - remove them all to fetch all users
$users = fetchAllUsers($orderBy, $desc, $disabled);

foreach($users as $u) {
dump($u);
}