BomAle Posted October 1, 2018 Share Posted October 1, 2018 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. Link to comment Share on other sites More sharing options...
Ryan Ashbrook Posted October 1, 2018 Share Posted October 1, 2018 How would you suggest improving it? The \IPS\Member::inGroup() method takes into account both the primary group, as well as secondary groups. Link to comment Share on other sites More sharing options...
BomAle Posted October 1, 2018 Author Share Posted October 1, 2018 /* 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 Link to comment Share on other sites More sharing options...
BomAle Posted October 1, 2018 Author Share Posted October 1, 2018 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; Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.