Jump to content

canReact improve check


BomAle

Recommended Posts

Posted

Hello,

I wanted to suggest changing this:
/* Protected Groups */
if ( $owner->inGroup( explode( ',', \IPS\Settings::i()->reputation_protected_groups ) ) )
{
	return FALSE;
}

into a better way to check if there is a group (primary or secondary) authorized to receive reaction.

Posted
/* Protected Groups */
if ( !$owner->inGroup( array_diff( array_keys(\IPS\Member\Group::groups( TRUE, FALSE )), explode( ',', \IPS\Settings::i()->reputation_protected_groups ) ) ) )
{
	return FALSE;
}

this is way check only if inside one of groups granted

Posted

check it yourself

<?php
require_once './init.php';
\IPS\Dispatcher\External::i();
echo "groups authorized receive reputation:<br>";
$output = '';
foreach(array_diff( array_keys(\IPS\Member\Group::groups( TRUE, FALSE )), explode( ',', \IPS\Settings::i()->reputation_protected_groups ) ) as $g)
{
	$output .= \IPS\Member\Group::load( $g )->formattedName . '<br>';
}
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $output );
echo $output;

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...