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("");
        dprint_r($user);
        dprint('\n');
//      dprint_r($edit);
        dprint(""); */

        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.

Comments

arturoramos’s picture

Here is a module that is a bit more sophisticated in that it allows the administrator to add and delete Mailman lists and then allows users to sign up and change their settings (e.g. digest, all mail or no mail) from the website itself without further confirmation. It does this by assigning passwords for each subscription and then sending password-authenticated commands to the Mailman software.

http://www.nuestrosranchos.com/testsite/node/1

bnoice’s picture

I uploaded this module, ran the SQL, enabled the module in Drupal Admin, and when I went to use it, I get the following ...

Fatal error: Call to undefined function: form_textfield() in /path-to-drupal/modules/mailman_manager.module

The form_textfield() method isn't present anywhere outside of the mailman_module code ...

Suggestions?

Thanks,

B

arturoramos’s picture

Unfortunately, all of the form functions in Drupal 4.7 are different from 4.6 so that part of the script will have to be changed to function with 4.7. I do not have a 4.7 installation on any machine, otherwise I might undertake it. If you are willling to do the nitty gritty coding and debugging, I would be glad to help out getting a 4.7 version going.

toddgee’s picture

I'm new to 4.7 forms myself, but I would love to see a mailman interface module. How can I help? Is there any progress on 4.7ness?

arturoramos’s picture

I have just completed a rough port to 4.7 for this mailman manager module. Please let me know if you can help testing. I only have 4.7 installed on my local computer and the mail functions are difficult to test due to the lack of an SMTP server on my machine.

arturoramos’s picture

I have begun a project in Drupal for Mailman Manager and the 4.7 code is now in the Modules section:

http://drupal.org/project/mailman_manager