DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

tips:autosubscribemailinglist

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: 2011-06-28 22:29 by lupo49