Created
April 28, 2016 03:10
-
-
Save elhardoum/d03a0de88a1b80a822029c1f3068521d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function se_bbpm_add_spam_check() { | |
/** | |
* add spam check for users with bbp_spectator and bbp_participant roles | |
* Add more roles in the $targetRoles line or replace existing ones to match | |
* your targeted users | |
*/ | |
$targetRoles = array( 'bbp_participant', 'bbp_spectator' ); | |
$current_user = wp_get_current_user(); | |
foreach( $targetRoles as $role ) { | |
if( in_array( $role, $current_user->roles ) ) | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment