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

Fixed Wrong select if no watchUserId is provided

batpool52!

Well-known member
#1
In Category model under prepareCategoryFetchOptions function
PHP:
if (isset($fetchOptions['watchUserId']))
        {
            if (!empty($fetchOptions['watchUserId']))
            {
                $selectFields .= ',
                    IF(category_watch.user_id IS NULL, 0, 1) AS category_is_watched';
                $joinTables .= '
                    LEFT JOIN xf_resource_category_watch AS category_watch
                        ON (category_watch.resource_category_id = resource_category.resource_category_id
                        AND category_watch.user_id = ' . $this->_getDb()->quote($fetchOptions['watchUserId']) . ')';
            }
            else
            {
                $selectFields .= ',
                    0 AS forum_is_watched';
            }
        }
should be
PHP:
if (isset($fetchOptions['watchUserId']))
        {
            if (!empty($fetchOptions['watchUserId']))
            {
                $selectFields .= ',
                    IF(category_watch.user_id IS NULL, 0, 1) AS category_is_watched';
                $joinTables .= '
                    LEFT JOIN xf_resource_category_watch AS category_watch
                        ON (category_watch.resource_category_id = resource_category.resource_category_id
                        AND category_watch.user_id = ' . $this->_getDb()->quote($fetchOptions['watchUserId']) . ')';
            }
            else
            {
                $selectFields .= ',
                    0 AS category_is_watched';
            }
        }