Project:Drupal core
Version:8.x-dev
Component:poll.module
Category:feature request
Priority:minor
Assigned:Unassigned
Status:active

Issue Summary

Hi,

I have thought about this for a while, and I think this would be a cool addition to the poll:

Allow poll creators to add a "redirection link" of some sort when setting up a poll. This can best be explained by an example:

* The theme sucks. I have a suggestion for a new theme...
* I have a suggestion about user profiles

When voting for the first one, you could for example have the vote button first show the result, and then redirect to the forum where "themes" are discussed.

When voting for the second option, it opens the poll to the current poll, but with the comment form below, also in a separate window. (The separate window will be an irritation to many people, but can be left as an option).

I am sure I am not the only one who can benefit from this. If someone thinks it is a nice idea and have a quick way to do this, then please do so, otherwise I will do that once the current issues around polls and filtering are resolved.

Regards,

Kobus

Comments

#1

Version:<none>»

Ehmmm... ya... I meant this feature for CVS not 4.1.0...

Kobus

#2

I think this sounds like it would belong with "multipart nodes" or something like that. It's not really a poll.module thing anyway.

Feel free to re-open with more concrete suggestions (or a patch).

#3

Title:Poll enhancement» Poll Redirects
Version:» 6.14
Status:closed (won't fix)» needs review

YES! A response-specific redirect on advanced poll would be great. That way you can provide information and context to the user. Is there a way to do a poll redirect with CCK or some other tool? Anyone? KC

#4

Subscribing

#5

Version:6.14» 8.x-dev

New features go against head and then are backported.

#6

Status:needs review» active

setting to active as there is no patch

#7

#8

Subscribing

#9

It's relatively simple to implement this through a tiny custom module. Assuming you have created a node reference field for the node you wish to redirect to and called that field "vote_redirect" this code does the trick (works in 6.x):

<?php
function MYMODULE_form_poll_view_voting_alter(&$form, &$form_state) {
  if (isset(
$form['#node']->field_vote_redirect)
    &&
is_array($form['#node']->field_vote_redirect)
    &&
count($form['#node']->field_vote_redirect)
    && isset(
$form['#node']->field_vote_redirect[0]['nid'])
    &&
is_numeric($form['#node']->field_vote_redirect[0]['nid'])) {
   
$redirect = 'node/' . $form['#node']->field_vote_redirect[0]['nid'];
    if (isset(
$form['#redirect']) && is_array($form['#redirect'])) {
     
$form['#redirect'][] = $redirect;
    } else {
     
$form['#redirect'] = array($redirect);
    }
  }
}
?>