Advertisement
wpgenie

mycred - check if enough credits before placing a bid

Jul 23rd, 2015
748
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. add_action( 'woocommerce_simple_auctions_before_place_bid','check_influence_before_bid',10,3 );
  2. function check_influence_before_bid($product_id, $bid, $product) {
  3.  
  4.     global $product_data;
  5.  
  6.     $user_id = get_current_user_id();
  7.     $mycred  = mycred();
  8.     $balance = $mycred->get_users_balance( $user_id );
  9.  
  10.     if ( $balance < $bid ) {
  11.         wc_add_notice (sprintf(__('You dont have enough Influence to bid!', 'wc_simple_auctions'), get_permalink(woocommerce_get_page_id('myaccount'))), 'error');
  12.         $product_data = FALSE;
  13.         return false;
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement