Open
Description
Hey there,
so I don't want/don't have the time to learn git right now but have written some lines to syncMembers. In Mailman Version 2.1.33 I do have that functionality - so here is the according function to add in api.php. Maybe someone is interested.
/**
* Sync Members to a Mailman List
* @param $members
* Array of Members that should be synced
* @return
* Array of Members that were successfully synced
*/
public function syncMembers($members) {
$token = $this->getCSRFToken("sync");
$response = $this->client->request('POST', $this->mailmanURL . '/members/sync', [
'form_params' => [
'csrf_token' => $token,
'memberlist' => join(chr(10), $members),
'setmemberopts_btn' => 'Änderungen speichern'
]
]);
return $this->parseResultList($response->getBody());
}
And the example to call it
$mailman = new MailmanAPI($mailManBaseURL,$adminPW);
$currentMembers = $mailman->syncMembers(["[email protected]","[email protected]"]);
Note:
- It only returns the newly added members, not the deleted ones.
- As written in my mail, I had to use "use splattner\mailmanapi;" first and then the class call is accordingly "new splattner\mailmanapi\MailmanAPI"
Metadata
Metadata
Assignees
Labels
No labels