Skip to content

Instantly share code, notes, and snippets.

@elhardoum
Created April 28, 2016 03:10
Show Gist options
  • Save elhardoum/d03a0de88a1b80a822029c1f3068521d to your computer and use it in GitHub Desktop.
Save elhardoum/d03a0de88a1b80a822029c1f3068521d to your computer and use it in GitHub Desktop.
<?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