Editing own review not possible because of drupal_goto
fde - March 17, 2008 - 11:55
| Project: | Simple Review |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
When clicking on the 'edit' link to edit your own review, you are redirected to the node page.
This is due to the following condition being true when editing (simple_review_form_alter):
<?php
// Check whether the user has already reviewed this node (except admins)
if (simple_review_already_reviewed($form['nid']['#value']) && !user_access('administer comments')) {
drupal_goto("node/{$form['nid']['#value']}");
}
?>Rewriting it this way solves the problem:
<?php
if ($form['cid']['#value']) {
// Editing a comment: load current vote
$current_vote = simple_review_get_vote($form['cid']['#value']);
}
// Check whether the user has already reviewed this node (except admins)
else if (simple_review_already_reviewed($form['nid']['#value']) && !user_access('administer comments')) {
drupal_goto("node/{$form['nid']['#value']}");
}
?>