This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

r-a-y

By: a guest on May 12th, 2010  |  syntax: PHP  |  size: 1.00 KB  |  views: 50  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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');
clone this paste RAW Paste Data