Hi all,
wanted to get a pulse on this - I modified the node review module (for my own personal use) to embed a multi axis review on a specific content type rather than have a menu tab which would take users to a separate page to create their review. however, the axes are hardcoded though the output is passed through the theme system.

I spoke with daniel, musing about the idea of adding this functionality and allowing site administrators to choose between embedded reviews or separate pages for reviews. of course i would have to remove the hard coded axes and allow for users to create their own.

before starting to work on the code (time permitting), i was wondering what others thought about the idea, especially you crell, and whether there is room for that functionality in this module.

pete

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danielhonrade’s picture

Hi Peter,

When you "allow users to create their own", do you mean that every node creation by an author, he can create a custom axes and not picking up from the per content type axes?

yaworsk’s picture

sorry, just realized i said users. no, i meant allowing site administrators to create their own axes, the same functionality that exists now. right now all axes are hardcoded in my custom code. i would change that to allow site administrators to define their own axes, following the functionality that currently exists.
pete

danielhonrade’s picture

Hi Pete,

If I understand it correctly, with your code it's now possible to have custom axes on every node.

Currently we are creating axes on each content type which are applied to all nodes from that content type.

By editing or creating axes on the node must not affect other nodes with the same content type, otherwise you can only edit once or create once.

thanks,
daniel

yaworsk’s picture

Hi Daniel,
I probably over complicated this... my code performs the exact same functionality as exists currently with the Node Review module except that the actual node review form is embedded on the node being reviewed -- users are not redirected to a new page to submit a review.

so if you want to submit a review for node/912, with the current module code, users are directed to a new page which has the review form. on my site, users go to node/912, the node review form is loaded as part of the node content (via hook_nodeapi) and users submit the review from node/912.

I'll try and get a demo up this week to showcase the functionality.

pete

danielhonrade’s picture

Hi Pete,

I think, I got it, it's just the viewing and filling up of nodereview axes and not really creating the axes, instead of a tab (add review), you put it on the node itself like a comment at the bottom of the page. Is the result also embedded?

thanks,
daniel

yaworsk’s picture

Yes, exactly. The result is also embedded so that if a user reviews a node and then returns to that node, their submitted values will prepopulate the node review.

yaworsk’s picture

Assigned: Unassigned » yaworsk
Status: Active » Needs review
FileSize
5.74 KB

Just finished the patch. In summary, I've updated 3 files:
- nodereview.admin.inc -- this adds an embed checkbox to the configuration of each reviewable content type
- nodereview.install -- technical change, nothing to do with embedding. The $ret array in the update function was being passed by reference.
-nodereview.module -- updated nodereview_nodeapi to embed the the review form or edit form.

I just finished this and it's late so I haven't extensively tested the patch - i have only tested with normal ratings and not with fivestar. Hoping the community would help with testing. Also, I left the node_add and node_page_edit forms exactly as is when embedded, meaning if you're the superuser (or have permissions to different node add form elements) you see/can access everything on the forms (e.g., authoring information, input format, etc).

Hope this helps and i'll try to address any bugs quickly as they are identified.

Pete

danielhonrade’s picture

Hi Pete,

Thanks for this patch, I'll test it, but it seems something wrong with the link, it says page not found

daniel

yaworsk’s picture

Probably the # in the file name... changed it up and confirmed it is working.

danielhonrade’s picture

Hi Pete,

I was able to test it today, works well, and there are 2 things I noticed:

1) I think you forgot to include this variable_set on submit

function nodereview_configure_axes_submit($form, $form_state) {
  $form_values = $form_state['values'];
  // Save whether or not we're reviewing this node type
  // variable_set('nodereview_use_' . $form_values['node_type'], $form_values['use']);
  variable_set('nodereview_guide_'. $form_values['node_type'], $form_values['guide']);
  variable_set('nodereview_embed_'. $form_values['node_type'], $form_values['embed']); // missing

2) And it seems I can submit unlimited reviews when it is embedded, unlike the tab style which disappears after a review has been submitted.

Thanks,
daniel

yaworsk’s picture

Hi Daniel,
just confirmed, I have the variable set in the nodereview_configure_axes_submit function, here is the text from the patch:
@@ -78,6 +87,9 @@ function nodereview_configure_axes_submit($form, $form_state) {
// Save whether or not we're reviewing this node type
// variable_set('nodereview_use_' . $form_values['node_type'], $form_values['use']);
variable_set('nodereview_guide_'. $form_values['node_type'], $form_values['guide']);
+
+ //save whether or not this axis should be embedded in the node content
+ variable_set('nodereview_embed_' . $form_values['node_type'], $form_values['embed']);

Weird that it wouldn't' show up for you - I confirmed it in the actual nodereview.admin.inc file I have as well... In my file, it is line 91 and 92 (comment and variable set) -- does that make sense?

As for unlimited reviews, what the module does is load in your review so that you can update it... because they are embedded reviews, my thinking was that there shouldn't be an edit review menu tab -- instead, rather than see the blank node review form embedded, the module loads up the users previous review in case they want to change it... be interested to hear what users of the modules think, i'm happy to have it function either way...

danielhonrade’s picture

Hi Pete,

Ok, I'll check it again... mine doesn't load my previous review...

danielhonrade’s picture

Hi Pete,

Yes it was there, should have checked....
I found this why it is not working for me:

<?php
//Your patch from nodereview.module
$existing_review = db_fetch_object(db_query("SELECT {uid} FROM {node} WHERE type = '%s' and uid = '%d'", 'nodereview', $user->uid));

// I delete the curly braces on uid and deleted the quotes on %d
$existing_review = db_fetch_object(db_query("SELECT uid FROM {node} WHERE type = '%s' and uid = %d", 'nodereview', $user->uid));

?>
Now, it's getting my review on edit mode.
yaworsk’s picture

yeah, that was a dumb mistake... sorry about that. Wonder why it worked on mine... I'll have to check that tonight.

yaworsk’s picture

Status: Needs review » Closed (fixed)

updated the patch and committed today.

yaworsk’s picture

Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.