Guest User

r-a-y

a guest
May 12th, 2010
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function my_bp_update_post_add_cppoints() {
  2.     global $bp;
  3.  
  4.     $bpcpspamlist = explode(',' , get_option( 'bp_spammer_cp_bp' ) );
  5.    
  6.     // create a default boolean variable to check for spammer id
  7.     $is_spammer = false;
  8.    
  9.     // check to see if spam list is filled in
  10.     if( !empty( $bpcpspamlist ) ) {
  11.         foreach ( $bpcpspamlist as $spammer_id ) {
  12.             if ($bp->loggedin_user->id == $spammer_id ) {  
  13.                 // since spam id matches logged in user, we mark the variable as "true"
  14.                 $is_spammer = true;
  15.                
  16.                 // this line stops the foreach loop and proceeds to the next statement
  17.                 break;
  18.             }
  19.         }
  20.     }
  21.  
  22.     // this part of the code runs after we've finished the foreach loop
  23.     if ( $is_spammer == false ) {
  24.         if( function_exists('cp_alterPoints') ){
  25.             cp_alterPoints($bp->loggedin_user->id, get_option('bp_update_post_add_cp_bp') );
  26.             cp_log('Comment', $bp->loggedin_user->id, get_option('bp_update_post_add_cp_bp'), BuddyPress);
  27.         }
  28.     }
  29. }
  30. add_action('bp_activity_posted_update', 'my_bp_update_post_add_cppoints');
RAW Paste Data