Skip to content

Instantly share code, notes, and snippets.

@gabrielmerovingi
Last active September 4, 2017 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielmerovingi/00b2be3a7afd56b2f16c5f339bd9e397 to your computer and use it in GitHub Desktop.
Save gabrielmerovingi/00b2be3a7afd56b2f16c5f339bd9e397 to your computer and use it in GitHub Desktop.
function mycred_pro_timeframe_total_balance( $query, $atts ) {
if ( ! empty( $atts ) && array_key_exists( 'based_on', $atts ) && $atts['based_on'] == 'balance' ) {
if ( array_key_exists( 'total', $atts ) && $atts['total'] == 1 && array_key_exists( 'timeframe', $atts ) && $atts['timeframe'] != '' )
$query = str_replace( "l.ref = 'manual' ) )", "l.ref = 'manual' ) ) AND time >= " . strtotime( $atts['timeframe'], current_time( 'timestamp' ) ), $query );
}
return $query;
}
add_filter( 'mycred_ranking_sql', 'mycred_pro_timeframe_total_balance', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment