• 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?

Jaxel

Well-known member
#1
I am doing a comment system... and I want to be able to check if a commenter's account exists...
Code:
$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?
 

g0rn

Well-known member
#2
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.