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

getUser => error

Zephyr

Well-known member
#1
Hello, I have an error:

error:
Fatal error: [] operator not supported for strings in /home/zephyr62/www/ElderScrolls/Forum/library/KingK/BbCodeManager/BbCode/Formatter/Default.php on line 54

$user = XenForo_Model::create('XenForo_Model_User')->getUserById($idMember);
$usernameList[] = $user['username']; (line 54)

var_dump($user['username'])

show:


If user enter a bad id, I have this error, how prevent that please ? :)
Possible to remove automatic the nulled value ?

Thank.
 

Insy

Well-known member
#2
PHP:
$user = XenForo_Model::create('XenForo_Model_User')->getUserById($idMember);
if (is_array($user) && isset($user['username'])) {
  $usernameList[] = $user['username'];
}