X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fmmlist.php;h=a94c722160326151b54d9352f9e1a52f27390f1e;hb=f23d33e1b114e9032b4b966baebdeb14b4215313;hp=a16b1c6c83a7432275b095c20e953c93f5ef2c61;hpb=756ff73fbb0cdd01cce2eda27ba18e1cc99bd735;p=platal.git diff --git a/classes/mmlist.php b/classes/mmlist.php index a16b1c6..a94c722 100644 --- a/classes/mmlist.php +++ b/classes/mmlist.php @@ -1,6 +1,6 @@ id(); + $pass = $user->password(); + } else { + $uid = $user; + } $dom = is_null($fqdn) ? $globals->mail->domain : $fqdn; $url = "http://$uid:$pass@{$globals->lists->rpchost}:{$globals->lists->rpcport}/$dom"; @@ -32,6 +39,27 @@ class MMList extends XmlrpcClient $this->bt = new PlBacktrace('MMList'); } } + + /** + * Replace email in all lists where user has subscribe + * @param $old_email old email address used in mailing lits + * @param $new_email new email to use in place of the old one + * @return number of mailing lists changed + */ + public function replace_email_in_all($old_email, $new_email) { + $all_lists = $this->get_lists($old_email); + if (!$all_lists) { + return 0; + } + $changed_lists = 0; + foreach ($all_lists as $list) { + if ($list->sub) { + $this->replace_email($list->list, $old_email, $new_email); + $changed_lists++; + } + } + return $changed_lists; + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: