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

Assert Valid User in Model?

Discussion in 'XenForo Development Discussions' started by Jaxel, Nov 15, 2010.

  1. Jaxel

    Jaxel Well-Known Member

    I am doing a comment system... and I want to be able to check if a commenter's account exists...
    $comment['userValid'] = $this->getHelper('UserProfile')->assertUserProfileValidAndViewable($comment['user_id']);
    This code does not work because getHelper is not valid in models. Is there an alternative?
  2. g0rn

    g0rn Well-Known Member

    I doubt that there is a good way to use code from helper as it throws an exception in case of error instead returning a value. You can however call the methods this helper calls (XenForo_Model_User::getFullUserById and XenForo_Model_UserProfile::canViewFullUserProfile) directly from your model.

Share This Page