I have installed the module and configured. However it is only allowing a user to review once per content type? I.E. if I create a content type session and enable and configure it for review. Then I create 5 sessions. A user can only create a review for one session. If they go to different session as the same user there is no review form.

Is this the correct behavour?

Comments

joekrukosky’s picture

Whether this was the intended behavior or not, I needed to allow one review per user per node. Not one per 'review' type. After tracing the code I found the following query to be the restriction:
in nodereview.module in the function nodereview_nodeapi, line 437

$existing_review = db_fetch_object(db_query("SELECT uid FROM {node} WHERE type = '%s' and uid = %d", 'nodereview', $user->uid));

this only checks to see if the user has a review of a particular type.

By changing the query to check the reviewed_nid as well I was able to achieve the behavior I wanted:

$sql = "SELECT uid
             FROM {node} 
             INNER JOIN {nodereview} ON {node}.nid = {nodereview}.nid 
             WHERE {nodereview}.reviewed_nid = %d  AND uid = %d";
      $existing_review = db_fetch_object(db_query($sql, $node->nid, $user->uid));

Thought I post this encase anyone else needed this behavior as well.

yaworsk’s picture

Assigned: Unassigned » yaworsk

Hey Joe,
thanks for pointing that out - I was planning on taking a look this weekend so thanks for sharing your solution.

I've been working with the module on a couple other sites and updated the code to make a better/cleaner use of the node system so I'll probably revisit that as well and post a patch for testing.

Pete