How to determine moderation flag from config.pck
![](https://secure.gravatar.com/avatar/ac847e3bb1213b500ff8941fb0d145bb.jpg?s=120&d=mm&r=g)
I'm trying to figure out how to extract the moderation flag for each user in a list's config.pck file.
I know from Defaults.py that it's in the "Bitfield for user options" section (below). But for a config.pck with the following:
'user_options': {'rclemings+20230814@gmail.com': 296, 'rclemings+authuser1@gmail.com': 392, 'rclemings+authuser@gmail.com': 408, 'rclemings@gmail.com': 328},
How can I tell which ones are moderated? Automatically, I mean.
I know the "moderated" value is 128, but I don't understand how (or if it's even possible) to pull out the value for a single flag.
# Bitfield for user options. See DEFAULT_NEW_MEMBER_OPTIONS above to set # defaults for all new lists. Digests = 0 # handled by other mechanism, doesn't need a flag. DisableDelivery = 1 # Obsolete; use set/getDeliveryStatus() DontReceiveOwnPosts = 2 # Non-digesters only AcknowledgePosts = 4 DisableMime = 8 # Digesters only ConcealSubscription = 16 SuppressPasswordReminder = 32 ReceiveNonmatchingTopics = 64 Moderate = 128 DontReceiveDuplicates = 256
--
Russell Clemings <russell@clemings.com>
![](https://secure.gravatar.com/avatar/56f108518d7ee2544412cc80978e3182.jpg?s=120&d=mm&r=g)
On 8/22/23 1:53 PM, Russell Clemings wrote:
For example, in Python
for user, opts in user_options.items():
if opts & 128:
print(user + ' is moderated')
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/56f108518d7ee2544412cc80978e3182.jpg?s=120&d=mm&r=g)
On 8/22/23 2:50 PM, Russell Clemings wrote:
What's the logic behind that? I should have mentioned that I'll be doing this in PHP so I'll have to replicate it.
It works the same in PHP. See https://www.php.net/manual/en/language.operators.bitwise.php
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/ac847e3bb1213b500ff8941fb0d145bb.jpg?s=120&d=mm&r=g)
For the benefit of the archives, here's what I ended up doing:
if ($key_value[1] & 128) {
$key_value[1] = 1; // moderated
}
else {
$key_value[1] = 0; // not moderated
}
$key_value[1] being the second part of the user_options field in config.pck, after I turned it into an array: 'rclemings+authuser@gmail.com': 408,
rac
On Tue, Aug 22, 2023 at 5:11 PM Russell Clemings <rclemings@gmail.com> wrote:
--
Russell Clemings <russell@clemings.com>
![](https://secure.gravatar.com/avatar/56f108518d7ee2544412cc80978e3182.jpg?s=120&d=mm&r=g)
On 8/22/23 1:53 PM, Russell Clemings wrote:
For example, in Python
for user, opts in user_options.items():
if opts & 128:
print(user + ' is moderated')
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/56f108518d7ee2544412cc80978e3182.jpg?s=120&d=mm&r=g)
On 8/22/23 2:50 PM, Russell Clemings wrote:
What's the logic behind that? I should have mentioned that I'll be doing this in PHP so I'll have to replicate it.
It works the same in PHP. See https://www.php.net/manual/en/language.operators.bitwise.php
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/ac847e3bb1213b500ff8941fb0d145bb.jpg?s=120&d=mm&r=g)
For the benefit of the archives, here's what I ended up doing:
if ($key_value[1] & 128) {
$key_value[1] = 1; // moderated
}
else {
$key_value[1] = 0; // not moderated
}
$key_value[1] being the second part of the user_options field in config.pck, after I turned it into an array: 'rclemings+authuser@gmail.com': 408,
rac
On Tue, Aug 22, 2023 at 5:11 PM Russell Clemings <rclemings@gmail.com> wrote:
--
Russell Clemings <russell@clemings.com>
participants (2)
-
Mark Sapiro
-
Russell Clemings