Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
BomAle Posted October 1, 2018 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.
Ryan Ashbrook Posted October 1, 2018 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.
BomAle Posted October 1, 2018 Author 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
BomAle Posted October 1, 2018 Author 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;
Recommended Posts
Archived
This topic is now archived and is closed to further replies.