I'd like to hook into the poll vote process, and then insert into the Activity module to show that a user voted for a certain poll.

But the default poll module doesn't have any special hooks, that I'm aware of. Please correct me if I'm wrong.

I might be able to redirect the form on submit to a menu_callback, but that seems a bit hacky.

Any other options?

Thanks!

Comments

da_solver’s picture

The Leprechaun says you can use hook_form_FORM_ID_alter to add a submit handler. See http://api.drupal.org/api/function/hook_form_FORM_ID_alter/6. Get the form id for the poll form and create the appropriate function name. In the appropriate function:

$form['#submit'][] = 'custom_code_handler';

In your function 'custom_code_handler()', you'd perform all you custom logic.

sasha13’s picture

To add a custom submit handler on poll vote, you must do it this way:

$form['vote']['#submit'][] = 'custom_form_submit_function'

Adding it to the top level (not under 'vote'),

$form['#submit'][] = 'custom_form_submit_function'

will not work.

This link was very helpful: Overriding The Poll Module In Drupal 6