Вопрос

Joomla 2.5 by default limits the number of how many votes a user can do. This is limited by IP address.

Is there any simple way to allow multiple votes per IP Address?

I am using the CORE Voting.

Это было полезно?

Решение

Actually, Joomla! 2.5 only stores the last voter's IP address per item.

If another vote comes from a different IP address, the user with the original IP address can vote again.

This behavior is defined in /components/com_content/models/article.php, circa line 308.

if ($userIP != ($rating->lastip))
{
    $db->setQuery(
            'UPDATE #__content_rating' .
            ' SET rating_count = rating_count + 1, rating_sum = rating_sum + '.(int) $rate.', lastip = '.$db->Quote($userIP) .
            ' WHERE content_id = '.(int) $pk
    );
    if (!$db->query()) {
            $this->setError($db->getErrorMsg());
            return false;
    }
} else {
    return false;
}

Changing it involves core file hacking.

One thing that you can do make the test in the if clause always return true, so one possibility is to comment first line and replace it with

if (true)//$userIP != ($rating->lastip))
{
    $db->setQuery(
            'UPDATE #__content_rating' .
            ' SET rating_count = rating_count + 1, rating_sum = rating_sum + '.(int) $rate.', lastip = '.$db->Quote($userIP) .
            ' WHERE content_id = '.(int) $pk
    );
    if (!$db->query()) {
            $this->setError($db->getErrorMsg());
            return false;
    }
} else {
    return false;
}

I don't find the original core solution that great, and it is not customizable, either.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top