Translations of this page?:

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→

 
tips/autosubscribemailinglist.txt · Last modified: 2008/10/19 10:06 by lifeisfoo
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate