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

Comments

ravi_sam’s picture

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.

shamlah.v’s picture

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

ravi_sam’s picture

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:

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.

shamlah.v’s picture

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

ravi_sam’s picture

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.

shamlah.v’s picture

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.....

ravi_sam’s picture

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.