Multiple reviews by same person.
jereme.guenther - January 7, 2008 - 00:30
| Project: | userreview |
| Version: | 5.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
It would be really nice to be able to allow certain roles to create more than one review.
Specifically I am trying to allow anonymous users to create reviews. It would be nice to allow them to enter a username as well, however I can get by with turning the title field into that.
Since this is a must for my site and this module is the closest thing I have found to what I need, I am going to try and hack the code to get the results I need. If I succeed I will post the hack here.

#1
Ok, here is the hack to allows users to make multiple reviews.
To get the needed variable into the admin GUI so this feature can be turned on or off at will...
below this code (which ends at line 237 of the userreview.module)
$form['current review']['userreview_show_currentuser_review'] = array(
'#type' => 'checkbox',
'#title' => t('Show current user\'s review'),
'#description' => t('When showing a reviewed node (in full page view), should current\'s user review be shown?'),
'#default_value' => variable_get('userreview_show_currentuser_review', true)
);
add these lines:
$form['current review']['userreview_allow_multiple_reviews'] = array(
'#type' => 'checkbox',
'#title' => t('Allow multiple reviews of one node.'),
'#description' => t('Should a user be allowed to make more than one review per node? (disables "Show current user\'s review")'),
'#default_value' => variable_get('userreview_allow_multiple_reviews', false)
);
-----------------
Then (to actually allow multiple reviews)
in the fuction:
function userreview_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
replace:
//get the current user's review for this content node
$userreviewnode = get_userreview_node($node, $user->uid);
with:
//get the current user's review for this content node
if (variable_get('userreview_allow_multiple_reviews', false)) {
$userrewviewnode = null;
} else {
$userreviewnode = get_userreview_node($node, $user->uid);
}
#2
This seems like a great enhancement - it would be even better if it could be committed as a feature to the module.
Would it also make sense to link it to a permission so that the feature could be given to or withheld from certain roles?