Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.