XF 1.5 Best code to determine if user is watching a forum?

StarRiver

Member
I've been trying

PHP:
$this->_getForumWatchModel()->getUserForumWatchByForumId($user['user_id'], $node_id)

but I'm getting "undefined function" errors.

Thanks!
 
Is _getForumWatchModel() function defined? You can try using the following code instead.

PHP:
$this->getModelFromCache('XenForo_Model_ForumWatch')->getUserForumWatchByForumId($user['user_id'], $node_id)
 
That worked. Thanks!

And yes,
Code:
_getForumWatchModel()
is defined in library > Xenforo > ControllerPublic > Watched.php
 
Good to know.

If you weren't extending that particular class, XenForo_ControllerPublic_Watched, that function would be undefined in the context of your code.
 
Back
Top Bottom