I'm using modr8 and anonymous_posting mods to create a moderated forum where users don't have to log in to post (but, for obvious reasons, posts need to be approved before being published). To implement this, I revoked the ability for anonymous users to view or edit their own posts to prevent some idiot from seeing/modifying what some other idiot recently posted. Additionally, I set the Workflow to throw new posts directly 'In moderation queue' and unchecked the 'publish' option.

Therefore, when an anonymous coward submits a new post, s/he gets rewarded with a 'your post is pending moderator approval' along with a 'you are forbidden from viewing this page' message. This is because the default submit behaviour on a new node is to publish the node (using a $form['#action'] option) and then redirect the poster right back to the node s/he submitted. This second part cannot be done since, being in moderation, the node is unavailable until it's approved. Hence the error.

Between the anonymous_posting module and modr8, I've decided that this is more appropriately a problem with modr8 because since it's the one that's barring access and should have the graceful fallback. Therefore, I hacked function modr8_form_alter(&$form, $form_state, $form_id) in modr8.module, beginning at the 173rd line:

function modr8_form_alter(&$form, $form_state, $form_id) {

  if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id)  {

    $form['#redirect'] = 'forum';

Ideally, instead of hardcoding 'forum', the redirect should be set by an admin configuration option. I wanted opinions on this particular predicament and whether a patch to modr8 would be appropriate to add this functionality. Alternatively, would I be better off writing a wrapper module or remember to hack modr8 whenever there are new releases?

In Drupal 7, themes can call hook_form_alter, so this workaround probably won't need porting to D7. I haven't tested this theory. Still, it never hurts to make the user's life easier.

Comments

Anonymous’s picture

Issue summary: View changes
Anonymous’s picture

Assigned: » Unassigned