1. 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

Discussion in 'Resource Manager Resolved Bugs' started by batpool52!, Jun 16, 2015.

  1. batpool52!

    batpool52! Well-Known Member

    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'
    ;
                }
            }
     
  2. Mike

    Mike XenForo Developer Staff Member

    This is fixed now, thanks.
     

Share This Page