Fix: Some fixes for the autosubscription to mailing-lists

This commit is contained in:
Laurent Destailleur 2012-10-22 01:16:29 +02:00
parent 71ac3d4359
commit 99607073e3

View File

@ -106,11 +106,12 @@ class MailmanSpip
/** /**
* Function used to connect to Mailman * Function used to connect to Mailman
* *
* @param object $object Object with the data * @param object $object Object with the data
* @param string $url Mailman URL to be called with patterns * @param string $url Mailman URL to be called with patterns
* @return mixed Boolean or string * @param string $list Name of mailing-list
* @return mixed Boolean or string
*/ */
function callMailman($object, $url) private function callMailman($object, $url, $list)
{ {
global $conf; global $conf;
@ -329,7 +330,7 @@ class MailmanSpip
} }
//We call Mailman to subscribe the user //We call Mailman to subscribe the user
$result = $this->callMailman($object, $conf->global->ADHERENT_MAILMAN_URL); $result = $this->callMailman($object, $conf->global->ADHERENT_MAILMAN_URL, $list);
if ($result === false) if ($result === false)
{ {
@ -373,14 +374,16 @@ class MailmanSpip
$tmp=explode(':',$list); $tmp=explode(':',$list);
if (! empty($tmp[1])) if (! empty($tmp[1]))
{ {
if ($object->element == 'member' && $object->type != $tmp[1]) // Filter on member type label $list=$tmp[1];
if ($object->element == 'member' && $object->type != $tmp[1]) // Filter on member type label
{ {
continue; dol_syslog("We ignore list ".$list." because object member type ".$object->type." does not match ".$tmp[0], LOG_DEBUG);
continue;
} }
} }
//We call Mailman to unsubscribe the user //We call Mailman to unsubscribe the user
$result = $this->callMailman($object, $conf->global->ADHERENT_MAILMAN_UNSUB_URL); $result = $this->callMailman($object, $conf->global->ADHERENT_MAILMAN_UNSUB_URL, $list);
if ($result === false) if ($result === false)
{ {