I had been assured that developing a module which would send new users the mailman confirmation email was easy. And it was.
I had also been told that writing a module which would add a email form for the user profile page would be easy. It was, after figuring out what the global variables are.
Really, its two different modules, but I didn't see much point splitting them for my own purposes. Maybe it'll be useful for someone else. Developed on 4.5.
function mailmanbasic_user($op, &$edit, &$user, $category)
{
if($op=='insert')
{
mail("list-join@democracyformo.com", " ", " ","From: {$user->mail}\r\n");
}
$user_profile = $user;
global $user; //user looking at page
if ($op == 'view' && $user->uid > 0)
{
global $edit;
/* dprint("<pre>");
dprint_r($user);
dprint('\n');
// dprint_r($edit);
dprint("</pre>"); */
if($edit['subject'] && $edit['message'])
{
mail($user_profile->mail, $edit['subject'], $edit['message'], "From: {$user->name} <{$user->mail}>\r\n");
return array(t('Email Sent') => t("Your email with the subject <strong>{$edit['subject']}</strong> was sent to {$user_profile->name}."));
}
else {
$output = form_textfield("Subject", "subject", '', 25, 100);
$output .= form_textarea("Message", "message", '', 80,8);
$output .= form_submit("Submit");
$output = form($output);
return array(t('Send Email') => $output);
}
}
}
Some of the lines have been word-wrapped, I'm not sure if this will have any effect.