Pass on form values when invoking all hook_invite()

sbandyopadhyay - February 2, 2009 - 09:42
Project:Invite
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I'm currently working on integrating the Invite module with the Membership types and registration modification module, allowing invited users to be restricted to certain membership types. It's easy enough to do-- but it does require a slight update to the Invite API.

My module works by using hook_form_alter() to alter the invite_form and place in some new form elements. However, these elements are subsequently NOT accessible to my module for processing, unless I either:
(a) scrap the idea of writing a separate module and just edit the Invite module directly [not a good idea because it's a LOT of code for integrating with a module that not everyone will need or use]
OR
(b) have the form passed on to my module when my module calls hook_invite().

Obviously, the second option is a lot cleaner for all parties involved.

It's actually such a minor change that it's not necessary to put it in a patch. Literally, all it takes is adding in
'edit' => $edit
to the $args array just before the line:
module_invoke_all('invite', 'invite', $args);

I hope I've made a good case for why this slight change to the API would be helpful!

#1

christianchristensen - November 4, 2009 - 03:17
Version:5.x-2.x-dev» HEAD

Having come across a similar situation where I required hook_form_alter elements on a the submit handlers hook_invite I think this could be accomplished by adding the $form_state to the args passed to the hook (see patch).

AttachmentSize
add_form_state_invite.patch 563 bytes

#2

christianchristensen - November 4, 2009 - 03:37
Version:HEAD» 6.x-2.x-dev

Just to be clear that patch was for the current CVS HEAD on 6.x (the version looked wrong in the posting - patch re-attached...)

AttachmentSize
add_form_state_invite.patch 563 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.