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

XenForo_Model_User->isFollowing(...) problem?

Discussion in 'XenForo Development Discussions' started by Mic, May 27, 2013.

  1. Mic

    Mic Member


    Is it possible that this function is not working when I only have one follower?

    * Returns whether or not the specified user is being followed by the follower
    * @param integer $userId User being followed
    * @param array $follower User doing the following
    * @return boolean
    public function isFollowing($userId, array $follower = null)
        if ($follower === null)
            $follower = XenForo_Visitor::getInstance();
        if (!$follower['user_id'] || $follower['user_id'] == $userId)
            return false;
        return (strpos(",{$follower['following']},", ",{$userId},") !== false);
    In the strpos, the commas before and after the user id are only available when I have many followers? Is this true?

    When I only have one follower, it wont work even if it is the same follower.
  2. Mic

    Mic Member

    OK, I understand. By adding the commas, it will work for the first and the last item in the list.

Share This Page