Home /Tutorials /Finding user information
Finding user information

A user’s identifier or key (the uid) is a very important piece of information. It’s also used in many other endpoints to identify users. Also, when managing user information in WellnessLiving, note that a user’s last name and email are optional when client profiles are created by staff members. As a result, not every user has every piece of information set in their profile. However, a client profile will always have an associated uid.

There are two primary methods for finding an existing user and their uid in the system. The first method uses the All Clients Report to get all clients in a business. This report returns a client’s name, email, and client ID (uid).

// Get the All Sales Report.
$o_report=new \WellnessLiving\Wl\Report\DataModel($o_config);
$o_report->cookieSet($o_notepad->cookieGet()); // Keep cookies to keep session.
$o_report->id_report=WlReportSid::LOGIN_LIST_ALL;
$o_report->k_business='3'; // Put your business key here

$o_report->get();

// Output the information.
$i=0;
foreach($o_report->a_data['a_row'] as $a_row)
{
 $i++;
 printf("%3d %3s %15s %15s %s \r\n",$i,$a_row['uid'],$a_row['a_data_api']['s_firstname'],$a_row['a_data_api']['s_lastname'],$a_row['a_data_api']['s_mail']);
}

The second method involves a more limited search using the ListModel endpoint. This endpoint takes a name, or fragment of a name, and returns all matches in a business.

// Search for a user.
$o_search_model = new \WellnessLiving\Wl\Login\Search\StaffApp\ListModel($o_config);
$o_search_model->cookieSet($o_notepad->cookieGet()); // Keep cookies to keep session.

$o_search_model->k_business='3';
$o_search_model->text_search='example';
$o_search_model->uid='8'; // The uid of the user performing the search.

// Perform the request.
$o_search_model->get();

foreach($o_search_model->a_list as $a_list)
{
 echo $a_list['uid'].' '.$a_list['text_title']."\n";
}