-
- 73 Posts
Is there any way, i mean API through we can get all users list ?? I am creating app in which i am going to list all the users and their profile, subscriptions etc. Below is what i am so far.
$profile = $modx->user->getOne('Profile');
$fields = $profile->get('fullname');
how can i loop this code for all users ??
[ed. note: amitpatil last edited this post 11 years, 8 months ago.]
-
- 24,544 Posts
There is also the Peoples snippet, which is a convenient way to do the same thing, though your code might be faster.
---------------------------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
MODX info for everyone:
http://bobsguides.com/modx.html
-
- 73 Posts
thanks BOB, I will try this, for now my code is working fine. I am developing big app so i will need ur help in future also.
This proved to be very useful to me as well, since I need to list users with a certain WHERE clause. This proved to be easier than using Peoples or pdoUsers. I just added the WHERE clause:
$c->where(array(
'Profile.zip:=' => $zip,
'AND:Profile.comment:=' => $comment,
'AND:Profile.fax:=' => $fax
));
I also added a bit at the end to properly template the output.
foreach($users as $user){
$userArray = $user->toArray();
$output .= $modx->getChunk('userListTpl', $userArray);
}
return $output;