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

getUser => error

Discussion in 'XenForo Development Discussions' started by Zephyr, Oct 13, 2012.

  1. Zephyr

    Zephyr Well-Known Member

    Hello, I have an error:




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

  2. Insy

    Insy Well-Known Member

    $user XenForo_Model::create('XenForo_Model_User')->getUserById($idMember);
    if (
    is_array($user) && isset($user['username'])) {
    $usernameList[] = $user['username'];
  3. Zephyr

    Zephyr Well-Known Member

    Niquel merci, j'avais oublié que j'était dans une boucle ^^
  4. Insy

    Insy Well-Known Member

    When a user doesn't exist, XenForo_Model_User always returns a null value. You should always check this in your code.

Share This Page