myCRED - Version 1.8.6

Version Description

Bug fixes release.

=

Download this release

Release Info

Developer wpexpertsio
Plugin Icon 128x128 myCRED
Version 1.8.6
Comparing to
See all releases

Code changes from version 1.8.5.1 to 1.8.6

addons/badges/myCRED-addon-badges.php CHANGED
@@ -407,6 +407,8 @@ if ( ! class_exists( 'myCRED_Badge_Module' ) ) :
407
  * @version 1.4
408
  */
409
  public function add_finished( $result, $request, $mycred ) {
 
 
410
 
411
  extract( $request );
412
 
407
  * @version 1.4
408
  */
409
  public function add_finished( $result, $request, $mycred ) {
410
+
411
+ if ( is_bool( $request ) ) return $result;
412
 
413
  extract( $request );
414
 
addons/buy-creds/includes/buycred-shortcodes.php CHANGED
@@ -64,6 +64,7 @@ if ( ! function_exists( 'mycred_render_buy_points' ) ) :
64
  $button_label = $mycred->template_tags_general( $button_label );
65
  $button_label = $mycred->template_tags_user( $button_label, $recipient_id );
66
 
 
67
  $args['amount'] = $amount;
68
  $args['token'] = wp_create_nonce( 'mycred-buy-creds' );
69
 
@@ -293,7 +294,6 @@ if ( ! function_exists( 'mycred_render_buy_form_points' ) ) :
293
  <div class="form-group">
294
  <input type="submit" class="button btn btn-block btn-lg" value="<?php echo $button_label; ?>" />
295
  </div>
296
- </div>
297
 
298
  </form>
299
  </div>
64
  $button_label = $mycred->template_tags_general( $button_label );
65
  $button_label = $mycred->template_tags_user( $button_label, $recipient_id );
66
 
67
+ $args['ctype'] = $ctype;
68
  $args['amount'] = $amount;
69
  $args['token'] = wp_create_nonce( 'mycred-buy-creds' );
70
 
294
  <div class="form-group">
295
  <input type="submit" class="button btn btn-block btn-lg" value="<?php echo $button_label; ?>" />
296
  </div>
 
297
 
298
  </form>
299
  </div>
addons/coupons/includes/mycred-coupon-object.php CHANGED
@@ -293,6 +293,8 @@ if ( ! class_exists( 'myCRED_Coupon' ) ) :
293
  // Ready to use coupon!
294
  if ( $can_use === true ) {
295
 
 
 
296
  // Apply Coupon
297
  $mycred->add_creds(
298
  'coupon',
293
  // Ready to use coupon!
294
  if ( $can_use === true ) {
295
 
296
+ $this->settings['log'] = str_replace( '%coupon_code%', $this->code, $this->settings['log'] );
297
+
298
  // Apply Coupon
299
  $mycred->add_creds(
300
  'coupon',
addons/email-notices/includes/mycred-email-object.php CHANGED
@@ -377,8 +377,11 @@ if ( ! class_exists( 'myCRED_Email' ) ) :
377
  $content = str_replace( '%entry%', $event['entry'], $content );
378
  $content = $mycred->template_tags_amount( $content, $event['amount'] );
379
  // to display correct user names in transfer email
380
- if($event['ref']==='transfer'){
381
  $content = $mycred->template_tags_user( $content, $event['ref_id'] );
 
 
 
382
  }else{
383
  $content = $mycred->template_tags_user( $content, $event['user_id'] );
384
  }
377
  $content = str_replace( '%entry%', $event['entry'], $content );
378
  $content = $mycred->template_tags_amount( $content, $event['amount'] );
379
  // to display correct user names in transfer email
380
+ if( $event['ref']==='transfer' ){
381
  $content = $mycred->template_tags_user( $content, $event['ref_id'] );
382
+ $content = mycred_transfer_render_message( $content, $event['data'] );
383
+ }elseif( $event['ref']==='woocommerce_payment' ){
384
+ $content = str_replace( '%order_id%', $event['ref_id'], $content );
385
  }else{
386
  $content = $mycred->template_tags_user( $content, $event['user_id'] );
387
  }
includes/mycred-functions.php CHANGED
@@ -151,7 +151,7 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
151
  /**
152
  * Default Settings
153
  * @since 1.8
154
- * @version 1.0
155
  */
156
  public function get_log_table() {
157
 
@@ -162,13 +162,20 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
162
  else
163
  $wp_prefix = $wpdb->prefix;
164
 
165
- $table_name = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $wp_prefix . 'myCRED_log' ) );
 
 
 
 
 
 
166
 
167
  if( $table_name == NULL ) {
168
  $table_name = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $wp_prefix . 'mycred_log' ) );
169
-
170
- if( $table_name == NULL )
171
  $table_name = $wp_prefix . 'myCRED_log';
 
 
172
  }
173
 
174
  if ( defined( 'MYCRED_LOG_TABLE' ) )
151
  /**
152
  * Default Settings
153
  * @since 1.8
154
+ * @version 1.2
155
  */
156
  public function get_log_table() {
157
 
162
  else
163
  $wp_prefix = $wpdb->prefix;
164
 
165
+ $table_name = wp_cache_get('mycred_log_table_name');
166
+ if( FALSE === $table_name ) {
167
+ $table_name = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $wp_prefix . 'myCRED_log' ) );
168
+ if( $table_name !== NULL ) {
169
+ wp_cache_set('mycred_log_table_name', $table_name);
170
+ }
171
+ }
172
 
173
  if( $table_name == NULL ) {
174
  $table_name = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $wp_prefix . 'mycred_log' ) );
175
+ if( $table_name == NULL ) {
 
176
  $table_name = $wp_prefix . 'myCRED_log';
177
+ }
178
+ wp_cache_set('mycred_log_table_name', $table_name);
179
  }
180
 
181
  if ( defined( 'MYCRED_LOG_TABLE' ) )
includes/shortcodes/mycred_hook_table.php CHANGED
@@ -107,16 +107,19 @@ if ( ! function_exists( 'mycred_render_shortcode_hook_table' ) ) :
107
  if ( isset( $hooks["hook_prefs"]["comments"]["limits"] ) ) {
108
  $approved_limits = $hooks["hook_prefs"]["comments"]["limits"];
109
  if( (int) $approved_limits["per_post"] > 0 && (int) $approved_limits["per_day"] > 0 ) {
110
- $limit = 'Maximum '. $approved_limits["per_post"] .' times per post and Maximum '. $approved_limits["per_day"].' times per day';
 
111
  }
112
  elseif( (int) $approved_limits["per_post"] > 0 && (int) $approved_limits["per_day"] < 1 ) {
113
- $limit = 'Maximum '. $approved_limits["per_post"] .' times per post';
 
114
  }
115
  elseif( (int) $approved_limits["per_post"] < 1 && (int) $approved_limits["per_day"] > 0 ) {
116
- $limit = 'Maximum '. $approved_limits["per_day"].' times per day';
 
117
  }
118
  else {
119
- $limit = 'No limit';
120
  }
121
  }
122
  }
107
  if ( isset( $hooks["hook_prefs"]["comments"]["limits"] ) ) {
108
  $approved_limits = $hooks["hook_prefs"]["comments"]["limits"];
109
  if( (int) $approved_limits["per_post"] > 0 && (int) $approved_limits["per_day"] > 0 ) {
110
+
111
+ $limit = sprintf( __( 'Maximum %s times per post and Maximum %s times per day', 'mycred' ), $approved_limits["per_post"], $approved_limits["per_day"] );
112
  }
113
  elseif( (int) $approved_limits["per_post"] > 0 && (int) $approved_limits["per_day"] < 1 ) {
114
+
115
+ $limit = sprintf( __( 'Maximum %s times per post', 'mycred' ), $approved_limits["per_post"] );
116
  }
117
  elseif( (int) $approved_limits["per_post"] < 1 && (int) $approved_limits["per_day"] > 0 ) {
118
+
119
+ $limit = sprintf( __( 'Maximum %s times per day', 'mycred' ), $approved_limits["per_day"] );
120
  }
121
  else {
122
+ $limit = __('No limit', 'mycred');
123
  }
124
  }
125
  }
includes/shortcodes/mycred_my_balance_converted.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
+
4
+ /**
5
+ * myCRED Shortcode: my_balance_converted
6
+ * Returns the current users balance.
7
+ * @see http://codex.mycred.me/shortcodes/mycred_my_balance_converted/
8
+ * @since 1.8.6
9
+ * @version 1.0
10
+ */
11
+ if ( ! function_exists( 'mycred_render_shortcode_my_balance_converted' ) ) :
12
+ function mycred_render_shortcode_my_balance_converted( $atts, $content = '' ) {
13
+
14
+ extract( shortcode_atts( array(
15
+ 'ctype' => MYCRED_DEFAULT_TYPE_KEY,
16
+ 'rate' => 1,
17
+ 'prefix' => '',
18
+ 'suffix' => ''
19
+ ), $atts, MYCRED_SLUG . '_my_balance_converted' ) );
20
+
21
+ $output = '';
22
+
23
+ // Not logged in
24
+ if ( ! is_user_logged_in() )
25
+ return $content;
26
+
27
+ // Get user ID
28
+ $user_id = mycred_get_user_id( get_current_user_id() );
29
+
30
+ // Make sure we have a valid point type
31
+ if ( ! mycred_point_type_exists( $ctype ) )
32
+ $ctype = MYCRED_DEFAULT_TYPE_KEY;
33
+
34
+ // Get the users myCRED account object
35
+ $account = mycred_get_account( $user_id );
36
+ if ( $account === false ) return;
37
+
38
+ // Check for exclusion
39
+ if ( empty( $account->balance ) || ! array_key_exists( $ctype, $account->balance ) || $account->balance[ $ctype ] === false ) return;
40
+
41
+ $balance = $account->balance[ $ctype ];
42
+
43
+ $output = '<div class="mycred-my-balance-converted-wrapper">';
44
+
45
+ if ( ! empty( $prefix ) )
46
+ $output .= '<span class="mycred-my-balance-converted-prefix">'.$prefix.'</span>';
47
+
48
+ if( floatval( $rate ) == 0 ) $rate = 1;
49
+
50
+ $output .= floatval( $balance->current ) * floatval( $rate );
51
+
52
+ if ( ! empty( $suffix ) )
53
+ $output .= '<span class="mycred-my-balance-converted-suffix">'.$suffix.'</span>';
54
+
55
+
56
+ $output .= '</div>';
57
+
58
+ return $output;
59
+
60
+ }
61
+ endif;
62
+ add_shortcode( MYCRED_SLUG . '_my_balance_converted', 'mycred_render_shortcode_my_balance_converted' );
mycred.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: myCRED
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
- * Version: 1.8.5.1
7
  * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
8
  * Author: myCRED
9
  * Author URI: https://mycred.me
10
  * Author Email: support@mycred.me
11
  * Requires at least: WP 4.8
12
- * Tested up to: WP 5.2.3
13
  * Text Domain: mycred
14
  * Domain Path: /lang
15
  * License: GPLv2 or later
@@ -19,7 +19,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
19
  final class myCRED_Core {
20
 
21
  // Plugin Version
22
- public $version = '1.8.5.1';
23
 
24
  // Instnace
25
  protected static $_instance = NULL;
@@ -463,6 +463,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
463
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_send.php' );
464
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_show_if.php' );
465
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_total_balance.php' );
 
466
 
467
  // These shortcodes will not work if logging is disabled
468
  if ( MYCRED_ENABLE_LOGGING ) {
3
  * Plugin Name: myCRED
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
+ * Version: 1.8.6
7
  * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
8
  * Author: myCRED
9
  * Author URI: https://mycred.me
10
  * Author Email: support@mycred.me
11
  * Requires at least: WP 4.8
12
+ * Tested up to: WP 5.2.4
13
  * Text Domain: mycred
14
  * Domain Path: /lang
15
  * License: GPLv2 or later
19
  final class myCRED_Core {
20
 
21
  // Plugin Version
22
+ public $version = '1.8.6';
23
 
24
  // Instnace
25
  protected static $_instance = NULL;
463
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_send.php' );
464
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_show_if.php' );
465
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_total_balance.php' );
466
+ $this->file( myCRED_SHORTCODES_DIR . 'mycred_my_balance_converted.php' );
467
 
468
  // These shortcodes will not work if logging is disabled
469
  if ( MYCRED_ENABLE_LOGGING ) {
readme.txt CHANGED
@@ -2,8 +2,9 @@
2
  Contributors: mycred,wpexpertsio
3
  Tags: point, credit, loyalty program, engagement, reward
4
  Requires at least: 4.8
5
- Tested up to: 5.2.3
6
- Stable tag: 1.8.5.1
 
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -118,6 +119,9 @@ Bug fixes release.
118
  = 1.8.5.1 =
119
  Bug fixes release.
120
 
 
 
 
121
 
122
  == Other Notes ==
123
 
@@ -140,6 +144,17 @@ Bug fixes release.
140
 
141
  == Changelog ==
142
 
 
 
 
 
 
 
 
 
 
 
 
143
  = 1.8.5.1 =
144
  FIX - myCRED Statistics add-on related shortcodes.
145
  FIX - myCRED Leaderbard cache issue.
2
  Contributors: mycred,wpexpertsio
3
  Tags: point, credit, loyalty program, engagement, reward
4
  Requires at least: 4.8
5
+ Tested up to: 5.3
6
+ Stable tag: 1.8.6
7
+ Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
119
  = 1.8.5.1 =
120
  Bug fixes release.
121
 
122
+ = 1.8.6 =
123
+ Bug fixes release.
124
+
125
 
126
  == Other Notes ==
127
 
144
 
145
  == Changelog ==
146
 
147
+ = 1.8.6 =
148
+ NEW - Introduce a new shortcode [mycred_my_balance_converted].
149
+ NEW - Introduce a new template tag %coupon_code%.
150
+ TWEAK - Avoid duplicate database calls in get_log_table().
151
+ TWEAK - Language support in [mycred_hook_table] shortcode.
152
+ FIX - [mycred_buy] shortcode always get default point type settings.
153
+ FIX - HTML format issue in [mycred_buy_form] shortcode.
154
+ FIX - Remove badge related PHP warnings.
155
+ FIX - %order_id% template tag does not render in myCRED email.
156
+ FIX - %transfer_message% template tag does not render in myCRED email.
157
+
158
  = 1.8.5.1 =
159
  FIX - myCRED Statistics add-on related shortcodes.
160
  FIX - myCRED Leaderbard cache issue.