Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'mycred_add', 'mycred_pro_global_daily_limit', 1, 3 );
- function mycred_pro_global_daily_limit( $reply, $request, $mycred ) {
- if ( $reply === false || substr( $request['ref'], 0, 15 ) == 'buy_creds_with_' ) return $reply;
- $user_id = absint( $request['user_id'] );
- // Get total for today starting from midnight til now
- $total = mycred_get_total_by_time( 'today', 'now', NULL, $user_id );
- // If we have earned 20 points today decline everything else
- if ( $total >= 20 )
- return false;
- return $reply;
- // Exclude buyCred points gained regardless of the maximum points set from this snippet.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement