1

Is there a way to change the moderation flag of a member of a list from the command line, with Mailman?

Daniel C. Sobral
  • 5,713
  • 6
  • 34
  • 48

2 Answers2

3

Turn ON moderated bit:

/usr/lib/mailman/bin/withlist -r mod.set $currentlist $user 1

Turn OFF moderated bit:

/usr/lib/mailman/bin/withlist -r mod.set $currentlist $user 0

In the above 2 statements, replace $currentlist with the list name and $user with the member's subscribed address.

Using "mod.py":

#! /usr/bin/python
# mod.py

from Mailman import mm_cfg
import sys

def mod(list):
    for member in list.getMembers():
        if list.getMemberOption(member, mm_cfg.Moderate):
            print member, "is moderated"

def set(list, member, value):
    value = not not (int(value))
    if list.isMember(member):
        list.Lock()
        list.setMemberOption(member, mm_cfg.Moderate, value)
        print "%s's moderated flag set to %d" % (member, value)
        list.Save()
        list.Unlock()
    else:
        print member, "not a member"
Ladadadada
  • 26,337
  • 7
  • 59
  • 90
1

There is a python script at http://www.msapiro.net/scripts/set_mod.py that might do what you need. I'm not aware of anything that actually comes with mailman to do this.

Robert Novak
  • 619
  • 4
  • 6