1
rom669
A simple and easy question...
  • 2005/4/15 12:47

  • rom669

  • Just popping in

  • Posts: 3

  • Since: 2005/4/15


Hi!
How can i make a select form like xoopsSelectFormUser that do not contains all registered users but users from another groups ?
thanks

2
ackbarr
Re: A simple and easy question...

the OOP way of solving this problem is creating a new class that extends XoopsFormSelectUser, but who's constructor uses
$member_handler->getUsersByGroup($group);
instead of
$member_handler->getUserList($criteria);

$member_handler->getUsersByGroup() returns an array of UIDs
so you would need to use this array to get the XoopsUser list for those UIDs. Something like this should do the trick
$group = 1;
$uids =& $member_handler->getUsersByGroup($group);
$criteria = new Criteria('uid', "(".implode(',', $members).")", "IN");
$criteria->setSort('uname');
$this->addOptionArray($member_handler->getUserList($criteria));

3
rom669
Re: A simple and easy question...
  • 2005/4/16 17:28

  • rom669

  • Just popping in

  • Posts: 3

  • Since: 2005/4/15


Thanks a lot for your precious help! But you've made a little mistake...
I give the right code that may help others ...

$group = 1;
$uids =& $member_handler->getUsersByGroup($group);
$criteria = new Criteria('uid', "(".implode(',', $uids).")", "IN");
$criteria->setSort('uname');
$this->addOptionArray($member_handler->getUserList($criteria));
[/quote]

I'd really like to thanks those who take the time for helping beginners and for supporting their (silly) questions like mine !