DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:autosubscribemailinglist

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:autosubscribemailinglist [2008-10-17 13:59] lifeisfootips:autosubscribemailinglist [2011-06-28 22:29] (current) – old revision restored lupo49
Line 1: Line 1:
 +====== 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:
 +<code>....
 +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);
 +}
 +...
 +</code>
 +
 +adding only a call to php mail function:
 +
 +<code>...
 +  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);
 +}
 +...
 +</code>
 +
 +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 :
 +<code> mail("youmailinglist@yourdomain.org", "", "SUBSCRIBE yourmailing@youdomain.org ". $_POST['email']." " ,"From: admin@yourdomain.org\r\n"))</code>
 +\\
 +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->

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