Skip to main content
Topic: Require verification based on white/blacklisting groups (Read 1665 times) previous topic - next topic - Topic derived from Verification NOT exempting Mo...
0 Members and 1 Guest are viewing this topic.

Require verification based on white/blacklisting groups

I think it should have two lists: a white list and a black list. Each list is of groups. Then, you create a group (eg 20_posts_plus_group) and add that group to the white list. For moderators, you just add all moderators to the moderators group and then add them to the white list. This gives you much greater control.

Then, create a function (I did this in Notepad in a few seconds so it's just a concept):

Code: [Select]
var_dump(requiresPostVerification($user_info['groups']));

// Admin, Global Moderator, Moderator
$modSettings['post_verification_whitelist'] = [1, 2, 3];
// Default Newbie Group and Guest
$modSettings['post_verification_blacklist'] = [-1, 4];

/**
 * Check if a user is required to answer a human verification question
 * @param array $groups The user's groups
 * @return bool
 */
function requiresPostVerification(array $groups)
{
$whitelist = $GLOBALS['modSettings']['post_verficiation_whitelist'] ?: $GLOBALS['modSettings']['post_verficiation_whitelist'];
$blacklist = $GLOBALS['modSettings']['post_verification_blacklist'] ?: $GLOBALS['modSettings']['post_verification_blacklist'];

// Don't worry about the whitelist if they are on the blacklist. We want to be overly cautious
if (!empty($blacklist) && array() !== array_intersect($blacklist, $groups))
{
return true;
}

if (!empty($whitelist) && array() !== array_intersect($whitelist, $groups))
{
return true;
}

return false;
}
Last Edit: July 10, 2015, 09:52:04 pm by Joshua Dickerson
Come work with me at Promenade Group

Re: Require verification based on white/blacklisting groups

Reply #1

Also, create_control_verification() should not return errors or a bool. It is polluting $context['require_verification'] which should only be a bool.

Re: Require verification based on white/blacklisting groups

Reply #2

I'm not certain all that is needed.
The only groups that should be exempt, are Admins, Global Moderators, and maybe regular moderators, IMHO.

Re: Require verification based on white/blacklisting groups

Reply #3

xref: https://github.com/elkarte/Elkarte/issues/363
Bugs creator.
Features destroyer.
Template killer.