• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How recover username or userId = ...

Zephyr

Well-known member
#1
Hello, how can I retrieve a list of username since their id please ?
And how can I retrieve a the username to owner message in which I am (edition) ?

I use a .php Thank :)
 

Insy

Well-known member
#2
PHP:
// One user
$user = XenForo_Model::create('XenForo_Model_User')->getUserById($id);
echo $user['username'];

// Many users
$ids = array(1, 2, 3);
$users =  XenForo_Model::create('XenForo_Model_User')->getUsersByIds($ids);
foreach ($users as $id => $user) {
   echo $user['username'];
}