Hello,
In a custom module, I am trying to read()
data from users
. Here’s a simplified version of what I’m trying to use, which consistently leads to no results.
$user_id = 2; // prefer current user but not sure how to obtain, so WW
$token = $_LW->getAuthToken($user_id);
$data_type = 'users';
$args = [];
$users = $_LW->read($data_type, $args, $token);
if (empty($users)) {
$_LW->logDebug('USERS - NULL'); // I keep getting this
}
else {
$_LW->logDebug('USERS - SOMETHING');
}
As shown, I’ve tried to make use of $token
should user data need an authorized request. API documentation suggests that it is possible to get a token in custom modules using getAuthToken
. The documentation suggests passing $user_id
, which I assume is the id
of a given user. I’ve tried mine and WhiteWhales as hardcoded values. I’m not sure how to get the current user’s ID, nor whether the simple id (2, 7, etc) is what is needed here.
Likewise, the documentation for read()
suggests that it is possible to get ‘users’ data with it. Perhaps it isn’t.
Else, perhaps I’m just missing one little detail, like the type isn’t users
but lw_users
or something. -_-’
Is this possible, and if so, what might I be missing?
Thanks,
Nick