xoops forums

KubaZ

Just popping in
Posted on: 2004/4/28 10:49
KubaZ
KubaZ (Show more)
Just popping in
Posts: 37
Since: 2002/10/9
#1

search user by name

Hi,

I know it is possible ('cos in XOOPS most things are possible to do )

So I want a handler to a specific user. I must search him by name (not by ID, as is usually in XOOPS codes).. and then I would be able to show his avatar, or more more

so how I can get it ? (a handler)

Mithrandir

XOOPS is my life!
Posted on: 2004/4/28 11:02
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#2

Re: search user by name

The memberhandler has a getUsers() function, which takes a criteria element - which you can make as uname = [name]

KubaZ

Just popping in
Posted on: 2004/4/28 11:23
KubaZ
KubaZ (Show more)
Just popping in
Posts: 37
Since: 2002/10/9
#3

Re: search user by name

thanks

now I understand criteria variable , I suppose

Mithrandir

XOOPS is my life!
Posted on: 2004/4/28 12:02
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#4

Re: search user by name

I am not at home, so this will possibly have to do:
$usercriteria = new Criteria('uname'$thisusername'='); //3rd parameter unnecessary, since it is '=' by default

$member_handler =& xoops_gethandler('member');
$thisuserobject $member_handler->getUsers($usercriteria);

KubaZ

Just popping in
Posted on: 2004/4/28 12:30
KubaZ
KubaZ (Show more)
Just popping in
Posts: 37
Since: 2002/10/9
#5

Re: search user by name

Yes, I had a little problem with it.

but I've looked into finduser.php (in system module)

Quote:

$member_handler =& xoops_gethandler('member');

$criteria = new CriteriaCompo();

$criteria->add(new Criteria('uname',$komputer, '='));

$total = $member_handler->getUserCount($criteria);

$foundusers =& $member_handler->getUsers($criteria, true);


so it is as you wrote thanks thanks

(and 3rd parameter is a part MySQL language like ('LIKE', >=) function uses it in SQL query in connection with WHERE )