PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.5
8.0.5 8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 All 47 releases
← All changes | includes/functions/points.php +2 -36 7.9.6 → 8.0.5 View file →
@@ -38,16 +38,10 @@
38 38 // Retrieve the user points balance from logs based on date query given
39 39 if( ( isset( $date_query['before'] ) && ! empty( $date_query['before'] ) )
40 40 || ( isset( $date_query['after'] ) && ! empty( $date_query['after'] ) ) ) {
41 41
42 - $field = 'lm0.meta_value';
43 -
44 - if ( is_gamipress_upgraded_to( '6.9.4' ) ) {
45 - $field = 'l.points';
46 - }
47 -
48 42 return absint( gamipress_query_logs( array(
49 - 'select' => 'GREATEST( IFNULL( SUM( '. $field .' ), 0 ), 0 )',
43 + 'select' => 'GREATEST( IFNULL( SUM( l.points ), 0 ), 0 )',
50 44 'get_var' => true,
51 45 'user_id' => $user_id,
52 46 'where' => array(
53 47 array(
@@ -294,16 +288,10 @@
294 288 // Retrieve the site points from logs based on date query given
295 289 if( ( isset( $date_query['before'] ) && ! empty( $date_query['before'] ) )
296 290 || ( isset( $date_query['after'] ) && ! empty( $date_query['after'] ) ) ) {
297 291
298 - $field = 'lm0.meta_value';
299 -
300 - if ( is_gamipress_upgraded_to( '6.9.4' ) ) {
301 - $field = 'l.points';
302 - }
303 -
304 292 return absint( gamipress_query_logs( array(
305 - 'select' => 'GREATEST( IFNULL( SUM( '. $field .' ), 0 ), 0 )',
293 + 'select' => 'GREATEST( IFNULL( SUM( l.points ), 0 ), 0 )',
306 294 'get_var' => true,
307 295 'where' => array(
308 296 array(
309 297 'key' => 'points',
@@ -969,14 +957,8 @@
969 957 global $post;
970 958 $points_type = $post->ID;
971 959 }
972 960
973 - // If not properly upgrade to required version fallback to compatibility function
974 - if( ! is_gamipress_upgraded_to( '1.5.1' ) ) {
975 - // gamipress_get_assigned_requirements() has backward compatibility and merge new and old results
976 - return gamipress_get_assigned_requirements( $points_type, 'points-award', $post_status );
977 - }
978 -
979 961 $cache = gamipress_get_cache( 'points_type_points_awards', array(), false );
980 962
981 963 // If result already cached, return it
982 964 if( isset( $cache[$points_type] ) && isset( $cache[$points_type][$post_status] ) ) {
@@ -1019,13 +1001,8 @@
1019 1001 * @return object|bool The post object of the points type, or false if none
1020 1002 */
1021 1003 function gamipress_get_points_award_points_type( $points_award_id = 0 ) {
1022 1004
1023 - // If not properly upgrade to required version fallback to compatibility function
1024 - if( ! is_gamipress_upgraded_to( '1.5.1' ) ) {
1025 - return gamipress_get_points_award_points_type_old( $points_award_id );
1026 - }
1027 -
1028 1005 // Grab the current post ID if no points_award_id was specified
1029 1006 if ( ! $points_award_id ) {
1030 1007 global $post;
1031 1008 $points_award_id = $post->ID;
@@ -1071,14 +1048,8 @@
1071 1048 global $post;
1072 1049 $points_type = $post->ID;
1073 1050 }
1074 1051
1075 - // If not properly upgrade to required version fallback to compatibility function
1076 - if( ! is_gamipress_upgraded_to( '1.5.1' ) ) {
1077 - // gamipress_get_assigned_requirements() has backward compatibility and merge new and old results
1078 - return gamipress_get_assigned_requirements( $points_type, 'points-deduct', $post_status );
1079 - }
1080 -
1081 1052 $cache = gamipress_get_cache( 'points_type_points_deducts', array(), false );
1082 1053
1083 1054 // If result already cached, return it
1084 1055 if( isset( $cache[$points_type] ) && isset( $cache[$points_type][$post_status] ) ) {
@@ -1120,13 +1091,8 @@
1120 1091 * @param integer $points_deduct_id The given points deduct's post ID
1121 1092 * @return object|bool The post object of the points type, or false if none
1122 1093 */
1123 1094 function gamipress_get_points_deduct_points_type( $points_deduct_id = 0 ) {
1124 -
1125 - // If not properly upgrade to required version fallback to compatibility function
1126 - if( ! is_gamipress_upgraded_to( '1.5.1' ) ) {
1127 - return gamipress_get_points_deduct_points_type_old( $points_deduct_id );
1128 - }
1129 1095
1130 1096 // Grab the current post ID if no points_award_id was specified
1131 1097 if ( ! $points_deduct_id ) {
1132 1098 global $post;