Posted: 06/09/2009 11:15 PM
Easy way to make your users happier
It's a small part of rating improvements I made recently for one of my dear clients.
Every popular website has a few angry maniacs browsing pictures, videos, profiles and giving them one star rating. Nobody deserves 1!
Let's consider those guys as psychos and won't record their votes to database but still giving them illusion rating has been recorded.
Open your /includes/hp/hp.rate.php and find at the bottom:
//------------------------------------------------
// Insert rating
//------------------------------------------------
$DB->query("UPDATE " . DB_PREFIX . "$type"."s
SET totalvotes=totalvotes+1, totalscore=totalscore+$score
WHERE member_id=$member_id AND $type"."_id='$content_id' LIMIT 1");
echo "ok\nok";
exit;
Modify it to look like this:
if ( $score > 1 )
{
//------------------------------------------------
// Insert rating
//------------------------------------------------
$DB->query("UPDATE " . DB_PREFIX . "$type"."s
SET totalvotes=totalvotes+1, totalscore=totalscore+$score
WHERE member_id=$member_id AND $type"."_id='$content_id' LIMIT 1");
}
echo "ok\nok";
exit;
That's it! No more disappointed users wishing to cancel their membership because of ugly "one star" after 50 "five stars" in a row.
Every popular website has a few angry maniacs browsing pictures, videos, profiles and giving them one star rating. Nobody deserves 1!
Let's consider those guys as psychos and won't record their votes to database but still giving them illusion rating has been recorded.
Open your /includes/hp/hp.rate.php and find at the bottom:
PHP
//------------------------------------------------
// Insert rating
//------------------------------------------------
$DB->query("UPDATE " . DB_PREFIX . "$type"."s
SET totalvotes=totalvotes+1, totalscore=totalscore+$score
WHERE member_id=$member_id AND $type"."_id='$content_id' LIMIT 1");
echo "ok\nok";
exit;
Modify it to look like this:
PHP
if ( $score > 1 )
{
//------------------------------------------------
// Insert rating
//------------------------------------------------
$DB->query("UPDATE " . DB_PREFIX . "$type"."s
SET totalvotes=totalvotes+1, totalscore=totalscore+$score
WHERE member_id=$member_id AND $type"."_id='$content_id' LIMIT 1");
}
echo "ok\nok";
exit;
That's it! No more disappointed users wishing to cancel their membership because of ugly "one star" after 50 "five stars" in a row.
274
7
0








Comments
2. If you can use PHP if statements just wrap sql query by if statement checking if $score > 1.
Its doesnt work - except freezing progress.
Dan.