myCRED - Version 1.7.7

Version Description

Important bug fixes.

=

Download this release

Release Info

Developer designbymerovingi
Plugin Icon 128x128 myCRED
Version 1.7.7
Comparing to
See all releases

Code changes from version 1.7.6 to 1.7.7

addons/badges/includes/mycred-badge-functions.php CHANGED
@@ -698,7 +698,7 @@ endif;
698
  * Display Users Badges
699
  * Will echo all badge images a given user has earned.
700
  * @since 1.5
701
- * @version 1.3.1
702
  */
703
  if ( ! function_exists( 'mycred_display_users_badges' ) ) :
704
  function mycred_display_users_badges( $user_id = NULL, $width = MYCRED_BADGE_WIDTH, $height = MYCRED_BADGE_HEIGHT ) {
@@ -717,6 +717,8 @@ if ( ! function_exists( 'mycred_display_users_badges' ) ) :
717
  foreach ( $users_badges as $badge_id => $level ) {
718
 
719
  $badge = mycred_get_badge( $badge_id, $level );
 
 
720
  $badge->image_width = $width;
721
  $badge->image_height = $height;
722
 
698
  * Display Users Badges
699
  * Will echo all badge images a given user has earned.
700
  * @since 1.5
701
+ * @version 1.3.2
702
  */
703
  if ( ! function_exists( 'mycred_display_users_badges' ) ) :
704
  function mycred_display_users_badges( $user_id = NULL, $width = MYCRED_BADGE_WIDTH, $height = MYCRED_BADGE_HEIGHT ) {
717
  foreach ( $users_badges as $badge_id => $level ) {
718
 
719
  $badge = mycred_get_badge( $badge_id, $level );
720
+ if ( $badge === false ) continue;
721
+
722
  $badge->image_width = $width;
723
  $badge->image_height = $height;
724
 
addons/coupons/includes/mycred-coupon-functions.php CHANGED
@@ -385,19 +385,19 @@ endif;
385
  * Translates a coupon error code into a readable message.
386
  * we ran into issues.
387
  * @since 1.7.5
388
- * @version 1.0
389
  */
390
  if ( ! function_exists( 'mycred_get_coupon_error_message' ) ) :
391
  function mycred_get_coupon_error_message( $code = '', $coupon = NULL ) {
392
 
393
- $message = __( 'An unknown error occurred. Coupon not used.', 'mycred' );
394
 
395
  if ( ! is_object( $coupon ) ) return $message;
396
 
397
- global $mycred;
398
 
399
- if ( array_key_exists( $code, $mycred->coupons ) )
400
- $message = $mycred->coupons[ $code ];
401
 
402
  if ( $code == 'min' ) {
403
 
385
  * Translates a coupon error code into a readable message.
386
  * we ran into issues.
387
  * @since 1.7.5
388
+ * @version 1.0.1
389
  */
390
  if ( ! function_exists( 'mycred_get_coupon_error_message' ) ) :
391
  function mycred_get_coupon_error_message( $code = '', $coupon = NULL ) {
392
 
393
+ $message = __( 'An unknown error occurred. Coupon not used.', 'mycred' );
394
 
395
  if ( ! is_object( $coupon ) ) return $message;
396
 
397
+ $settings = mycred_get_addon_settings( 'coupons' );
398
 
399
+ if ( array_key_exists( $code, $settings ) )
400
+ $message = $settings[ $code ];
401
 
402
  if ( $code == 'min' ) {
403
 
addons/coupons/myCRED-addon-coupons.php CHANGED
@@ -274,7 +274,7 @@ if ( ! class_exists( 'myCRED_Coupons_Module' ) ) :
274
 
275
  $value = mycred_get_coupon_value( $post_id );
276
  if ( empty( $value ) ) $value = 0;
277
-
278
  echo $mycred->format_creds( $value );
279
 
280
  break;
274
 
275
  $value = mycred_get_coupon_value( $post_id );
276
  if ( empty( $value ) ) $value = 0;
277
+
278
  echo $mycred->format_creds( $value );
279
 
280
  break;
addons/gateway/carts/mycred-woocommerce.php CHANGED
@@ -592,7 +592,7 @@ add_filter( 'woocommerce_currencies', 'mycred_woo_add_currency' );
592
  * Currency Symbol
593
  * Appends the myCRED prefix or suffix to the amount.
594
  * @since 0.1
595
- * @version 1.2
596
  */
597
  if ( ! function_exists( 'mycred_woo_currency_symbol' ) ) :
598
  function mycred_woo_currency_symbol( $currency_symbols ) {
@@ -608,6 +608,9 @@ if ( ! function_exists( 'mycred_woo_currency_symbol' ) ) :
608
  elseif ( ! empty( $mycred->before ) )
609
  $symbol = $mycred->before;
610
 
 
 
 
611
  $currency_symbols[ $type_id ] = $symbol;
612
 
613
  }
@@ -617,7 +620,7 @@ if ( ! function_exists( 'mycred_woo_currency_symbol' ) ) :
617
 
618
  }
619
  endif;
620
- add_filter( 'woocommerce_currency_symbols', 'mycred_woo_currency_symbol', 10, 2 );
621
 
622
  /**
623
  * Log Entry: Payment
592
  * Currency Symbol
593
  * Appends the myCRED prefix or suffix to the amount.
594
  * @since 0.1
595
+ * @version 1.2.1
596
  */
597
  if ( ! function_exists( 'mycred_woo_currency_symbol' ) ) :
598
  function mycred_woo_currency_symbol( $currency_symbols ) {
608
  elseif ( ! empty( $mycred->before ) )
609
  $symbol = $mycred->before;
610
 
611
+ if ( $type_id == 'mycred_default' )
612
+ $type_id = 'MYC';
613
+
614
  $currency_symbols[ $type_id ] = $symbol;
615
 
616
  }
620
 
621
  }
622
  endif;
623
+ add_filter( 'woocommerce_currency_symbols', 'mycred_woo_currency_symbol' );
624
 
625
  /**
626
  * Log Entry: Payment
addons/sell-content/includes/mycred-sell-functions.php CHANGED
@@ -172,7 +172,7 @@ endif;
172
  * Post is for Sale
173
  * Returns true (post is for sale) or false (post is not for sale).
174
  * @since 1.7
175
- * @version 1.0
176
  */
177
  if ( ! function_exists( 'mycred_post_is_for_sale' ) ) :
178
  function mycred_post_is_for_sale( $post = NULL ) {
@@ -188,7 +188,7 @@ if ( ! function_exists( 'mycred_post_is_for_sale' ) ) :
188
  $for_sale = false;
189
 
190
  // We start with checking the post type.
191
- if ( mycred_post_type_for_sale( $post->post_type ) ) {
192
 
193
  $filter = $settings['filters'][ $post->post_type ]['by'];
194
  $list = explode( ',', $settings['filters'][ $post->post_type ]['list'] );
172
  * Post is for Sale
173
  * Returns true (post is for sale) or false (post is not for sale).
174
  * @since 1.7
175
+ * @version 1.0.1
176
  */
177
  if ( ! function_exists( 'mycred_post_is_for_sale' ) ) :
178
  function mycred_post_is_for_sale( $post = NULL ) {
188
  $for_sale = false;
189
 
190
  // We start with checking the post type.
191
+ if ( mycred_post_type_for_sale( $post->post_type ) && array_key_exists( $post->post_type, $settings['filters'] ) ) {
192
 
193
  $filter = $settings['filters'][ $post->post_type ]['by'];
194
  $list = explode( ',', $settings['filters'][ $post->post_type ]['list'] );
addons/sell-content/myCRED-addon-sell-content.php CHANGED
@@ -42,8 +42,8 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
42
  'working' => 'Processing ...',
43
  'templates' => array(
44
  'members' => '<div class="text-center"><h3>Premium Content</h3><p>Buy access to this content.</p><p>%buy_button%</p></div>',
45
- 'visitors' => '<div class="text-center"><h3>Premium Content</h3><p>Buy access to this content.</p><p><strong>Insufficient Funds</strong></p></div>',
46
- 'cantafford' => '<div class="text-center"><h3>Premium Content</h3><p>Login to buy access to this content.</p></div>'
47
  )
48
  ),
49
  'add_to_core' => true
@@ -122,7 +122,7 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
122
  'mycred-sell-this',
123
  plugins_url( 'assets/js/buy-content.js', myCRED_SELL ),
124
  array( 'jquery' ),
125
- '1.2',
126
  true
127
  );
128
 
@@ -131,7 +131,7 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
131
  /**
132
  * Load Script
133
  * @since 1.7
134
- * @version 1.0.1
135
  */
136
  public function enqueue_footer() {
137
 
@@ -146,10 +146,10 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
146
  'mycred-sell-this',
147
  'myCREDBuyContent',
148
  array(
149
- 'ajaxurl' => esc_url( get_permalink( $post->ID ) ),
150
- 'token' => wp_create_nonce( 'mycred-buy-this-content' ),
151
- 'working' => esc_js( $this->sell_content['working'] ),
152
- 'reload' => $this->sell_content['reload'],
153
  'sweeterror' => __( 'Error', 'mycred' )
154
  )
155
  );
@@ -170,6 +170,10 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
170
  */
171
  public function template_redirect() {
172
 
 
 
 
 
173
  // Handle purhchase requests
174
  $this->maybe_buy_content();
175
 
@@ -258,8 +262,6 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
258
 
259
  global $mycred_partial_content_sale, $mycred_sell_this;
260
 
261
- $mycred_partial_content_sale = false;
262
-
263
  $post_id = mycred_sell_content_post_id();
264
  $post = get_post( $post_id );
265
 
@@ -268,12 +270,12 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
268
 
269
  $mycred_sell_this = true;
270
 
271
- // Parse shortcodes now to see if mycred_sell_this has been used
272
- $content = do_shortcode( $content );
273
 
274
  // Partial Content Sale - We have already done the work in the shortcode
275
  if ( $mycred_partial_content_sale === true )
276
- return $content;
277
 
278
  // Logged in users
279
  if ( is_user_logged_in() ) {
42
  'working' => 'Processing ...',
43
  'templates' => array(
44
  'members' => '<div class="text-center"><h3>Premium Content</h3><p>Buy access to this content.</p><p>%buy_button%</p></div>',
45
+ 'visitors' => '<div class="text-center"><h3>Premium Content</h3><p>Login to buy access to this content.</p></div>',
46
+ 'cantafford' => '<div class="text-center"><h3>Premium Content</h3><p>Buy access to this content.</p><p><strong>Insufficient Funds</strong></p></div>'
47
  )
48
  ),
49
  'add_to_core' => true
122
  'mycred-sell-this',
123
  plugins_url( 'assets/js/buy-content.js', myCRED_SELL ),
124
  array( 'jquery' ),
125
+ '1.2.1',
126
  true
127
  );
128
 
131
  /**
132
  * Load Script
133
  * @since 1.7
134
+ * @version 1.0.2
135
  */
136
  public function enqueue_footer() {
137
 
146
  'mycred-sell-this',
147
  'myCREDBuyContent',
148
  array(
149
+ 'ajaxurl' => esc_url( ( isset( $post->ID ) ) ? get_permalink( $post->ID ) : home_url( '/' ) ),
150
+ 'token' => wp_create_nonce( 'mycred-buy-this-content' ),
151
+ 'working' => esc_js( $this->sell_content['working'] ),
152
+ 'reload' => $this->sell_content['reload'],
153
  'sweeterror' => __( 'Error', 'mycred' )
154
  )
155
  );
170
  */
171
  public function template_redirect() {
172
 
173
+ global $mycred_partial_content_sale;
174
+
175
+ $mycred_partial_content_sale = false;
176
+
177
  // Handle purhchase requests
178
  $this->maybe_buy_content();
179
 
262
 
263
  global $mycred_partial_content_sale, $mycred_sell_this;
264
 
 
 
265
  $post_id = mycred_sell_content_post_id();
266
  $post = get_post( $post_id );
267
 
270
 
271
  $mycred_sell_this = true;
272
 
273
+ // Parse shortcodes now just in case it has not been done already
274
+ $_content = do_shortcode( $content );
275
 
276
  // Partial Content Sale - We have already done the work in the shortcode
277
  if ( $mycred_partial_content_sale === true )
278
+ return $_content;
279
 
280
  // Logged in users
281
  if ( is_user_logged_in() ) {
addons/stats/widgets/mycred-stats-widget-circulation.php CHANGED
@@ -34,16 +34,16 @@ if ( ! class_exists( 'myCRED_Stats_Widget_Circulation' ) ) :
34
 
35
  $series = $totals = array();
36
  $all = 0;
37
-
38
  foreach ( $point_types as $type_id => $label ) {
39
 
40
  $mycred = mycred( $type_id );
41
  $total = $wpdb->get_var( $wpdb->prepare( "SELECT SUM( meta_value ) FROM {$wpdb->usermeta} WHERE meta_key = %s;", $type_id ) );
42
  if ( $total === NULL ) $total = 0;
43
 
44
- $totals[] = '<strong>' . sprintf( __( 'Total %s:', 'mycred' ), $this->ctypes[ $type_id ] ) . '</strong> <span style="color:' . $this->colors[ $type_id ] . '">' . $mycred->format_creds( $total ) . '</span>';
45
  $all = $all + $total;
46
- $series[] = "{ value: " . $total . ", color: '" . $this->colors[ $type_id ] . "', highlight: '" . $this->colors[ $type_id ] . "', label: '" . esc_attr( $label ) . "' }";
47
 
48
  }
49
 
@@ -167,11 +167,10 @@ if ( ! class_exists( 'myCRED_Stats_Widget_Circulation' ) ) :
167
  $gains_p = number_format( ( ( $gains / $total ) * 100 ), 0 );
168
  $gains_l = number_format( ( 100 - $gains_p ), 0 );
169
 
170
- $color = $gain_color = $this->colors[ $this->args['ctypes'] ];
171
  $circulation['series'][] = "{ value: {$gains_p}, color: '" . $color . "', highlight: '" . $color . "', label: '" . esc_attr__( 'Total gains (%)', 'mycred' ) . "' }";
172
 
173
-
174
- $color = $lose_color = mycred_inverse_rgb_color( $this->colors[ $this->args['ctypes'] ] );
175
  $circulation['series'][] = "{ value: {$gains_l}, color: '" . $color . "', highlight: '" . $color . "', label: '" . esc_attr__( 'Total loses (%)', 'mycred' ) . "' }";
176
 
177
  //
@@ -212,7 +211,7 @@ if ( ! class_exists( 'myCRED_Stats_Widget_Circulation' ) ) :
212
  $mycred = mycred( $type_id );
213
 
214
  ?>
215
- <tr style="color: <?php echo $this->colors[ $type_id ]; ?>;">
216
  <td class="rowtitle"><?php echo $this->ctypes[ $type_id ]; ?></td>
217
  <?php
218
 
@@ -298,11 +297,11 @@ jQuery(function($) {
298
  $gains_l = number_format( ( 100 - $gains_p ), 0 );
299
  }
300
 
301
- $color = $gain_color = $this->colors[ $this->args['ctypes'] ];
302
  $circulation['series'][] = "{ value: {$gains_p}, color: '" . $color . "', highlight: '" . $color . "', label: '" . esc_attr__( 'Total gains (%)', 'mycred' ) . "' }";
303
 
304
 
305
- $color = $lose_color = mycred_inverse_rgb_color( $this->colors[ $this->args['ctypes'] ] );
306
  $circulation['series'][] = "{ value: {$gains_l}, color: '" . $color . "', highlight: '" . $color . "', label: '" . esc_attr__( 'Total loses (%)', 'mycred' ) . "' }";
307
 
308
  ?>
@@ -343,7 +342,7 @@ jQuery(function($) {
343
  $mycred = mycred( $type_id );
344
 
345
  ?>
346
- <tr style="color: <?php echo $this->colors[ $type_id ]; ?>;">
347
  <td class="rowtitle"><?php echo $this->ctypes[ $type_id ]; ?></td>
348
  <?php
349
 
34
 
35
  $series = $totals = array();
36
  $all = 0;
37
+
38
  foreach ( $point_types as $type_id => $label ) {
39
 
40
  $mycred = mycred( $type_id );
41
  $total = $wpdb->get_var( $wpdb->prepare( "SELECT SUM( meta_value ) FROM {$wpdb->usermeta} WHERE meta_key = %s;", $type_id ) );
42
  if ( $total === NULL ) $total = 0;
43
 
44
+ $totals[] = '<strong>' . sprintf( __( 'Total %s:', 'mycred' ), $this->ctypes[ $type_id ] ) . '</strong> <span style="color:' . $this->colors[ $type_id ]['positive'] . '">' . $mycred->format_creds( $total ) . '</span>';
45
  $all = $all + $total;
46
+ $series[] = "{ value: " . $total . ", color: '" . $this->colors[ $type_id ]['positive'] . "', highlight: '" . $this->colors[ $type_id ]['negative'] . "', label: '" . esc_attr( $label ) . "' }";
47
 
48
  }
49
 
167
  $gains_p = number_format( ( ( $gains / $total ) * 100 ), 0 );
168
  $gains_l = number_format( ( 100 - $gains_p ), 0 );
169
 
170
+ $color = $gain_color = $this->colors[ $this->args['ctypes'] ]['positive'];
171
  $circulation['series'][] = "{ value: {$gains_p}, color: '" . $color . "', highlight: '" . $color . "', label: '" . esc_attr__( 'Total gains (%)', 'mycred' ) . "' }";
172
 
173
+ $color = $lose_color = $this->colors[ $this->args['ctypes'] ]['positive'];
 
174
  $circulation['series'][] = "{ value: {$gains_l}, color: '" . $color . "', highlight: '" . $color . "', label: '" . esc_attr__( 'Total loses (%)', 'mycred' ) . "' }";
175
 
176
  //
211
  $mycred = mycred( $type_id );
212
 
213
  ?>
214
+ <tr style="color: <?php echo $this->colors[ $type_id ]['positive']; ?>;">
215
  <td class="rowtitle"><?php echo $this->ctypes[ $type_id ]; ?></td>
216
  <?php
217
 
297
  $gains_l = number_format( ( 100 - $gains_p ), 0 );
298
  }
299
 
300
+ $color = $gain_color = $this->colors[ $this->args['ctypes'] ]['positive'];
301
  $circulation['series'][] = "{ value: {$gains_p}, color: '" . $color . "', highlight: '" . $color . "', label: '" . esc_attr__( 'Total gains (%)', 'mycred' ) . "' }";
302
 
303
 
304
+ $color = $lose_color = $this->colors[ $this->args['ctypes'] ]['negative'];
305
  $circulation['series'][] = "{ value: {$gains_l}, color: '" . $color . "', highlight: '" . $color . "', label: '" . esc_attr__( 'Total loses (%)', 'mycred' ) . "' }";
306
 
307
  ?>
342
  $mycred = mycred( $type_id );
343
 
344
  ?>
345
+ <tr style="color: <?php echo $this->colors[ $type_id ]['positive']; ?>;">
346
  <td class="rowtitle"><?php echo $this->ctypes[ $type_id ]; ?></td>
347
  <?php
348
 
addons/stats/widgets/mycred-stats-widget-daily-gains.php CHANGED
@@ -98,7 +98,7 @@ if ( ! class_exists( 'myCRED_Stats_Widget_Daily_Gains' ) ) :
98
  }
99
 
100
  $mycred = mycred( $type_id );
101
- $series[] = "{ label : '" . esc_js( $mycred->plural() ) . "', fillColor : '" . str_replace( ',1)', ',0.3)', $this->colors[ $type_id ] ) . "', strokeColor : '" . $this->colors[ $type_id ] . "', pointColor : '" . $this->colors[ $type_id ] . "', data : [" . implode( ', ', $values ) . "] }";
102
 
103
  }
104
 
@@ -147,7 +147,7 @@ if ( ! class_exists( 'myCRED_Stats_Widget_Daily_Gains' ) ) :
147
 
148
  ?>
149
  <li>
150
- <strong style="color:<?php echo $this->colors[ $item->type ]; ?>;"><?php echo $label; ?></strong>
151
  <span class="view"><a href="<?php echo esc_url( $url ); ?>"><?php _e( 'View', 'mycred' ); ?></a></span>
152
  <ul>
153
  <li><?php echo number_format( $item->total, 0, '.', ' ' ); ?></li>
98
  }
99
 
100
  $mycred = mycred( $type_id );
101
+ $series[] = "{ label : '" . esc_js( $mycred->plural() ) . "', fillColor : '" . str_replace( ',1)', ',0.3)', $this->colors[ $type_id ]['positive'] ) . "', strokeColor : '" . $this->colors[ $type_id ]['positive'] . "', pointColor : '" . $this->colors[ $type_id ]['positive'] . "', data : [" . implode( ', ', $values ) . "] }";
102
 
103
  }
104
 
147
 
148
  ?>
149
  <li>
150
+ <strong style="color:<?php echo $this->colors[ $item->type ]['positive']; ?>;"><?php echo $label; ?></strong>
151
  <span class="view"><a href="<?php echo esc_url( $url ); ?>"><?php _e( 'View', 'mycred' ); ?></a></span>
152
  <ul>
153
  <li><?php echo number_format( $item->total, 0, '.', ' ' ); ?></li>
addons/stats/widgets/mycred-stats-widget-daily-loses.php CHANGED
@@ -98,7 +98,7 @@ if ( ! class_exists( 'myCRED_Stats_Widget_Daily_Loses' ) ) :
98
  }
99
 
100
  $mycred = mycred( $type_id );
101
- $series[] = "{ label : '" . esc_js( $mycred->plural() ) . "', fillColor : '" . str_replace( ',1)', ',0.3)', $this->colors[ $type_id ] ) . "', strokeColor : '" . $this->colors[ $type_id ] . "', pointColor : '" . $this->colors[ $type_id ] . "', data : [" . implode( ', ', $values ) . "] }";
102
 
103
  }
104
 
@@ -147,7 +147,7 @@ if ( ! class_exists( 'myCRED_Stats_Widget_Daily_Loses' ) ) :
147
 
148
  ?>
149
  <li>
150
- <strong style="color:<?php echo $this->colors[ $item->type ]; ?>;"><?php echo $label; ?></strong>
151
  <span class="view"><a href="<?php echo esc_url( $url ); ?>"><?php _e( 'View', 'mycred' ); ?></a></span>
152
  <ul>
153
  <li><?php echo number_format( $item->total, 0, '.', ' ' ); ?></li>
98
  }
99
 
100
  $mycred = mycred( $type_id );
101
+ $series[] = "{ label : '" . esc_js( $mycred->plural() ) . "', fillColor : '" . str_replace( ',1)', ',0.3)', $this->colors[ $type_id ]['negative'] ) . "', strokeColor : '" . $this->colors[ $type_id ]['negative'] . "', pointColor : '" . $this->colors[ $type_id ]['negative'] . "', data : [" . implode( ', ', $values ) . "] }";
102
 
103
  }
104
 
147
 
148
  ?>
149
  <li>
150
+ <strong style="color:<?php echo $this->colors[ $item->type ]['negative']; ?>;"><?php echo $label; ?></strong>
151
  <span class="view"><a href="<?php echo esc_url( $url ); ?>"><?php _e( 'View', 'mycred' ); ?></a></span>
152
  <ul>
153
  <li><?php echo number_format( $item->total, 0, '.', ' ' ); ?></li>
addons/transfer/includes/mycred-transfer-functions.php CHANGED
@@ -11,7 +11,7 @@ if ( ! defined( 'myCRED_VERSION' ) ) exit;
11
  * @filter 'mycred_transfer_limit'
12
  * @filter 'mycred_transfer_acc_limit'
13
  * @since 0.1
14
- * @version 1.4
15
  */
16
  if ( ! function_exists( 'mycred_user_can_transfer' ) ) :
17
  function mycred_user_can_transfer( $user_id = NULL, $amount = NULL, $type = MYCRED_DEFAULT_TYPE_KEY, $reference = NULL ) {
@@ -25,20 +25,16 @@ if ( ! function_exists( 'mycred_user_can_transfer' ) ) :
25
  if ( ! mycred_point_type_exists( $type ) )
26
  $type = MYCRED_DEFAULT_TYPE_KEY;
27
 
28
- // Grab Settings (from main type where the settings are saved)
29
- $mycred = mycred();
30
- $settings = $mycred->transfers;
31
-
32
- if ( $type !== MYCRED_DEFAULT_TYPE_KEY )
33
- $mycred = mycred( $type );
34
-
35
  $zero = $mycred->zero();
36
 
37
  // Get users balance
38
  $balance = $mycred->get_users_balance( $user_id, $type );
39
 
40
  // Get Transfer Max
41
- $max = apply_filters( 'mycred_transfer_limit', $mycred->number( $settings['limit']['amount'] ), $user_id, $amount, $settings, $reference );
42
 
43
  // If an amount is given, deduct this amount to see if the transaction
44
  // brings us over the account limit
@@ -104,7 +100,7 @@ endif;
104
  /**
105
  * New Transfer
106
  * @since 1.7.6
107
- * @version 1.0
108
  */
109
  if ( ! function_exists( 'mycred_new_transfer' ) ) :
110
  function mycred_new_transfer( $request = array() ) {
@@ -124,10 +120,8 @@ if ( ! function_exists( 'mycred_new_transfer' ) ) :
124
 
125
  if ( $transaction_id === NULL || $sender_id === NULL || $recipient_id === NULL || $charge === NULL || $payout === NULL ) return 'error_9';
126
 
127
- global $mycred;
128
-
129
  $point_type = sanitize_key( $point_type );
130
- $settings = $mycred->transfers;
131
  $mycred = mycred( $point_type );
132
 
133
  $result = 'error_9';
11
  * @filter 'mycred_transfer_limit'
12
  * @filter 'mycred_transfer_acc_limit'
13
  * @since 0.1
14
+ * @version 1.4.1
15
  */
16
  if ( ! function_exists( 'mycred_user_can_transfer' ) ) :
17
  function mycred_user_can_transfer( $user_id = NULL, $amount = NULL, $type = MYCRED_DEFAULT_TYPE_KEY, $reference = NULL ) {
25
  if ( ! mycred_point_type_exists( $type ) )
26
  $type = MYCRED_DEFAULT_TYPE_KEY;
27
 
28
+ // Grab Settings
29
+ $settings = mycred_get_addon_settings( 'transfers' );
30
+ $mycred = mycred( $type );
 
 
 
 
31
  $zero = $mycred->zero();
32
 
33
  // Get users balance
34
  $balance = $mycred->get_users_balance( $user_id, $type );
35
 
36
  // Get Transfer Max
37
+ $max = apply_filters( 'mycred_transfer_limit', $mycred->number( $settings['limit']['amount'] ), $user_id, $amount, $settings, $reference );
38
 
39
  // If an amount is given, deduct this amount to see if the transaction
40
  // brings us over the account limit
100
  /**
101
  * New Transfer
102
  * @since 1.7.6
103
+ * @version 1.0.1
104
  */
105
  if ( ! function_exists( 'mycred_new_transfer' ) ) :
106
  function mycred_new_transfer( $request = array() ) {
120
 
121
  if ( $transaction_id === NULL || $sender_id === NULL || $recipient_id === NULL || $charge === NULL || $payout === NULL ) return 'error_9';
122
 
 
 
123
  $point_type = sanitize_key( $point_type );
124
+ $settings = mycred_get_addon_settings( 'transfers' );
125
  $mycred = mycred( $point_type );
126
 
127
  $result = 'error_9';
addons/transfer/includes/mycred-transfer-shortcodes.php CHANGED
@@ -6,15 +6,17 @@ if ( ! defined( 'myCRED_VERSION' ) ) exit;
6
  * Renders a transfer form that allows users to send points to other users.
7
  * @see http://mycred.me/functions/mycred_transfer_render/
8
  * @since 0.1
9
- * @version 1.7
10
  */
11
  if ( ! function_exists( 'mycred_transfer_render' ) ) :
12
  function mycred_transfer_render( $atts, $content = NULL ) {
13
 
14
- global $mycred, $mycred_do_transfer;
15
 
16
  // Settings
17
- $pref = $mycred->transfers;
 
 
18
 
19
  // Get Attributes
20
  extract( shortcode_atts( array(
@@ -33,8 +35,6 @@ if ( ! function_exists( 'mycred_transfer_render' ) ) :
33
  'message_label' => __( 'Message', 'mycred' )
34
  ), $atts ) );
35
 
36
- $output = '';
37
-
38
  if ( $ref == '' )
39
  $ref = 'transfer';
40
 
6
  * Renders a transfer form that allows users to send points to other users.
7
  * @see http://mycred.me/functions/mycred_transfer_render/
8
  * @since 0.1
9
+ * @version 1.7.2
10
  */
11
  if ( ! function_exists( 'mycred_transfer_render' ) ) :
12
  function mycred_transfer_render( $atts, $content = NULL ) {
13
 
14
+ global $mycred_do_transfer;
15
 
16
  // Settings
17
+ $mycred = mycred();
18
+ $pref = mycred_get_addon_settings( 'transfers' );
19
+ $output = '';
20
 
21
  // Get Attributes
22
  extract( shortcode_atts( array(
35
  'message_label' => __( 'Message', 'mycred' )
36
  ), $atts ) );
37
 
 
 
38
  if ( $ref == '' )
39
  $ref = 'transfer';
40
 
assets/js/mycred-edit-log.js CHANGED
@@ -3,7 +3,7 @@
3
  * These scripts are used to edit or delete entries
4
  * in the myCRED Log.
5
  * @since 1.4
6
- * @version 1.2.2
7
  */
8
  jQuery(function($) {
9
 
@@ -58,7 +58,7 @@ jQuery(function($) {
58
  */
59
  function mycred_animate_row_deletion( rowtoanimate ) {
60
 
61
- var rowtodelete = $( '#mycred-log-entry-row-' + rowtoanimate );
62
  if ( rowtodelete === undefined ) return;
63
 
64
  rowtodelete.addClass( 'deleted-row' ).fadeOut( 2000, function(){
@@ -72,7 +72,7 @@ jQuery(function($) {
72
  */
73
  function mycred_animate_row_update( newrow ) {
74
 
75
- var affectedrow = $( '#mycred-log-entry-row-' + myCREDRowId );
76
 
77
  affectedrow.addClass( 'updated-row' ).fadeOut(function(){
78
  affectedrow.empty().append( newrow ).fadeIn( 2000, function(){
@@ -297,7 +297,7 @@ jQuery(function($) {
297
 
298
  myCREDRowId = $(this).data( 'id' );
299
  myCREDReference = $(this).data( 'ref' );
300
- myCREDRow = '#mycred-log-entry-row-' + myCREDRowId;
301
 
302
  mycred_reset_editor();
303
 
3
  * These scripts are used to edit or delete entries
4
  * in the myCRED Log.
5
  * @since 1.4
6
+ * @version 1.2.3
7
  */
8
  jQuery(function($) {
9
 
58
  */
59
  function mycred_animate_row_deletion( rowtoanimate ) {
60
 
61
+ var rowtodelete = $( '#entry-' + rowtoanimate );
62
  if ( rowtodelete === undefined ) return;
63
 
64
  rowtodelete.addClass( 'deleted-row' ).fadeOut( 2000, function(){
72
  */
73
  function mycred_animate_row_update( newrow ) {
74
 
75
+ var affectedrow = $( '#entry-' + myCREDRowId );
76
 
77
  affectedrow.addClass( 'updated-row' ).fadeOut(function(){
78
  affectedrow.empty().append( newrow ).fadeIn( 2000, function(){
297
 
298
  myCREDRowId = $(this).data( 'id' );
299
  myCREDReference = $(this).data( 'ref' );
300
+ myCREDRow = '#entry-' + myCREDRowId;
301
 
302
  mycred_reset_editor();
303
 
includes/mycred-functions.php CHANGED
@@ -1407,6 +1407,34 @@ if ( ! function_exists( 'mycred_get_module' ) ) :
1407
  }
1408
  endif;
1409
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1410
  /**
1411
  * Get Post Types
1412
  * Returns an array of post types that myCRED uses.
@@ -1771,7 +1799,7 @@ endif;
1771
  /**
1772
  * Select Point Type from Checkboxes
1773
  * @since 1.4
1774
- * @version 1.0
1775
  */
1776
  if ( ! function_exists( 'mycred_types_select_from_checkboxes' ) ) :
1777
  function mycred_types_select_from_checkboxes( $name = '', $id = '', $selected_values = array(), $return = false ) {
@@ -1787,7 +1815,7 @@ if ( ! function_exists( 'mycred_types_select_from_checkboxes' ) ) :
1787
 
1788
  $id .= '-' . $type;
1789
 
1790
- $output .= '<input type="checkbox" name="' . $name . '" id="' . $id . '" value="' . $type . '"' . $selected . ' /><label for="' . $id . '">' . $label . '</label><br />';
1791
  }
1792
  }
1793
 
1407
  }
1408
  endif;
1409
 
1410
+ /**
1411
+ * Get Addon Settings
1412
+ * @since 1.7.7
1413
+ * @version 1.0
1414
+ */
1415
+ if ( ! function_exists( 'mycred_get_addon_settings' ) ) :
1416
+ function mycred_get_addon_settings( $addon = '', $point_type = MYCRED_DEFAULT_TYPE_KEY ) {
1417
+
1418
+ if ( $addon == '' ) return false;
1419
+
1420
+ $mycred = $_mycred = mycred();
1421
+ if ( $point_type != MYCRED_DEFAULT_TYPE_KEY )
1422
+ $mycred = mycred( $point_type );
1423
+
1424
+ // If we are trying to get the settings under a custom point type and it does not exists
1425
+ // try and see if it exits under the main type
1426
+ if ( ! isset( $mycred->$addon ) && $point_type != MYCRED_DEFAULT_TYPE_KEY )
1427
+ $mycred = $_mycred;
1428
+
1429
+ $settings = false;
1430
+ if ( isset( $mycred->$addon ) )
1431
+ $settings = $mycred->$addon;
1432
+
1433
+ return apply_filters( 'mycred_get_addon_settings', $settings, $addon, $point_type );
1434
+
1435
+ }
1436
+ endif;
1437
+
1438
  /**
1439
  * Get Post Types
1440
  * Returns an array of post types that myCRED uses.
1799
  /**
1800
  * Select Point Type from Checkboxes
1801
  * @since 1.4
1802
+ * @version 1.0.1
1803
  */
1804
  if ( ! function_exists( 'mycred_types_select_from_checkboxes' ) ) :
1805
  function mycred_types_select_from_checkboxes( $name = '', $id = '', $selected_values = array(), $return = false ) {
1815
 
1816
  $id .= '-' . $type;
1817
 
1818
+ $output .= '<label for="' . $id . '"><input type="checkbox" name="' . $name . '" id="' . $id . '" value="' . $type . '"' . $selected . ' /> ' . $label . '</label>';
1819
  }
1820
  }
1821
 
modules/mycred-module-hooks.php CHANGED
@@ -2744,7 +2744,7 @@ if ( ! class_exists( 'myCRED_Hook_Video_Views' ) ) :
2744
  /**
2745
  * Register Script
2746
  * @since 1.2
2747
- * @version 1.1.1
2748
  */
2749
  public function register_script() {
2750
 
@@ -2764,7 +2764,7 @@ if ( ! class_exists( 'myCRED_Hook_Video_Views' ) ) :
2764
  'mycred-video-points',
2765
  'myCRED_Video',
2766
  array(
2767
- 'ajaxurl' => esc_url( get_permalink( $post->ID ) ),
2768
  'token' => wp_create_nonce( 'mycred-video-points' ),
2769
  'default_interval' => abs( $this->prefs['interval']*1000 ),
2770
  'default_logic' => $this->prefs['logic']
2744
  /**
2745
  * Register Script
2746
  * @since 1.2
2747
+ * @version 1.1.2
2748
  */
2749
  public function register_script() {
2750
 
2764
  'mycred-video-points',
2765
  'myCRED_Video',
2766
  array(
2767
+ 'ajaxurl' => esc_url( ( isset( $post->ID ) ) ? get_permalink( $post->ID ) : home_url( '/' ) ),
2768
  'token' => wp_create_nonce( 'mycred-video-points' ),
2769
  'default_interval' => abs( $this->prefs['interval']*1000 ),
2770
  'default_logic' => $this->prefs['logic']
mycred.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: myCRED
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
- * Version: 1.7.6
7
  * Tags: points, tokens, credit, management, reward, charge, buddypress, bbpress, jetpack, woocommerce, marketpress, wp e-commerce, gravity forms, simplepress
8
  * Author: Gabriel S Merovingi
9
  * Author URI: http://www.merovingi.com
@@ -19,7 +19,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
19
  final class myCRED_Core {
20
 
21
  // Plugin Version
22
- public $version = '1.7.6';
23
 
24
  // Instnace
25
  protected static $_instance = NULL;
@@ -308,15 +308,12 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
308
  * After Themes Loaded
309
  * Used to load internal features via modules.
310
  * @since 1.7
311
- * @version 1.0
312
  */
313
  public function after_theme() {
314
 
315
  global $mycred, $mycred_modules;
316
 
317
- // In case a table was deleted, we need to add one
318
- maybe_install_mycred_table();
319
-
320
  // Lets start with Multisite
321
  if ( is_multisite() ) {
322
 
3
  * Plugin Name: myCRED
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
+ * Version: 1.7.7
7
  * Tags: points, tokens, credit, management, reward, charge, buddypress, bbpress, jetpack, woocommerce, marketpress, wp e-commerce, gravity forms, simplepress
8
  * Author: Gabriel S Merovingi
9
  * Author URI: http://www.merovingi.com
19
  final class myCRED_Core {
20
 
21
  // Plugin Version
22
+ public $version = '1.7.7';
23
 
24
  // Instnace
25
  protected static $_instance = NULL;
308
  * After Themes Loaded
309
  * Used to load internal features via modules.
310
  * @since 1.7
311
+ * @version 1.0.1
312
  */
313
  public function after_theme() {
314
 
315
  global $mycred, $mycred_modules;
316
 
 
 
 
317
  // Lets start with Multisite
318
  if ( is_multisite() ) {
319
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: designbymerovingi
3
  Tags: point, points, tokens, credit, management, reward, charge, community, contest, buddypress, jetpack, bbpress, simple press, woocommerce, wp e-commerce, contact-form-7
4
  Requires at least: 4.0
5
  Tested up to: 4.7.3
6
- Stable tag: 1.7.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -96,8 +96,8 @@ You can find a list of [frequently asked questions](https://mycred.me/about/faq/
96
 
97
  == Upgrade Notice ==
98
 
99
- = 1.7.6 =
100
- Important bug fixes and updates for all 1.7 users.
101
 
102
 
103
  == Other Notes ==
@@ -121,36 +121,18 @@ Important bug fixes and updates for all 1.7 users.
121
 
122
  == Changelog ==
123
 
124
- = 1.7.6 =
125
- NEW - Added support for transfer messages.
126
- NEW - Point rewards can now be setup for WooCommerce product variations.
127
- NEW - Import files can now identify users by: ID | email | login | slug.
128
- NEW - Added new function to check if the log table has been deleted, in which case a new one is installed.
129
- NEW - Added option to query best users without involving point types.
130
- NEW - Added support for numeric usernames for the Transfers add-on.
131
- TWEAK - All add-on settings have been updated to follow the new 1.7 styling.
132
- TWEAK - All hook settings have been given a facelift.
133
- TWEAK - Added in documentation links wherever possible.
134
- FIX - Rank promotions/demotions not getting correctly detected in email notifications.
135
- FIX - Incorrect error messages are shown in the mycred_load_coupon shortcode.
136
- FIX - mycred_my_ranks shortcode render issue.
137
- FIX - Custom payment gateway labels do not show up in buyCRED.
138
- FIX - Leaderboard issue on multisite with central logging.
139
- FIX - Add-on settings link does not open the correct tab on the settings page.
140
- FIX - Incorrect variable name causes payments to fail in Events Manager Pro.
141
- FIX - When attempting to setup the first point type, if we make a mistake the error is not shown.
142
- FIX - Incorrect call to non-static function during re-activation.
143
- FIX - Front end navigation is generating incorrect pagination links.
144
- FIX - Fixed PHP error when deleting point types.
145
- FIX - Incorrect comparisons for post author check in Sell Content add-on.
146
- FIX - Leaderboard monthly filter is not rendering a correct UNIX timestamp.
147
- FIX - Misspelled variable is passed to mycred_before_deletion and mycred_after_deletion actions.
148
- FIX - Statistics add-on tabs are not working correctly.
149
- FIX - Check-all-checkboxes in the log table in the wp-admin area is not working.
150
- FIX - When creating our first point type, not all options are saved as set.
151
- FIX - Bad query structure usage the mycred_best_user shortcode when providing multiple references or point types.
152
- FIX - Translated dates are not shown correctly when rendering the log.
153
- FIX - buyCRED gateway settings sanitisation causes PHP warning.
154
 
155
 
156
  = Previous Versions =
3
  Tags: point, points, tokens, credit, management, reward, charge, community, contest, buddypress, jetpack, bbpress, simple press, woocommerce, wp e-commerce, contact-form-7
4
  Requires at least: 4.0
5
  Tested up to: 4.7.3
6
+ Stable tag: 1.7.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
96
 
97
  == Upgrade Notice ==
98
 
99
+ = 1.7.7 =
100
+ Important bug fixes.
101
 
102
 
103
  == Other Notes ==
121
 
122
  == Changelog ==
123
 
124
+ = 1.7.7 =
125
+ FIX - When deleting a log entry it is no longer animated and visually removed.
126
+ FIX - Displaying users badges that no longer exists cause fatal error.
127
+ FIX - Video hook ajax url fails to load.
128
+ FIX - mycred_sell_this shortcode causes the entire content to be hidden.
129
+ FIX - Fixed array to string conversion error in Statistics add-on.
130
+ FIX - Currency symbol missing in WooCommerce when points is selected as the store currency.
131
+ FIX - When the Transfer add-on is set to only allow transfers of 1 custom point type and not the default point type, the transfer shortcode will show a "over limit" error.
132
+ FIX - Sell Content add-on can in certain situations produce a PHP notice until the add-ons settings are saved after an update.
133
+ TWEAK - Mixed up the member and visitor default template values.
134
+ TWEAK - The mycred_types_select_from_checkboxes() function is not rendering checkboxes and labels correctly. Also removed break line element.
135
+ NEW - Added new mycred_get_addon_settings() function to make add-on settings retrieval easier.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
 
138
  = Previous Versions =