XenForo_Model_User->isFollowing(...) problem?

Mic

Member
Hi,

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

Code:
/**
* 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.
 
OK, I understand. By adding the commas, it will work for the first and the last item in the list.
 
Back
Top Bottom