Well, the earlier guide posted by me which you have followed was for MyBB v1.6 and incompatible with v1.8.
You can validate the input right in frontend, by modifying 'submitReputation' method. Open 'general.js' and locate this code near line 365:
submitReputation: function (uid, pid, del) {
// Get form, serialize it and send it
var datastring = $(".reputation_" + uid + "_" + pid).serialize();
if (del == 1)
datastring = datastring + '&delete=1';
$.ajax({
type: "POST",
url: "reputation.php?modal=1",
data: datastring,
dataType: "html",
success: function (data) {
// Replace modal HTML (we have to access by class because the modals are appended to the end of the body, and when we get by class we get the last element of that class - which is what we want)
$(".modal_" + uid + "_" + pid).fadeOut('slow', function () {
$(".modal_" + uid + "_" + pid).html(data);
$(".modal_" + uid + "_" + pid).fadeIn('slow');
$(".modal").fadeIn('slow');
});
},
error: function () {
alert(lang.unknown_error);
}
});
return false;
},
Change it to:
submitReputation: function (uid, pid, del) {
if ($.trim($(".reputation_" + uid + "_" + pid + " input[name=comments]").val()) === '') {
$.jGrowl('Please input Comment.', { theme: 'jgrowl_error' });
} else {
// Get form, serialize it and send it
var datastring = $(".reputation_" + uid + "_" + pid).serialize();
if (del == 1)
datastring = datastring + '&delete=1';
$.ajax({
type: "POST",
url: "reputation.php?modal=1",
data: datastring,
dataType: "html",
success: function (data) {
// Replace modal HTML (we have to access by class because the modals are appended to the end of the body, and when we get by class we get the last element of that class - which is what we want)
$(".modal_" + uid + "_" + pid).fadeOut('slow', function () {
$(".modal_" + uid + "_" + pid).html(data);
$(".modal_" + uid + "_" + pid).fadeIn('slow');
$(".modal").fadeIn('slow');
});
},
error: function () {
alert(lang.unknown_error);
}
});
}
return false;
},
Now user will always be forced to add comment while giving reputation.
Note, that you need to validate in backend PHP as well, because disabling javascript will still allow users to add reputation without comments. And with v.1.8 its easy now, just omit the post reputation bypass condition from validation:
Open reputation.php and locate this line near line number 286:
if(my_strlen($mybb->input['comments']) < $mybb->settings['minreplength'] && $mybb->get_input('pid', MyBB::INPUT_INT) == 0)
and change it to:
if(my_strlen($mybb->input['comments']) < $mybb->settings['minreplength'])// && $mybb->get_input('pid', MyBB::INPUT_INT) == 0)
or simply remove the last part, if you are sure:
if(my_strlen($mybb->input['comments']) < $mybb->settings['minreplength'])
Save the file.