Last active
September 4, 2017 13:03
-
-
Save gabrielmerovingi/00b2be3a7afd56b2f16c5f339bd9e397 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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