DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:autosubscribemailinglist

This is an old revision of the document!


Auto subscribe your user to a mailing list

To subscribe all your dokuwiki user to a mailing list, avoiding spambot, you can edit inc/auth.php
Edit the end of updateprofile() function:

....
if (!count($changes)) {
    msg($lang['profnochange'], -1);
    return false;
  }

  if ($conf['profileconfirm']) {
    if (!$auth->checkPass($_SERVER['REMOTE_USER'], $_POST['oldpass'])) {
      msg($lang['badlogin'],-1);
      return false;
    }
  }

  return $auth->modifyUser($_SERVER['REMOTE_USER'], $changes);
}
...

adding only a call to php mail function:

...
  if (!count($changes)) {
    msg($lang['profnochange'], -1);
    return false;
  }

  if ($conf['profileconfirm']) {
    if (!$auth->checkPass($_SERVER['REMOTE_USER'], $_POST['oldpass'])) {
      msg($lang['badlogin'],-1);
      return false;
    }
  }
/*******/  
  if(mail("youmailinglist-subscribe@yourdomain.org", "", "" ,"From: ".$_POST['email']."\r\n")){
  	msg("Subscribing done for ".$_POST['email']."",1);
  	}
/*******/

  return $auth->modifyUser($_SERVER['REMOTE_USER'], $changes);
}
...

Now, every time a user after registration update his password (or other stuff in his profile), he will subscribe you mailing list.
If you mailing list daemon accept subscription only by admin, well you can use :

 mail("youmailinglist@yourdomain.org", "", "SUBSCRIBE yourmailing@youdomain.org ". $_POST['email']." " ,"From: admin@yourdomain.org\r\n"))


By the way, your server need to have installed a mail daemon.
Tested on dokuwiki 2008-05-05.

If you have a problem, ask me at ←adminNOSPAM@NOSPAMlulug.org→

Test


tips/autosubscribemailinglist.1309265449.txt.gz · Last modified: 2011-06-28 14:50 by 125.24.174.240

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki