myCRED - Version 1.8.12

Version Description

Bug fixes release.

=

Download this release

Release Info

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

Code changes from version 1.8.11 to 1.8.12

addons/badges/includes/mycred-badge-object.php CHANGED
@@ -706,8 +706,9 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
706
  if ( $image_identification === false || strlen( $image_identification ) == 0 ) return false;
707
 
708
  $image_url = $image_identification;
 
709
  if ( is_numeric( $image_identification ) && strpos( '://', (string) $image_identification ) === false )
710
- $image_url = wp_get_attachment_url( $image_identification );
711
 
712
  $image_width = ( $this->image_width !== false ) ? ' width="' . esc_attr( $this->image_width ) . '"' : '';
713
  $image_height = ( $this->image_height !== false ) ? ' height="' . esc_attr( $this->image_height ) . '"' : '';
706
  if ( $image_identification === false || strlen( $image_identification ) == 0 ) return false;
707
 
708
  $image_url = $image_identification;
709
+
710
  if ( is_numeric( $image_identification ) && strpos( '://', (string) $image_identification ) === false )
711
+ $image_url = mycred_get_attachment_url( $image_identification );
712
 
713
  $image_width = ( $this->image_width !== false ) ? ' width="' . esc_attr( $this->image_width ) . '"' : '';
714
  $image_height = ( $this->image_height !== false ) ? ' height="' . esc_attr( $this->image_height ) . '"' : '';
addons/buy-creds/abstracts/mycred-abstract-payment-gateway.php CHANGED
@@ -231,7 +231,7 @@ if ( ! class_exists( 'myCRED_Payment_Gateway' ) ) :
231
  $this->point_type
232
  ) );
233
 
234
- $this->transaction_id = mycred_get_the_title( $this->post_id );
235
 
236
  }
237
 
@@ -876,7 +876,11 @@ if ( ! class_exists( 'myCRED_Payment_Gateway' ) ) :
876
  * @since 1.3.2
877
  * @version 1.2
878
  */
879
- public function get_cost( $amount = 0, $point_type = MYCRED_DEFAULT_TYPE_KEY, $raw = false ) {
 
 
 
 
880
 
881
  $setup = mycred_get_buycred_sale_setup( $point_type );
882
 
@@ -891,6 +895,8 @@ if ( ! class_exists( 'myCRED_Payment_Gateway' ) ) :
891
  $override = mycred_get_user_meta( $this->current_user_id, 'mycred_buycred_rates_' . $point_type, '', true );
892
  if ( isset( $override[ $this->id ] ) && $override[ $this->id ] != '' )
893
  $rate = $override[ $this->id ];
 
 
894
  else
895
  $rate = $this->prefs['exchange'][ $point_type ];
896
 
231
  $this->point_type
232
  ) );
233
 
234
+ $this->transaction_id = get_the_title( $this->post_id );
235
 
236
  }
237
 
876
  * @since 1.3.2
877
  * @version 1.2
878
  */
879
+ public function get_cost( $amount = 0, $point_type = MYCRED_DEFAULT_TYPE_KEY, $raw = false, $custom_rate = 0 ) {
880
+
881
+ if(isset($_REQUEST['er_random']) && !empty($_REQUEST['er_random'])){
882
+ $custom_rate=base64_decode($_REQUEST['er_random']);
883
+ }
884
 
885
  $setup = mycred_get_buycred_sale_setup( $point_type );
886
 
895
  $override = mycred_get_user_meta( $this->current_user_id, 'mycred_buycred_rates_' . $point_type, '', true );
896
  if ( isset( $override[ $this->id ] ) && $override[ $this->id ] != '' )
897
  $rate = $override[ $this->id ];
898
+ else if($custom_rate !=0 )
899
+ $rate = $custom_rate;
900
  else
901
  $rate = $this->prefs['exchange'][ $point_type ];
902
 
addons/buy-creds/assets/js/checkout.js CHANGED
@@ -109,7 +109,7 @@ console.log( formdata );
109
 
110
  $(this).attr( 'disabled', 'disabled' ).html( buyCRED.redirecting );
111
 
112
- if ( $('.myCRED-buy-form').hasClass('BitPay') ) {
113
  window.location = buttonvalue;
114
  }
115
  else
109
 
110
  $(this).attr( 'disabled', 'disabled' ).html( buyCRED.redirecting );
111
 
112
+ if ( $(this).hasClass('bitpay') ) {
113
  window.location = buttonvalue;
114
  }
115
  else
addons/buy-creds/includes/buycred-functions.php CHANGED
@@ -633,7 +633,7 @@ if ( ! function_exists( 'buycred_trash_pending_payment' ) ) :
633
 
634
  mycred_delete_user_meta( $pending_payment->buyer_id, 'buycred_pending_payments' );
635
 
636
- return mycred_trash_post( $pending_payment->payment_id );
637
 
638
  }
639
  endif;
633
 
634
  mycred_delete_user_meta( $pending_payment->buyer_id, 'buycred_pending_payments' );
635
 
636
+ return wp_trash_post( $pending_payment->payment_id );
637
 
638
  }
639
  endif;
addons/buy-creds/includes/buycred-shortcodes.php CHANGED
@@ -106,6 +106,7 @@ if ( ! function_exists( 'mycred_render_buy_form_points' ) ) :
106
  'excluded' => '',
107
  'maxed' => '',
108
  'gift_to' => '',
 
109
  'gift_by' => __( 'Username', 'mycred' ),
110
  'inline' => 0
111
  ), $atts, MYCRED_SLUG . '_buy_form' ) );
@@ -191,7 +192,11 @@ if ( ! function_exists( 'mycred_render_buy_form_points' ) ) :
191
  <form method="post" class="form<?php if ( $inline == 1 ) echo '-inline'; ?> <?php echo implode( ' ', $classes ); ?>" action="">
192
  <input type="hidden" name="token" value="<?php echo wp_create_nonce( 'mycred-buy-creds' ); ?>" />
193
  <input type="hidden" name="ctype" value="<?php echo esc_attr( $ctype ); ?>" />
194
-
 
 
 
 
195
  <div class="form-group">
196
  <label><?php echo $mycred->plural(); ?></label>
197
  <?php
106
  'excluded' => '',
107
  'maxed' => '',
108
  'gift_to' => '',
109
+ 'e_rate' => '',
110
  'gift_by' => __( 'Username', 'mycred' ),
111
  'inline' => 0
112
  ), $atts, MYCRED_SLUG . '_buy_form' ) );
192
  <form method="post" class="form<?php if ( $inline == 1 ) echo '-inline'; ?> <?php echo implode( ' ', $classes ); ?>" action="">
193
  <input type="hidden" name="token" value="<?php echo wp_create_nonce( 'mycred-buy-creds' ); ?>" />
194
  <input type="hidden" name="ctype" value="<?php echo esc_attr( $ctype ); ?>" />
195
+ <?php if( isset($e_rate) && !empty($e_rate)){
196
+ $e_rate=base64_encode($e_rate);
197
+ ?>
198
+ <input type="hidden" name="er_random" value="<?php echo esc_attr($e_rate); ?>" />
199
+ <?php } ?>
200
  <div class="form-group">
201
  <label><?php echo $mycred->plural(); ?></label>
202
  <?php
addons/email-notices/includes/mycred-email-functions.php CHANGED
@@ -363,7 +363,7 @@ if ( ! function_exists( 'mycred_get_triggered_emails' ) ) :
363
  }
364
 
365
  // check if trasfer trigger has notice id
366
- if ( ! empty( $triggers['generic']['transfer_in'] ) ) {
367
  foreach ( $triggers['generic']['transfer_in'] as $notice_id ) {
368
 
369
  if ( ! in_array( $notice_id, $notices ) )
@@ -373,7 +373,7 @@ if ( ! function_exists( 'mycred_get_triggered_emails' ) ) :
373
  }
374
 
375
  // check if trasfer trigger has notice ids
376
- if ( ! empty( $triggers['generic']['transfer_out'] ) ) {
377
  foreach ( $triggers['generic']['transfer_out'] as $notice_id ) {
378
  if ( ! in_array( $notice_id, $notices ) )
379
  $notices[] = $notice_id;
@@ -381,7 +381,6 @@ if ( ! function_exists( 'mycred_get_triggered_emails' ) ) :
381
  }
382
  }
383
 
384
-
385
  // Specific instances based on reference
386
  if ( ! empty( $triggers['specific'] ) && array_key_exists( $ref, $triggers['specific'] ) && ! empty( $triggers['specific'][ $ref ] ) ) {
387
  foreach ( $triggers['specific'][ $ref ] as $notice_id ) {
363
  }
364
 
365
  // check if trasfer trigger has notice id
366
+ if ( ! empty( $ref ) && $ref == 'transfer' && floatval( $amount ) > 0 && ! empty( $triggers['generic']['transfer_in'] ) ) {
367
  foreach ( $triggers['generic']['transfer_in'] as $notice_id ) {
368
 
369
  if ( ! in_array( $notice_id, $notices ) )
373
  }
374
 
375
  // check if trasfer trigger has notice ids
376
+ if ( ! empty( $ref ) && $ref == 'transfer' && floatval( $amount ) < 0 && ! empty( $triggers['generic']['transfer_out'] ) ) {
377
  foreach ( $triggers['generic']['transfer_out'] as $notice_id ) {
378
  if ( ! in_array( $notice_id, $notices ) )
379
  $notices[] = $notice_id;
381
  }
382
  }
383
 
 
384
  // Specific instances based on reference
385
  if ( ! empty( $triggers['specific'] ) && array_key_exists( $ref, $triggers['specific'] ) && ! empty( $triggers['specific'][ $ref ] ) ) {
386
  foreach ( $triggers['specific'][ $ref ] as $notice_id ) {
addons/ranks/includes/mycred-rank-functions.php CHANGED
@@ -632,7 +632,7 @@ if ( ! function_exists( 'mycred_manual_ranks' ) ) :
632
  $prefs = mycred_get_addon_settings( 'rank', $point_type );
633
 
634
  $result = false;
635
- if ( $prefs['base'] == 'manual' )
636
  $result = true;
637
 
638
  return $result;
@@ -653,7 +653,7 @@ if ( ! function_exists( 'mycred_rank_based_on_total' ) ) :
653
  $prefs = mycred_get_addon_settings( 'rank', $point_type );
654
 
655
  $result = false;
656
- if ( $prefs['base'] == 'total' )
657
  $result = true;
658
 
659
  return $result;
632
  $prefs = mycred_get_addon_settings( 'rank', $point_type );
633
 
634
  $result = false;
635
+ if ( ! empty( $prefs ) && $prefs['base'] == 'manual' )
636
  $result = true;
637
 
638
  return $result;
653
  $prefs = mycred_get_addon_settings( 'rank', $point_type );
654
 
655
  $result = false;
656
+ if ( ! empty( $prefs ) && $prefs['base'] == 'total' )
657
  $result = true;
658
 
659
  return $result;
addons/ranks/myCRED-addon-ranks.php CHANGED
@@ -1921,7 +1921,7 @@ jQuery(function($){
1921
  $wpdb->query( "
1922
  DELETE FROM {$posts_table}
1923
  WHERE post_type = '{$rank_key}'
1924
- AND post_id IN ({$id_list});" );
1925
 
1926
  // Remove post meta
1927
  $wpdb->query( "
1921
  $wpdb->query( "
1922
  DELETE FROM {$posts_table}
1923
  WHERE post_type = '{$rank_key}'
1924
+ AND ID IN ({$id_list});" );
1925
 
1926
  // Remove post meta
1927
  $wpdb->query( "
addons/sell-content/includes/mycred-sell-functions.php CHANGED
@@ -328,6 +328,8 @@ if ( ! function_exists( 'mycred_user_paid_for_content' ) ) :
328
 
329
  }
330
 
 
 
331
  if ( ! $has_paid ) {
332
 
333
  $last_payment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$mycred_log_table} WHERE user_id = %d AND ref = 'buy_content' AND ref_id = %d ORDER BY time DESC LIMIT 1;", $user_id, $post_id ) );
328
 
329
  }
330
 
331
+ $last_payment = '';
332
+
333
  if ( ! $has_paid ) {
334
 
335
  $last_payment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$mycred_log_table} WHERE user_id = %d AND ref = 'buy_content' AND ref_id = %d ORDER BY time DESC LIMIT 1;", $user_id, $post_id ) );
addons/sell-content/includes/mycred-sell-shortcodes.php CHANGED
@@ -230,26 +230,26 @@ if ( ! function_exists( 'mycred_render_sell_history' ) ) :
230
  $mycred = mycred( $entry->ctype );
231
  $expirares_in = mycred_sell_content_get_expiration_length( $entry->ref_id, $entry->ctype );
232
 
233
- echo '<td class="mycred-sell-' . $column_id . ' ' . $column_id . '">';
234
 
235
  foreach ( $columns as $column_id => $column_label ) {
236
 
237
  if ( $column_id == 'col-date' )
238
- echo date( $date_format, $entry->time );
239
 
240
  elseif ( $column_id == 'col-title' )
241
- echo '<a href="' . mycred_get_permalink( $entry->ref_id ) . '">' . mycred_get_the_title( $entry->ref_id ) . '</a>';
242
 
243
  elseif ( $column_id == 'col-amount' )
244
- echo '<td class="">' . $mycred->format_creds( abs( $entry->creds ) ) . '</td>';
245
 
246
  elseif ( $column_id == 'col-expires' ) {
247
 
248
  $expires = __( 'Never', 'mycred' );
249
- if ( $prefs['expire'] > 0 )
250
  $expires = sprintf( _x( 'Purchase expires in %s', 'e.g. 10 hours', 'mycred' ), $expirares_in . ' ' . $expiration );
251
 
252
- echo '<td class="">' . $expires . '</td>';
253
 
254
  }
255
  else {
@@ -261,7 +261,7 @@ if ( ! function_exists( 'mycred_render_sell_history' ) ) :
261
 
262
  }
263
 
264
- echo '</td>';
265
 
266
  }
267
  }
230
  $mycred = mycred( $entry->ctype );
231
  $expirares_in = mycred_sell_content_get_expiration_length( $entry->ref_id, $entry->ctype );
232
 
233
+ echo '<tr>';
234
 
235
  foreach ( $columns as $column_id => $column_label ) {
236
 
237
  if ( $column_id == 'col-date' )
238
+ echo '<td class="' . $column_id . '">'.date( $date_format, $entry->time ).'</td>';
239
 
240
  elseif ( $column_id == 'col-title' )
241
+ echo '<td class="' . $column_id . '"><a href="' . mycred_get_permalink( $entry->ref_id ) . '">' . mycred_get_the_title( $entry->ref_id ) . '</a></td>';
242
 
243
  elseif ( $column_id == 'col-amount' )
244
+ echo '<td class="' . $column_id . '">' . $mycred->format_creds( abs( $entry->creds ) ) . '</td>';
245
 
246
  elseif ( $column_id == 'col-expires' ) {
247
 
248
  $expires = __( 'Never', 'mycred' );
249
+ if ( $expirares_in > 0 )
250
  $expires = sprintf( _x( 'Purchase expires in %s', 'e.g. 10 hours', 'mycred' ), $expirares_in . ' ' . $expiration );
251
 
252
+ echo '<td class="' . $column_id . '">' . $expires . '</td>';
253
 
254
  }
255
  else {
261
 
262
  }
263
 
264
+ echo '</tr>';
265
 
266
  }
267
  }
addons/sell-content/myCRED-addon-sell-content.php CHANGED
@@ -25,6 +25,7 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
25
 
26
  public $current_user_id = 0;
27
  public $priority = 10;
 
28
 
29
  /**
30
  * Construct
@@ -82,6 +83,7 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
82
  // Setup Script
83
  add_action( 'mycred_register_assets', array( $this, 'register_assets' ) );
84
  add_action( 'mycred_front_enqueue_footer', array( $this, 'enqueue_footer' ) );
 
85
 
86
  }
87
 
@@ -326,6 +328,116 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
326
 
327
  }
328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  /**
330
  * User Level Override
331
  * @since 1.5
25
 
26
  public $current_user_id = 0;
27
  public $priority = 10;
28
+ public $bbp_content = '';
29
 
30
  /**
31
  * Construct
83
  // Setup Script
84
  add_action( 'mycred_register_assets', array( $this, 'register_assets' ) );
85
  add_action( 'mycred_front_enqueue_footer', array( $this, 'enqueue_footer' ) );
86
+ add_action( 'bbp_template_redirect', array( $this, 'bbp_content' ), 10 );
87
 
88
  }
89
 
328
 
329
  }
330
 
331
+
332
+
333
+ public function bbp_content() {
334
+
335
+ global $mycred_partial_content_sale, $mycred_sell_this;
336
+
337
+ $post_id = mycred_sell_content_post_id();
338
+ $post = mycred_get_post( $post_id );
339
+ $content = '';
340
+
341
+ // If content is for sale
342
+ if ( mycred_post_is_for_sale( $post_id ) && ( bbp_is_single_forum() || bbp_is_single_topic() || bbp_is_single_reply() ) ) {
343
+
344
+ $mycred_sell_this = true;
345
+
346
+ // Partial Content Sale - We have already done the work in the shortcode
347
+ if ( $mycred_partial_content_sale === true ) return;
348
+
349
+ // Logged in users
350
+ if ( is_user_logged_in() ) {
351
+
352
+ // Authors and admins do not pay
353
+ if ( ! mycred_is_admin() && $post->post_author != $this->current_user_id ) {
354
+
355
+ // In case we have not paid
356
+ if ( ! mycred_user_paid_for_content( $this->current_user_id, $post_id ) ) {
357
+
358
+ // Get Payment Options
359
+ $payment_options = mycred_sell_content_payment_buttons( $this->current_user_id, $post_id );
360
+
361
+ // User can buy
362
+ if ( $payment_options !== false ) {
363
+
364
+ $content = $this->sell_content['templates']['members'];
365
+ $content = str_replace( '%buy_button%', $payment_options, $content );
366
+ $content = mycred_sell_content_template( $content, $post, 'mycred-sell-entire-content', 'mycred-sell-unpaid' );
367
+ $this->mycred_bbp_sell_forum_actions();
368
+
369
+ }
370
+
371
+ // Can not afford to buy
372
+ else {
373
+
374
+ $content = $this->sell_content['templates']['cantafford'];
375
+ $content = mycred_sell_content_template( $content, $post, 'mycred-sell-entire-content', 'mycred-sell-insufficient' );
376
+ $this->mycred_bbp_sell_forum_actions();
377
+
378
+ }
379
+
380
+ }
381
+
382
+ }
383
+
384
+ }
385
+
386
+ // Visitors
387
+ else {
388
+
389
+ $content = $this->sell_content['templates']['visitors'];
390
+ $content = mycred_sell_content_template( $content, $post, 'mycred-sell-entire-content', 'mycred-sell-visitor' );
391
+ $this->mycred_bbp_sell_forum_actions();
392
+
393
+ }
394
+
395
+ }
396
+
397
+ $this->bbp_content = $content;
398
+
399
+ }
400
+
401
+
402
+ public function mycred_bbp_sell_forum_actions() {
403
+
404
+ add_action( 'bbp_template_before_single_forum', array( $this, 'bbp_template_before_single' ) );
405
+ add_action( 'bbp_template_before_single_topic', array( $this, 'bbp_template_before_single' ) );
406
+ add_filter( 'bbp_no_breadcrumb', array( $this, 'bbp_remove_breadcrumb' ), 10 );
407
+ add_filter( 'bbp_get_forum_subscribe_link', array( $this, 'bbp_remove_subscribe_link' ), 10 , 3 );
408
+ add_filter( 'bbp_get_topic_subscribe_link', array( $this, 'bbp_remove_subscribe_link' ), 10 , 3 );
409
+ add_filter( 'bbp_get_topic_favorite_link', array( $this, 'bbp_remove_subscribe_link' ), 10 , 3 );
410
+ add_filter( 'bbp_get_template_part', array( $this, 'bbp_remove_templates' ), 10 , 3 );
411
+ add_filter( 'bbp_get_single_forum_description', array( $this, 'bbp_get_single_description' ), 10 , 3 );
412
+ add_filter( 'bbp_get_single_topic_description', array( $this, 'bbp_get_single_description' ), 10 , 3 );
413
+
414
+ }
415
+
416
+ public function bbp_template_before_single() {
417
+
418
+ echo $this->bbp_content;
419
+
420
+ }
421
+
422
+ public function bbp_remove_breadcrumb( $is_front ) {
423
+ return true;
424
+ }
425
+
426
+ public function bbp_remove_subscribe_link( $retval, $r, $args ) {
427
+ return '';
428
+ }
429
+
430
+ public function bbp_remove_templates( $templates, $slug, $name ) {
431
+
432
+ if ( $slug == 'content' ) return $templates;
433
+
434
+ return array('');
435
+ }
436
+
437
+ public function bbp_get_single_description( $retstr, $r, $args ) {
438
+ return '';
439
+ }
440
+
441
  /**
442
  * User Level Override
443
  * @since 1.5
includes/classes/class.query-leaderboard.php CHANGED
@@ -595,6 +595,7 @@ if ( ! class_exists( 'myCRED_Query_Leaderboard' ) ) :
595
  global $wpdb, $mycred_log_table;
596
 
597
  $time_filter = $this->get_timefilter();
 
598
  $multisite_check = $this->get_multisitefilter();
599
 
600
  $point_type_is = 'l.ctype = %s';
595
  global $wpdb, $mycred_log_table;
596
 
597
  $time_filter = $this->get_timefilter();
598
+ $exclude_filter = $this->get_excludefilter();
599
  $multisite_check = $this->get_multisitefilter();
600
 
601
  $point_type_is = 'l.ctype = %s';
includes/hooks/mycred-hook-watching-video.php CHANGED
@@ -169,58 +169,66 @@ if ( ! class_exists( 'myCRED_Hook_Video_Views' ) ) :
169
  $max = abs( $num_intervals * $amount );
170
  $users_log = $this->get_users_video_log( $video_id, $user_id );
171
 
172
- // Film is playing and we just started
173
- if ( $state == 1 && $users_log === NULL ) {
 
174
 
175
- // Add points without using mycred_add to prevent
176
- // notifications from being sent as this amount will change.
177
- $this->core->update_users_balance( $user_id, $amount );
178
 
179
- $this->core->add_to_log(
180
- 'watching_video',
181
- $user_id,
182
- $amount,
183
- $this->prefs['log'],
184
- 0,
185
- $video_id,
186
- $this->mycred_type
187
- );
188
 
189
- $status = 'added';
 
 
190
 
191
- }
 
 
 
 
 
 
 
 
192
 
193
- // Film is playing and we have not yet reached maximum on this movie
194
- elseif ( $state == 1 && isset( $users_log->creds ) && $users_log->creds+$amount <= $max ) {
195
 
196
- $this->update_creds( $users_log->id, $user_id, $users_log->creds+$amount );
197
- $this->core->update_users_balance( $user_id, $amount );
198
- $amount = $users_log->creds+$amount;
199
 
200
- $status = 'added';
 
201
 
202
- }
 
 
203
 
204
- // Film has ended and we have not reached maximum
205
- elseif ( $state == 0 && isset( $users_log->creds ) && $users_log->creds+$amount <= $max ) {
206
 
207
- $this->update_creds( $users_log->id, $user_id, $users_log->creds+$amount );
208
- $this->core->update_users_balance( $user_id, $amount );
209
- $amount = $users_log->creds+$amount;
210
 
211
- $status = 'max';
 
212
 
213
- // If enabled, add notification
214
- if ( function_exists( 'mycred_add_new_notice' ) ) {
 
215
 
216
- if ( $amount < 0 )
217
- $color = '<';
218
- else
219
- $color = '>';
220
 
221
- $message = str_replace( '%amount%', $amount, $this->prefs['template'] );
222
- if ( ! empty( $message ) )
223
- mycred_add_new_notice( array( 'user_id' => $user_id, 'message' => $message, 'color' => $color ) );
 
 
 
 
 
 
 
 
 
 
224
 
225
  }
226
 
169
  $max = abs( $num_intervals * $amount );
170
  $users_log = $this->get_users_video_log( $video_id, $user_id );
171
 
172
+ // Execution Override
173
+ // Allows us to stop an execution.
174
+ $execute = apply_filters( 'mycred_video_interval', true, $video_data, false );
175
 
176
+ if ( $execute ) {
 
 
177
 
178
+ // Film is playing and we just started
179
+ if ( $state == 1 && $users_log === NULL ) {
 
 
 
 
 
 
 
180
 
181
+ // Add points without using mycred_add to prevent
182
+ // notifications from being sent as this amount will change.
183
+ $this->core->update_users_balance( $user_id, $amount );
184
 
185
+ $this->core->add_to_log(
186
+ 'watching_video',
187
+ $user_id,
188
+ $amount,
189
+ $this->prefs['log'],
190
+ 0,
191
+ $video_id,
192
+ $this->mycred_type
193
+ );
194
 
195
+ $status = 'added';
 
196
 
197
+ }
 
 
198
 
199
+ // Film is playing and we have not yet reached maximum on this movie
200
+ elseif ( $state == 1 && isset( $users_log->creds ) && $users_log->creds+$amount <= $max ) {
201
 
202
+ $this->update_creds( $users_log->id, $user_id, $users_log->creds+$amount );
203
+ $this->core->update_users_balance( $user_id, $amount );
204
+ $amount = $users_log->creds+$amount;
205
 
206
+ $status = 'added';
 
207
 
208
+ }
 
 
209
 
210
+ // Film has ended and we have not reached maximum
211
+ elseif ( $state == 0 && isset( $users_log->creds ) && $users_log->creds+$amount <= $max ) {
212
 
213
+ $this->update_creds( $users_log->id, $user_id, $users_log->creds+$amount );
214
+ $this->core->update_users_balance( $user_id, $amount );
215
+ $amount = $users_log->creds+$amount;
216
 
217
+ $status = 'max';
 
 
 
218
 
219
+ // If enabled, add notification
220
+ if ( function_exists( 'mycred_add_new_notice' ) ) {
221
+
222
+ if ( $amount < 0 )
223
+ $color = '<';
224
+ else
225
+ $color = '>';
226
+
227
+ $message = str_replace( '%amount%', $amount, $this->prefs['template'] );
228
+ if ( ! empty( $message ) )
229
+ mycred_add_new_notice( array( 'user_id' => $user_id, 'message' => $message, 'color' => $color ) );
230
+
231
+ }
232
 
233
  }
234
 
includes/mycred-functions.php CHANGED
@@ -3041,6 +3041,29 @@ if ( ! function_exists( 'mycred_trash_post' ) ) :
3041
  }
3042
  endif;
3043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3044
  /**
3045
  * Delete Post
3046
  * @since 1.8
3041
  }
3042
  endif;
3043
 
3044
+ /**
3045
+ * Get Attachment URL
3046
+ * @since 1.8.11
3047
+ * @version 1.0
3048
+ */
3049
+ if ( ! function_exists( 'mycred_get_attachment_url' ) ) :
3050
+ function mycred_get_attachment_url( $post_id = NULL ) {
3051
+
3052
+ $override = ( mycred_override_settings() && ! mycred_is_main_site() );
3053
+
3054
+ if ( $override )
3055
+ switch_to_blog( get_network()->site_id );
3056
+
3057
+ $results = wp_get_attachment_url( $post_id );
3058
+
3059
+ if ( $override )
3060
+ restore_current_blog();
3061
+
3062
+ return $results;
3063
+
3064
+ }
3065
+ endif;
3066
+
3067
  /**
3068
  * Delete Post
3069
  * @since 1.8
membership/subscription-functions.php CHANGED
@@ -199,7 +199,7 @@ if( !function_exists('mycred_get_subscription_end_date') ) {
199
  * Get membership end date
200
  *
201
  * @since 1.0
202
- * @version 1.0
203
  */
204
  if( !function_exists('mycred_is_membership_active') ) {
205
  function mycred_is_membership_active() {
@@ -210,8 +210,10 @@ if( !function_exists('mycred_is_membership_active') ) {
210
 
211
  $user_license_key = mycred_get_membership_key();
212
 
 
 
213
  $url = rtrim( get_bloginfo( 'url' ), '/' );
214
- if( myCRED_VERSION >= '1.8.8' && !empty( $user_license_key ) &&
215
  mycred_get_membership_details()['plan'][0]['key'] == $user_license_key &&
216
  in_array( $url, mycred_get_membership_details()['sites'][0] )
217
  ) {
199
  * Get membership end date
200
  *
201
  * @since 1.0
202
+ * @version 1.2
203
  */
204
  if( !function_exists('mycred_is_membership_active') ) {
205
  function mycred_is_membership_active() {
210
 
211
  $user_license_key = mycred_get_membership_key();
212
 
213
+ $mycred_version = (int) str_replace( '.', '', myCRED_VERSION );
214
+
215
  $url = rtrim( get_bloginfo( 'url' ), '/' );
216
+ if( $mycred_version >= 188 && !empty( $user_license_key ) &&
217
  mycred_get_membership_details()['plan'][0]['key'] == $user_license_key &&
218
  in_array( $url, mycred_get_membership_details()['sites'][0] )
219
  ) {
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.11
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.4
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.11';
23
 
24
  // Instnace
25
  protected static $_instance = NULL;
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.12
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.4.2
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.12';
23
 
24
  // Instnace
25
  protected static $_instance = NULL;
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mycred,wpexpertsio
3
  Tags: badges, gamification, loyalty, points, rewards
4
  Requires at least: 4.8
5
- Tested up to: 5.4
6
- Stable tag: 1.8.11
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -269,7 +269,11 @@ Bug fixes release.
269
  Bug fixes release.
270
 
271
  = 1.8.11 =
272
- Zombaio payment gateway is no longer available and completely removed in this update.
 
 
 
 
273
 
274
  == Other Notes ==
275
 
@@ -292,6 +296,20 @@ Zombaio payment gateway is no longer available and completely removed in this up
292
 
293
  == Changelog ==
294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  = 1.8.11 =
296
  NEW - Added button for remove default badge image.
297
  FIX - Log menu not visible except the master site when the master template is enabled.
@@ -302,7 +320,6 @@ FIX - Single Quote in form title breaks the specific badge functionality for the
302
  FIX - Undefined index warnings in myCred leaderboard widget.
303
  TWEAK - Update myCred translations.
304
  TWEAK - mycred_hook_table code improvements.
305
- DELETE - Removed zombaio payment gateway.
306
 
307
  = 1.8.9 =
308
  NEW - Introduce a new filter mycred_update_total_balance.
2
  Contributors: mycred,wpexpertsio
3
  Tags: badges, gamification, loyalty, points, rewards
4
  Requires at least: 4.8
5
+ Tested up to: 5.4.2
6
+ Stable tag: 1.8.12
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
269
  Bug fixes release.
270
 
271
  = 1.8.11 =
272
+ Bug fixes release.
273
+
274
+ = 1.8.12 =
275
+ Bug fixes release.
276
+
277
 
278
  == Other Notes ==
279
 
296
 
297
  == Changelog ==
298
 
299
+ = 1.8.12 =
300
+ NEW - Introduce a new filter mycred_video_interval for myCred Addons.
301
+ NEW - Added rate attribute in mycred_buy_form shortcode.
302
+ FIX - buyCred pending payment payout.
303
+ FIX - Badge image broken on sub-sites when master template is enabled on buddypress profile.
304
+ FIX - All ranks not removing completely, it stored some of their data in database.
305
+ FIX - Multisite buyCred transaction id empty on subsites in Bank transfer gateway.
306
+ FIX - mycred sell content not working with bbpress.
307
+ FIX - Bitpay 404 page issue in buyCred popup vesion.
308
+ FIX - myCred Email notifications triggers "transfer send and receives" not working properly.
309
+ FIX - mycred_sales_history shortcode not working.
310
+ TWEAK - Compatible rank module with PHP 7.4
311
+ TWEAK - Some variables are undefined in different cases in Leaderboard.
312
+
313
  = 1.8.11 =
314
  NEW - Added button for remove default badge image.
315
  FIX - Log menu not visible except the master site when the master template is enabled.
320
  FIX - Undefined index warnings in myCred leaderboard widget.
321
  TWEAK - Update myCred translations.
322
  TWEAK - mycred_hook_table code improvements.
 
323
 
324
  = 1.8.9 =
325
  NEW - Introduce a new filter mycred_update_total_balance.