Customize invite module

shamlah.v - June 23, 2009 - 07:20

Hi am working with a project and using "invite" module in it .... I need to cutomize the "New invitation" page.... ie., I just want To: --> text area., Message-->text area and send invite button .... can any one help me with it??? Where can i customize the module.

Thanks
Shamlah

If you're writing a custom

ravi_sam - June 23, 2009 - 09:22

If you're writing a custom module, you can implement hook_form_alter for the case $form_id = 'invite_form', where you could overwrite the values of $form['email'], $form['message'] and any other form element, to match your requirement.

AM NOT ABLE TO FIND "developer/hooks/core.php"

shamlah.v - June 23, 2009 - 11:59

thanks for ur reply.... please help me with this..

Shamlah

Not sure why you're looking

ravi_sam - June 23, 2009 - 14:23

Not sure why you're looking for that file. Pls check here to understand the concept of Drupal 'hooks'.

My earlier suggestion was that, if your custom module is called 'foo', you can write a function foo_form_alter on the following lines:

<?php

function foo_form_alter(&$form, $form_state, $form_id) {
  if (
$form_id == 'invite_form') {
    
$form['email'] = array(
      
'#type' => 'textarea',
      
'#title' => 'To',
      
'#description' => 'Enter the email addresses of invitees as a comma separated list'
    
);

    
$form['message'] = array(
      
'#type' => 'textarea',
      
'#title' => 'Message',
      
'#description' => 'Enter your message here'          
    
);
    
     
//any other element that you do not want to be shown can be over-written as below
     
$form['from'] = '';
     
$form['subject'] = ''
  }
}
?>

You can consult the Forms API docs for more info on this.

Thanks a lot

shamlah.v - June 24, 2009 - 04:50

Hi thank you so much I got wat i wanted..... and one more thing can we add "preview invitation" option while sending a new invitation

Shamlah

Preview Invitation

ravi_sam - June 24, 2009 - 06:11

If you want the 'preview' feature, it would require having two submit buttons one for preview and another for send, but the existing invite_form_submit() function cannot handle the 'preview' usecase.

The workaround is to write your own custom invite form 'foo_invite_form' (with its own menu path e.g. foo/invite) and its corresponding submit function 'foo_invite_form_submit'. Of course, these functions could wrap the original invite module functions, and leverage their functionality.

I will try it...

shamlah.v - June 24, 2009 - 06:40

I will try the way you told.. but, Is there any simple module that can be used to add preview in invitation like in creating a page or comments.....

Shamlah

Not that I know of.

ravi_sam - June 24, 2009 - 07:40

Not that I know of. Btw, to search for any desired module, you may visit the Modules page, enter the relevant keyword (e.g. 'invite') in the 'Search modules' block and scan thru' the results.

 
 

Drupal is a registered trademark of Dries Buytaert.