UserList::get
Permalink 1 user found helpful
The Developer's Index would imply that that the UserList::get() function returns User objects, but it seems to return UserInfo objects instead (I'm running Concrete5.6.1.2). It has caused me a lot of frustration in the past, so I thought I'd post about it. I would suspect that UserList::getPage() returns UserInfo objects also.
How I can get the name of the registered users and load in a select box?
<?php
Loader::model('user_list');
$userList = new UserList();
$datos = new ArrayObject();
$datosss = new ArrayObject();
$users = $userList->get();
foreach ($users as $userInfo) {
$datosss = $userInfo->uName;
for($i=0; $i <= count($datosss)+1; $i++){
$datos[$i] = $userInfo->uName;
}
// How to access the attributes of each user/
}
?>
in side the Form:
echo $form->select('usuario', $datos , $usuario);
I did wrong?
<?php
Loader::model('user_list');
$userList = new UserList();
$datos = new ArrayObject();
$datosss = new ArrayObject();
$users = $userList->get();
foreach ($users as $userInfo) {
$datosss = $userInfo->uName;
for($i=0; $i <= count($datosss)+1; $i++){
$datos[$i] = $userInfo->uName;
}
// How to access the attributes of each user/
}
?>
in side the Form:
echo $form->select('usuario', $datos , $usuario);
I did wrong?
"The User object is used specifically for User authentication. If you're storing any custom information against user accounts in your website/application, including any user attributes, you'll want to access the UserInfo object"
It would definitely be nice if they specified in the UserList docs that it returned UserInfo objects though.
Thanks again