I'm missing one piece in http://shellmultimedia.com/rate-review-2 - the redirection.
function YOURMODULENAME_form_alter($form_id, &$form) {
switch ($form_id) {
// Only do this for the review type's form
case ('review_node_form'):
// On submission, redirect to the parent node
$pnid = ???;
$form['#redirect'] = "node/$pnid";
// This is in case we add more forms later
break;
}
}
Any clue what I can put in the ??? to make this work? $node->parent_node isn't available here.
Thanks,
Michelle
Comments
Comment #1
dwees commentedI had this issue come up when creating a review module. What I did was put the NID of the parent node in the arguments of the link to the node/add/review page. So instead of node/add/review it became node/add/review/234 or whatever and I would read 234 from arg(3).
Dave
Comment #2
michelleThe URL already has the parent node in it. I was hoping to avoid using arg(), though, because I've already had one person ask about embedding the review form into the parent node. So in that case it would arg(1). I suppose I could check for both if there's no cleaner way.
Thanks,
Michelle