Hi I want to know how can I theme the user invite form?

Can I do it using phptemplate, if yes then how? I mean what form to return
in template.php.

Thanks

Comments

fumanchu182’s picture

What you are looking to do can be take care of with the function hook_mail_alter(). This function is defined so that you can customize any of the parameters going into a drupal_mail() function. I am providing below an example of a hook_mail_alter so you can see by example how this is done. Notice how "invite-mail" is the string that is used to identify this email. With this kind of modularity you can then write theme functions based on any other criteria such as user role, permissions, etc... Please remember to replace "module" with the name of the module you are placing this code into. To keep transparency among the variables being passed in also write any modification functions to accept variables by reference.

function module_mail_alter(&$mailkey, &$to, &$subject, &$body, &$from, &$headers)
{
  switch($mailkey)
  {
    // theme the body of the mail message going out
    case 'invite-mail' : {
      // do stuff here
      
    }break;
  }
}

Hope this helps.

-Anthony

Anonymous’s picture

i think the op wanted to alter the form, not what gets sended throught the email. i'm at the same point. i would like to add content on top of the generated form, but i can't find were. any ideas?

sun’s picture

Priority: Critical » Normal
Status: Active » Fixed
/**
 * Implementation of hook_form_alter().
 */
function mymodule_form_alter($form_id, &$form) {
    case 'invite_form':
      // Your customizations to $form here...
      break;
  }
}

Sorry, this basic Drupal Form API fu, nothing special about Invite module. Please consult the handbooks about form_alter() on drupal.org for further information.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

shamlah.v’s picture

Hi am creating a project with "invite" module.... 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

lucascaro’s picture

A little bit too late, but if anyone else needs to do those customizations, you can give this a try: http://drupal.org/sandbox/lucascaro/1189764
Note that it's a sandbox and therefore alpha code, but it works for me so far and I would gladly accept any issues that could make it better.