Notifications
Clear all
Topic starter
Is there a way to put a minimum length to the reviews? Many people leave only one word and it is kinda annoying to the authors (at least for me).
I would like to put a minimum of 15-20 words to be able to submit a review.
Posted : 09/09/2013 5:16 pm
I think this might work for you.
In reviews.php, around line 126, you'll find:
$review = escapestring($review);
After that add:
$reviewwords_to_count = strip_tags($review);
$reviewpattern = "/[^(w|d|'|"|.|!|?|;|,|\|/|--|:|&|@)]+/";
$reviewwords_to_count = preg_replace ($reviewpattern, " ", $reviewwords_to_count);
$reviewwords_to_count = trim($reviewwords_to_count);
$reviewwordcount = count(explode(" ",$reviewwords_to_count));
A few lines down, you'll see:
else if($review == "No Review" && $_POST['rating'] == "-1") $output .= write_error(_MISSINGINFO);
After it, add:
else if($reviewwordcount < '15') $output .= write_error(_REVIEWWORDCOUNTFAILED);
The 15 in $reviewwordcount < '15' means that it will not accept reviews with less than 15 words. You can edit the number to whatever length you want.
Then add the following to your languages file (en.php or the like)
define ("_REVIEWWORDCOUNTFAILED", "Reviews must contain at least 15 words. Please <a href=""javascript:" history.back(1)">try again</a>.");
Let me know if this helps.
Posted : 10/09/2013 4:49 pm
Topic starter
Hi! This worked like a charm.
Thanks a lot!~
Posted : 30/09/2013 3:49 am