
r-a-y
By: a guest on
May 12th, 2010 | syntax:
PHP | size: 1.00 KB | hits: 50 | expires: Never
function my_bp_update_post_add_cppoints() {
global $bp;
$bpcpspamlist = explode(',' , get_option( 'bp_spammer_cp_bp' ) );
// create a default boolean variable to check for spammer id
$is_spammer = false;
// check to see if spam list is filled in
if( !empty( $bpcpspamlist ) ) {
foreach ( $bpcpspamlist as $spammer_id ) {
if ($bp->loggedin_user->id == $spammer_id ) {
// since spam id matches logged in user, we mark the variable as "true"
$is_spammer = true;
// this line stops the foreach loop and proceeds to the next statement
break;
}
}
}
// this part of the code runs after we've finished the foreach loop
if ( $is_spammer == false ) {
if( function_exists('cp_alterPoints') ){
cp_alterPoints($bp->loggedin_user->id, get_option('bp_update_post_add_cp_bp') );
cp_log('Comment', $bp->loggedin_user->id, get_option('bp_update_post_add_cp_bp'), BuddyPress);
}
}
}
add_action('bp_activity_posted_update', 'my_bp_update_post_add_cppoints');