myCRED - Version 2.3

Version Description

New features and Bug fixes.

Download this release

Release Info

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

Code changes from version 2.2 to 2.3

Files changed (44) hide show
  1. addons/badges/includes/mycred-badge-object.php +16 -3
  2. addons/badges/myCRED-addon-badges.php +23 -6
  3. addons/buy-creds/abstracts/mycred-abstract-payment-gateway.php +20 -12
  4. addons/buy-creds/assets/js/checkout.js +7 -0
  5. addons/buy-creds/includes/buycred-shortcodes.php +42 -7
  6. addons/buy-creds/modules/buycred-module-core.php +60 -2
  7. addons/cash-creds/assets/js/withdraw.js +17 -4
  8. addons/cash-creds/modules/cashcred-module-core.php +67 -1
  9. addons/coupons/myCRED-addon-coupons.php +2 -2
  10. addons/email-notices/includes/mycred-email-functions.php +0 -48
  11. addons/gateway/carts/mycred-woocommerce.php +11 -2
  12. addons/ranks/includes/mycred-rank-functions.php +45 -6
  13. addons/ranks/includes/mycred-rank-object.php +11 -1
  14. addons/ranks/myCRED-addon-ranks.php +15 -11
  15. addons/sell-content/includes/mycred-sell-functions.php +27 -3
  16. addons/sell-content/myCRED-addon-sell-content.php +5 -1
  17. addons/transfer/assets/js/mycred-transfer.js +1 -1
  18. addons/transfer/includes/mycred-transfer-functions.php +5 -3
  19. addons/transfer/includes/mycred-transfer-object.php +2 -1
  20. assets/css/admin-subscription.css +52 -10
  21. assets/css/mycred-admin.css +8 -1
  22. assets/css/mycred-buttons.css +80 -0
  23. assets/css/mycred-front.css +1 -1
  24. assets/js/mycred-accordion.js +7 -1
  25. assets/js/mycred-tools.js +260 -0
  26. assets/js/mycred-type-management.js +10 -1
  27. assets/screenshot-1.png +0 -0
  28. assets/screenshot-2.png +0 -0
  29. assets/screenshot-3.png +0 -0
  30. assets/screenshot-4.png +0 -0
  31. assets/screenshot-5.png +0 -0
  32. includes/classes/class.query-leaderboard.php +17 -13
  33. includes/classes/class.query-log.php +3 -2
  34. includes/hooks/mycred-hook-referrals.php +14 -1
  35. includes/mycred-about.php +9 -17
  36. includes/mycred-functions.php +153 -7
  37. includes/mycred-tools-bulk-assign.php +307 -0
  38. includes/mycred-tools.php +389 -0
  39. includes/shortcodes/mycred_my_balance_converted.php +90 -10
  40. includes/shortcodes/mycred_referral_stats.php +51 -0
  41. membership/mycred-connect-membership.php +16 -12
  42. modules/mycred-module-settings.php +104 -11
  43. mycred.php +8 -5
  44. readme.txt +426 -402
addons/badges/includes/mycred-badge-object.php CHANGED
@@ -351,6 +351,7 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
351
  /**
352
  * Assign Badge to User
353
  * @since 1.0
 
354
  * @version 1.0
355
  */
356
  public function assign( $user_id = false, $level_id = 0 ) {
@@ -383,6 +384,15 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
383
 
384
  mycred_update_user_meta( $user_id, $this->user_meta_key, '', $new_level );
385
  mycred_update_user_meta( $user_id, $this->user_meta_key, '_issued_on', time() );
 
 
 
 
 
 
 
 
 
386
 
387
  // Need to update counter with new assignments
388
  if ( $new_level == 0 ) {
@@ -642,6 +652,7 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
642
  /**
643
  * Divest Badge from user
644
  * @since 1.0
 
645
  * @version 1.0
646
  */
647
  public function divest( $user_id = false ) {
@@ -650,14 +661,16 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
650
 
651
  mycred_delete_user_meta( $user_id, $this->user_meta_key );
652
  mycred_delete_user_meta( $user_id, $this->user_meta_key . '_issued_on' );
653
- $usermeta = mycred_get_user_meta( $user_id, 'mycred_badge_ids', true );
654
- unset( $usermeta[$this->post_id] );
 
 
655
 
656
  $this->earnedby --;
657
  if ( $this->earnedby < 0 ) $this->earnedby = 0;
658
 
659
  mycred_update_post_meta( $this->post_id, 'total-users-with-badge', $this->earnedby );
660
- mycred_update_user_meta( $this->post_id, 'mycred_badge_ids', $this->earnedby );
661
 
662
  return true;
663
 
351
  /**
352
  * Assign Badge to User
353
  * @since 1.0
354
+ * @since 2.3 Added functions `mycred_update_user_meta`, `mycred_get_user_meta` with `mycred_badge_ids`
355
  * @version 1.0
356
  */
357
  public function assign( $user_id = false, $level_id = 0 ) {
384
 
385
  mycred_update_user_meta( $user_id, $this->user_meta_key, '', $new_level );
386
  mycred_update_user_meta( $user_id, $this->user_meta_key, '_issued_on', time() );
387
+
388
+ $badge_ids = mycred_get_user_meta( $user_id, 'mycred_badge_ids', '', true );
389
+
390
+ if ( ! empty( $badge_ids ) && is_array( $badge_ids ) )
391
+ $badge_ids[ $this->post_id ] = 0;
392
+ else
393
+ $badge_ids = array( $this->post_id => 0 );
394
+
395
+ mycred_update_user_meta( $user_id, 'mycred_badge_ids', '', $badge_ids );
396
 
397
  // Need to update counter with new assignments
398
  if ( $new_level == 0 ) {
652
  /**
653
  * Divest Badge from user
654
  * @since 1.0
655
+ * @since 2.3 Added functions `mycred_update_user_meta` with `mycred_badge_ids`
656
  * @version 1.0
657
  */
658
  public function divest( $user_id = false ) {
661
 
662
  mycred_delete_user_meta( $user_id, $this->user_meta_key );
663
  mycred_delete_user_meta( $user_id, $this->user_meta_key . '_issued_on' );
664
+ $usermeta = mycred_get_user_meta( $user_id, 'mycred_badge_ids', '', true );
665
+
666
+ if ( isset( $usermeta[$this->post_id] ) )
667
+ unset( $usermeta[$this->post_id] );
668
 
669
  $this->earnedby --;
670
  if ( $this->earnedby < 0 ) $this->earnedby = 0;
671
 
672
  mycred_update_post_meta( $this->post_id, 'total-users-with-badge', $this->earnedby );
673
+ mycred_update_user_meta( $user_id, 'mycred_badge_ids', '', $usermeta );
674
 
675
  return true;
676
 
addons/badges/myCRED-addon-badges.php CHANGED
@@ -399,7 +399,7 @@ if ( ! class_exists( 'myCRED_Badge_Module' ) ) :
399
  */
400
  public function delete_badge( $post_id ) {
401
 
402
- if ( get_post_status( $post_id ) != MYCRED_BADGE_KEY ) return $post_id;
403
 
404
  // Delete reference list to force a new query
405
  foreach ( $this->point_types as $type_id => $label )
@@ -408,12 +408,29 @@ if ( ! class_exists( 'myCRED_Badge_Module' ) ) :
408
  global $wpdb;
409
 
410
  // Delete connections to keep usermeta table clean
411
- $wpdb->delete(
412
- $wpdb->usermeta,
413
- array( 'meta_key' => MYCRED_BADGE_KEY . $post_id ),
414
- array( '%s' )
 
415
  );
416
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
  }
418
 
419
  /**
@@ -1800,7 +1817,7 @@ th#badge-users { width: 10%; }
1800
  $level = absint( $data['level'] );
1801
 
1802
  $badge->assign( $user_id, $level );
1803
-
1804
  $added ++;
1805
 
1806
  }
399
  */
400
  public function delete_badge( $post_id ) {
401
 
402
+ if ( get_post_type( $post_id ) != MYCRED_BADGE_KEY ) return $post_id;
403
 
404
  // Delete reference list to force a new query
405
  foreach ( $this->point_types as $type_id => $label )
408
  global $wpdb;
409
 
410
  // Delete connections to keep usermeta table clean
411
+ $query = $wpdb->get_results(
412
+ $wpdb->prepare(
413
+ "SELECT * FROM {$wpdb->usermeta} WHERE meta_key LIKE %s",
414
+ mycred_get_meta_key( MYCRED_BADGE_KEY ) . $post_id
415
+ )
416
  );
417
 
418
+ foreach ( $query as $user_meta ) {
419
+
420
+ mycred_delete_user_meta( $user_meta->user_id, $user_meta->meta_key );
421
+ mycred_delete_user_meta( $user_meta->user_id, $user_meta->meta_key, '_issued_on' );
422
+
423
+ $badge_ids = mycred_get_user_meta( $user_meta->user_id, MYCRED_BADGE_KEY . '_ids', '', true );
424
+
425
+ if ( isset( $badge_ids[ $post_id ] ) ) {
426
+
427
+ unset( $badge_ids[ $post_id ] );
428
+ mycred_update_user_meta( $user_meta->user_id, MYCRED_BADGE_KEY . '_ids', '', $badge_ids );
429
+
430
+ }
431
+
432
+ }
433
+
434
  }
435
 
436
  /**
1817
  $level = absint( $data['level'] );
1818
 
1819
  $badge->assign( $user_id, $level );
1820
+
1821
  $added ++;
1822
 
1823
  }
addons/buy-creds/abstracts/mycred-abstract-payment-gateway.php CHANGED
@@ -214,10 +214,14 @@ if ( ! class_exists( 'myCRED_Payment_Gateway' ) ) :
214
  /**
215
  * Populate Transaction
216
  * @since 1.8
 
217
  * @version 1.0
218
  */
219
  public function populate_transaction() {
220
 
 
 
 
221
  // Create a new transaction
222
  $new_transaction = false;
223
  if ( $this->transaction_id === false && $this->post_id === false ) {
@@ -485,7 +489,11 @@ if ( ! class_exists( 'myCRED_Payment_Gateway' ) ) :
485
  public function checkout_order() {
486
 
487
  $table_rows = array();
488
- $table_rows[] = '<tr><td class="item">' . esc_html( $this->core->plural() ) . '</td><td class="cost right">' . $this->amount . '</td></tr>';
 
 
 
 
489
 
490
  if ( $this->gifting )
491
  $table_rows[] = '<tr><td colspan="2"><strong>' . esc_js( esc_attr( __( 'Recipient', 'mycred' ) ) ) . ':</strong> ' . esc_html( get_userdata( $this->recipient_id )->display_name ) . '</td></tr>';
@@ -496,17 +504,17 @@ if ( ! class_exists( 'myCRED_Payment_Gateway' ) ) :
496
 
497
  if ( ! empty( $table_rows ) )
498
  $content = '
499
- <table class="table" cellspacing="0" cellpadding="0">
500
- <thead>
501
- <tr>
502
- <th class="item">' . esc_js( esc_attr( __( 'Item', 'mycred' ) ) ) . '</td>
503
- <th class="cost right">' . esc_js( esc_attr( __( 'Amount', 'mycred' ) ) ) . '</td>
504
- </tr>
505
- </thead>
506
- <tbody>
507
- ' . implode( '', $table_rows ) . '
508
- </tbody>
509
- </table>';
510
 
511
  return apply_filters( 'mycred_buycred_checkout_order', $content, $this );
512
 
214
  /**
215
  * Populate Transaction
216
  * @since 1.8
217
+ * @since 2.3 @filter added `mycred_buycred_populate_transaction` to avoid pending payments log in some cases.
218
  * @version 1.0
219
  */
220
  public function populate_transaction() {
221
 
222
+ if( apply_filters( 'mycred_buycred_populate_transaction', false, $this->id ) )
223
+ return;
224
+
225
  // Create a new transaction
226
  $new_transaction = false;
227
  if ( $this->transaction_id === false && $this->post_id === false ) {
489
  public function checkout_order() {
490
 
491
  $table_rows = array();
492
+ $point_type_name = apply_filters( 'mycred_buycred_checkout_order', $this->core->plural(), $this );
493
+ $table_rows[] = '<tr><td class="item">' . esc_html( $point_type_name ) . '</td><td class="cost right">' . $this->amount . '</td></tr>';
494
+
495
+ $item_label = apply_filters( 'mycred_buycred_checkout_order', __('Item', 'mycred'), $this );
496
+ $amount_label = apply_filters( 'mycred_buycred_checkout_order', __('Amount', 'mycred'), $this );
497
 
498
  if ( $this->gifting )
499
  $table_rows[] = '<tr><td colspan="2"><strong>' . esc_js( esc_attr( __( 'Recipient', 'mycred' ) ) ) . ':</strong> ' . esc_html( get_userdata( $this->recipient_id )->display_name ) . '</td></tr>';
504
 
505
  if ( ! empty( $table_rows ) )
506
  $content = '
507
+ <table class="table" cellspacing="0" cellpadding="0">
508
+ <thead>
509
+ <tr>
510
+ <th class="item">' . esc_js( esc_attr($item_label ) ) . '</td>
511
+ <th class="cost right">' . esc_js( esc_attr($amount_label ) ) . '</td>
512
+ </tr>
513
+ </thead>
514
+ <tbody>
515
+ ' . implode( '', $table_rows ) . '
516
+ </tbody>
517
+ </table>';
518
 
519
  return apply_filters( 'mycred_buycred_checkout_order', $content, $this );
520
 
addons/buy-creds/assets/js/checkout.js CHANGED
@@ -190,6 +190,13 @@ console.log( formdata );
190
 
191
  });
192
 
 
 
 
 
 
 
 
193
  });
194
 
195
  });
190
 
191
  });
192
 
193
+ $( document ).on( 'change', '.mycred-change-pointtypes', function(){
194
+
195
+ var value = $(this).find('option:selected').text();
196
+ var label = $('.mycred-point-type').html(value);
197
+
198
+ });
199
+
200
  });
201
 
202
  });
addons/buy-creds/includes/buycred-shortcodes.php CHANGED
@@ -101,7 +101,7 @@ if ( ! function_exists( 'mycred_render_buy_form_points' ) ) :
101
  extract( shortcode_atts( array(
102
  'button' => __( 'Buy Now', 'mycred' ),
103
  'gateway' => '',
104
- 'ctype' => MYCRED_DEFAULT_TYPE_KEY,
105
  'amount' => '',
106
  'excluded' => '',
107
  'maxed' => '',
@@ -122,7 +122,27 @@ if ( ! function_exists( 'mycred_render_buy_form_points' ) ) :
122
  $classes = array( 'myCRED-buy-form' );
123
  $amounts = array();
124
  $gifting = false;
 
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  // Make sure we have a gateway we can use
127
  if ( ( ! empty( $gateway ) && ! mycred_buycred_gateway_is_usable( $gateway ) ) || ( empty( $gateway ) && empty( $buycred_instance->active ) ) )
128
  return 'No gateway available.';
@@ -191,14 +211,23 @@ if ( ! function_exists( 'mycred_render_buy_form_points' ) ) :
191
  <div class="col-xs-12">
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=mycred_buycred_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
203
 
204
  // No amount given - user must nominate the amount
@@ -375,7 +404,10 @@ if ( ! function_exists( 'mycred_render_pending_purchases' ) ) :
375
  <td class="column-cost"><?php echo $buycred->adjust_column_content( 'cost', $entry->payment_id ); ?></td>
376
  <td class="column-ctype"><?php echo mycred_get_point_type_name( $entry->point_type, false ); ?></td>
377
  <td class="column-actions">
378
- <a href="<?php echo esc_url( $entry->pay_now_url ); ?>"><?php echo $pay_now; ?></a> &bull; <a href="<?php echo esc_url( $entry->cancel_url ); ?>"><?php echo $cancel; ?></a>
 
 
 
379
  </td>
380
  </tr>
381
  <?php
@@ -398,7 +430,10 @@ if ( ! function_exists( 'mycred_render_pending_purchases' ) ) :
398
  <td class="column-amount"><?php echo $buycred->adjust_column_content( 'amount', $entry->payment_id ); ?></td>
399
  <td class="column-cost"><?php echo $buycred->adjust_column_content( 'cost', $entry->payment_id ); ?></td>
400
  <td class="column-actions">
401
- <a href="<?php echo esc_url( $entry->pay_now_url ); ?>"><?php echo $pay_now; ?></a> &bull; <a href="<?php echo esc_url( $entry->cancel_url ); ?>"><?php echo $cancel; ?></a>
 
 
 
402
  </td>
403
  </tr>
404
  <?php
101
  extract( shortcode_atts( array(
102
  'button' => __( 'Buy Now', 'mycred' ),
103
  'gateway' => '',
104
+ 'ctype' => '',
105
  'amount' => '',
106
  'excluded' => '',
107
  'maxed' => '',
122
  $classes = array( 'myCRED-buy-form' );
123
  $amounts = array();
124
  $gifting = false;
125
+ $point_types = array();
126
 
127
+ $type_keys = $settings['types'];
128
+
129
+ if ( ! empty( $atts['ctype'] ) ) {
130
+ $given_types = explode( ',' , $atts['ctype'] );
131
+ $type_keys = array_intersect( $settings['types'], $given_types );
132
+
133
+ }
134
+
135
+ if( !empty( $type_keys ) && empty( $atts['ctype'] ) ) {
136
+ $type_keys[] = $settings['types'][0];
137
+
138
+ }
139
+
140
+ foreach( $type_keys as $type_key ){
141
+ $point_types[] = array( $type_key ,mycred_get_point_type_name( $type_key, false ) );
142
+ if( !empty( $type_keys ) && empty( $atts['ctype'] ) )
143
+ break;
144
+ }
145
+
146
  // Make sure we have a gateway we can use
147
  if ( ( ! empty( $gateway ) && ! mycred_buycred_gateway_is_usable( $gateway ) ) || ( empty( $gateway ) && empty( $buycred_instance->active ) ) )
148
  return 'No gateway available.';
211
  <div class="col-xs-12">
212
  <form method="post" class="form<?php if ( $inline == 1 ) echo '-inline'; ?> <?php echo implode( ' ', $classes ); ?>" action="">
213
  <input type="hidden" name="token" value="<?php echo wp_create_nonce( 'mycred-buy-creds' ); ?>" />
214
+ <?php
215
+ if( count( $point_types ) > 1 ){ ?>
216
+ <select name="ctype" class="mycred-change-pointtypes">
217
+ <?php foreach ( $point_types as $key => $value ) :?>
218
+ <option value="<?php echo $value[0]; ?>"><?php echo $value[1]; ?></option><?php endforeach;?>
219
+ </select><?php
220
+ }else{ ?>
221
+ <input type="hidden" name="ctype" value="<?php echo esc_attr( $point_types[0][0] ); ?>" /><?php
222
+ }
223
+
224
+ if( isset($e_rate) && !empty($e_rate)){
225
+ $e_rate=mycred_buycred_encode($e_rate);
226
  ?>
227
  <input type="hidden" name="er_random" value="<?php echo esc_attr($e_rate); ?>" />
228
  <?php } ?>
229
  <div class="form-group">
230
+ <label class="mycred-point-type"><?php echo $point_types[0][1]; ?></label>
231
  <?php
232
 
233
  // No amount given - user must nominate the amount
404
  <td class="column-cost"><?php echo $buycred->adjust_column_content( 'cost', $entry->payment_id ); ?></td>
405
  <td class="column-ctype"><?php echo mycred_get_point_type_name( $entry->point_type, false ); ?></td>
406
  <td class="column-actions">
407
+ <?php if( $entry->gateway_id != 'bank' ):?>
408
+ <a href="<?php echo esc_url( $entry->pay_now_url ); ?>"><?php echo $pay_now; ?></a> &bull;
409
+ <?php endif; ?>
410
+ <a href="<?php echo esc_url( $entry->cancel_url ); ?>"><?php echo $cancel; ?></a>
411
  </td>
412
  </tr>
413
  <?php
430
  <td class="column-amount"><?php echo $buycred->adjust_column_content( 'amount', $entry->payment_id ); ?></td>
431
  <td class="column-cost"><?php echo $buycred->adjust_column_content( 'cost', $entry->payment_id ); ?></td>
432
  <td class="column-actions">
433
+ <?php if( $entry->gateway_id != 'bank' ):?>
434
+ <a href="<?php echo esc_url( $entry->pay_now_url ); ?>"><?php echo $pay_now; ?></a> &bull;
435
+ <?php endif; ?>
436
+ <a href="<?php echo esc_url( $entry->cancel_url ); ?>"><?php echo $cancel; ?></a>
437
  </td>
438
  </tr>
439
  <?php
addons/buy-creds/modules/buycred-module-core.php CHANGED
@@ -307,7 +307,7 @@ if ( ! class_exists( 'myCRED_buyCRED_Module' ) ) :
307
  'buycred-checkout',
308
  'buyCRED',
309
  apply_filters( 'mycred_buycred_checkout_js', array(
310
- 'ajaxurl' => home_url( '/' ),
311
  'token' => wp_create_nonce( 'mycred-buy-creds' ),
312
  'checkout' => $settings['checkout'],
313
  'redirecting' => esc_js( esc_attr__( 'Redirecting', 'mycred' ) ),
@@ -728,6 +728,7 @@ if ( ! class_exists( 'myCRED_buyCRED_Module' ) ) :
728
  /**
729
  * Payment Gateways Page
730
  * @since 0.1
 
731
  * @version 1.2.2
732
  */
733
  public function admin_page() {
@@ -811,12 +812,69 @@ if ( ! class_exists( 'myCRED_buyCRED_Module' ) ) :
811
  }
812
  }
813
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
814
  ?>
 
815
  </div>
816
 
817
  <?php do_action( 'mycred_after_buycreds_page', $this ); ?>
818
 
819
- <p><?php submit_button( __( 'Update Settings', 'mycred' ), 'primary large', 'submit', false ); ?> <?php if ( MYCRED_SHOW_PREMIUM_ADDONS ) : ?><a href="https://mycred.me/product-category/buycred-gateways/" class="button button-secondary button-large" target="_blank">More Gateways</a><?php endif; ?></p>
820
 
821
  </form>
822
 
307
  'buycred-checkout',
308
  'buyCRED',
309
  apply_filters( 'mycred_buycred_checkout_js', array(
310
+ 'ajaxurl' => get_site_url(),
311
  'token' => wp_create_nonce( 'mycred-buy-creds' ),
312
  'checkout' => $settings['checkout'],
313
  'redirecting' => esc_js( esc_attr__( 'Redirecting', 'mycred' ) ),
728
  /**
729
  * Payment Gateways Page
730
  * @since 0.1
731
+ * @since 2.3 Added more gateways in tab `mycred_buycred_more_gateways_tab`
732
  * @version 1.2.2
733
  */
734
  public function admin_page() {
812
  }
813
  }
814
 
815
+ $more_gateways_tab = array();
816
+
817
+ $more_gateways_tab[] = array(
818
+ 'icon' => 'dashicons dashicons-admin-generic static',
819
+ 'text' => 'Stripe',
820
+ 'additional_text' => 'Paid',
821
+ 'url' => 'https://mycred.me/store/buycred-stripe/',
822
+ 'status' => 'disabled',
823
+ 'plugin' => 'mycred-stripe/mycred-stripe.php'
824
+ );
825
+
826
+ $more_gateways_tab[] = array(
827
+ 'icon' => 'dashicons dashicons-admin-generic static',
828
+ 'text' => 'Coinbase',
829
+ 'additional_text' => 'Paid',
830
+ 'url' => 'https://mycred.me/store/buycred-coinbase/',
831
+ 'status' => 'disabled',
832
+ 'plugin' => 'mycred-coinbase/mycred-coinbase.php'
833
+ );
834
+
835
+ $more_gateways_tab[] = array(
836
+ 'icon' => 'dashicons dashicons-admin-generic static',
837
+ 'text' => 'More Gateways',
838
+ 'url' => 'https://mycred.me/product-category/buycred-gateways/',
839
+ );
840
+
841
+ $more_gateways_tab = apply_filters( 'mycred_buycred_more_gateways_tab', $more_gateways_tab );
842
+
843
+ if( MYCRED_SHOW_PREMIUM_ADDONS )
844
+ {
845
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
846
+
847
+ foreach( $more_gateways_tab as $key => $gateway )
848
+ {
849
+
850
+ if ( isset( $gateway['plugin'] ) && is_plugin_active( $gateway['plugin'] ) )
851
+ continue;
852
+
853
+ $disabled_class = ( isset( $gateway['status'] ) && $gateway['status'] == 'disabled' ) ? 'disabled-tab' : '';
854
+
855
+ $content = "
856
+ <h4 class='ui-accordion-header ui-corner-top ui-accordion-header-collapsed ui-corner-all ui-state-default ui-accordion-icons buycred-cashcred-more-tab-btn {$disabled_class}' data-url='{$gateway['url']}'>
857
+ <span class='ui-accordion-header-icon ui-icon ui-icon-triangle-1-e'></span>
858
+ <span class='{$gateway['icon']}'></span>
859
+ {$gateway['text']}";
860
+
861
+ if( array_key_exists( 'additional_text', $gateway ) && !empty( $gateway['additional_text'] ) )
862
+ $content .= "<span class='additional-text'>{$gateway['additional_text']}</span>";
863
+
864
+ $content .= "</h4>
865
+ <div class='body' style='display:none; padding: 0px; border: none;'>
866
+ </div>";
867
+
868
+ echo $content;
869
+ }
870
+ }
871
  ?>
872
+
873
  </div>
874
 
875
  <?php do_action( 'mycred_after_buycreds_page', $this ); ?>
876
 
877
+ <p><?php submit_button( __( 'Update Settings', 'mycred' ), 'primary large', 'submit', false ); ?></p>
878
 
879
  </form>
880
 
addons/cash-creds/assets/js/withdraw.js CHANGED
@@ -7,6 +7,8 @@ jQuery(function($){
7
 
8
  $(document).ready(function() {
9
 
 
 
10
  if ( $( "#cashcred_pay_method" ).length ) {
11
  exchange_calculation();
12
  display_cashcred_gateway_notice();
@@ -20,12 +22,18 @@ jQuery(function($){
20
  exchange_calculation();
21
  display_cashcred_gateway_notice();
22
  });
23
-
24
- $( "#withdraw_points" ).keyup(function() {
25
- exchange_calculation();
 
 
26
  });
27
-
 
28
  $( 'body' ).on( 'submit', '.mycred-cashcred-form', function( e ){
 
 
 
29
  withdraw_points = $( "#withdraw_points" ).val();
30
  if( parseFloat( withdraw_points ) <= 0 ) {
31
  e.preventDefault();
@@ -97,8 +105,13 @@ jQuery(function($){
97
 
98
  }
99
 
 
 
 
 
100
  });
101
 
102
 
103
 
 
104
 
7
 
8
  $(document).ready(function() {
9
 
10
+
11
+
12
  if ( $( "#cashcred_pay_method" ).length ) {
13
  exchange_calculation();
14
  display_cashcred_gateway_notice();
22
  exchange_calculation();
23
  display_cashcred_gateway_notice();
24
  });
25
+
26
+ $( '.mycred-cashcred-form' ).on( 'keyup change', '#withdraw_points', function( e ){
27
+
28
+ exchange_calculation();
29
+
30
  });
31
+
32
+
33
  $( 'body' ).on( 'submit', '.mycred-cashcred-form', function( e ){
34
+
35
+
36
+
37
  withdraw_points = $( "#withdraw_points" ).val();
38
  if( parseFloat( withdraw_points ) <= 0 ) {
39
  e.preventDefault();
105
 
106
  }
107
 
108
+
109
+
110
+
111
+
112
  });
113
 
114
 
115
 
116
+
117
 
addons/cash-creds/modules/cashcred-module-core.php CHANGED
@@ -646,6 +646,7 @@ if ( ! class_exists( 'myCRED_cashCRED_Module' ) ) :
646
  /**
647
  * Payment Gateways Page
648
  * @since 0.1
 
649
  * @version 1.2.2
650
  */
651
  public function admin_page() {
@@ -729,12 +730,77 @@ if ( ! class_exists( 'myCRED_cashCRED_Module' ) ) :
729
  }
730
  }
731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
  ?>
733
  </div>
734
 
735
  <?php do_action( 'mycred_after_cashcred_page', $this ); ?>
736
 
737
- <p><?php submit_button( __( 'Update Settings', 'mycred' ), 'primary large', 'submit', false ); ?> <?php if ( MYCRED_SHOW_PREMIUM_ADDONS ) : ?><a href="https://mycred.me/product-category/buycred-gateways/" class="button button-secondary button-large" target="_blank">More Gateways</a><?php endif; ?></p>
738
 
739
  </form>
740
 
646
  /**
647
  * Payment Gateways Page
648
  * @since 0.1
649
+ * @since 2.3 Added paid gateway tabs `mycred_cashcred_more_gateways_tab`
650
  * @version 1.2.2
651
  */
652
  public function admin_page() {
730
  }
731
  }
732
 
733
+ $more_gateways_tab = array();
734
+
735
+ $more_gateways_tab[] = array(
736
+ 'icon' => 'dashicons dashicons-admin-generic static',
737
+ 'text' => 'Paypal',
738
+ 'additional_text' => 'Paid',
739
+ 'url' => 'https://mycred.me/store/cashcred-paypal/',
740
+ 'status' => 'disabled',
741
+ 'plugin' => 'mycred-cashcred-paypal/mycred-cashcred-paypal.php'
742
+ );
743
+
744
+ $more_gateways_tab[] = array(
745
+ 'icon' => 'dashicons dashicons-admin-generic static',
746
+ 'text' => 'Stripe',
747
+ 'additional_text' => 'Paid',
748
+ 'url' => 'https://mycred.me/store/cashcred-stripe/',
749
+ 'status' => 'disabled',
750
+ 'plugin' => 'mycred-cashcred-stripe/mycred-cashcred-stripe.php'
751
+ );
752
+
753
+ $more_gateways_tab[] = array(
754
+ 'icon' => 'dashicons dashicons-admin-generic static',
755
+ 'text' => 'More Gateways',
756
+ 'url' => 'https://mycred.me/product-category/cashcred-gateways/',
757
+ );
758
+
759
+ $more_gateways_tab = apply_filters( 'mycred_cashcred_more_gateways_tab', $more_gateways_tab );
760
+
761
+ $counter = 0;
762
+
763
+ if( MYCRED_SHOW_PREMIUM_ADDONS )
764
+ {
765
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
766
+
767
+ foreach( $more_gateways_tab as $key => $gateway )
768
+ {
769
+ if ( isset( $gateway['plugin'] ) && is_plugin_active( $gateway['plugin'] ) )
770
+ {
771
+ $counter++;
772
+ continue;
773
+ }
774
+
775
+ //If all gateways are active, don't show more gateways
776
+ if( $counter == count( $more_gateways_tab )-1 )
777
+ break;
778
+
779
+ $disabled_class = ( isset( $gateway['status'] ) && $gateway['status'] == 'disabled' ) ? 'disabled-tab' : '';
780
+
781
+ $content = "
782
+ <h4 class='ui-accordion-header ui-corner-top ui-accordion-header-collapsed ui-corner-all ui-state-default ui-accordion-icons buycred-cashcred-more-tab-btn {$disabled_class}' data-url='{$gateway['url']}'>
783
+ <span class='ui-accordion-header-icon ui-icon ui-icon-triangle-1-e'></span>
784
+ <span class='{$gateway['icon']}'></span>
785
+ {$gateway['text']}";
786
+
787
+ if( array_key_exists( 'additional_text', $gateway ) && !empty( $gateway['additional_text'] ) )
788
+ $content .= "<span class='additional-text'>{$gateway['additional_text']}</span>";
789
+
790
+ $content .= "</h4>
791
+ <div class='body' style='display:none; padding: 0px; border: none;'>
792
+ </div>";
793
+
794
+ echo $content;
795
+ }
796
+ }
797
+
798
  ?>
799
  </div>
800
 
801
  <?php do_action( 'mycred_after_cashcred_page', $this ); ?>
802
 
803
+ <p><?php submit_button( __( 'Update Settings', 'mycred' ), 'primary large', 'submit', false ); ?> </p>
804
 
805
  </form>
806
 
addons/coupons/myCRED-addon-coupons.php CHANGED
@@ -542,14 +542,14 @@ if ( ! class_exists( 'myCRED_Coupons_Module' ) ) :
542
  <div class="form-group">
543
  <label for="mycred-coupon-global"><?php _e( 'Global Maximum', 'mycred' ); ?></label>
544
  <input type="text" name="mycred_coupon[global]" class="form-control" id="mycred-coupon-global" value="<?php echo absint( $coupon->max_global ); ?>" />
545
- <span class="description"><?php _e( 'The maximum number of times this coupon can be used in total. Once this is reached, the coupon is automatically trashed.', 'mycred' ); ?></span>
546
  </div>
547
  </div>
548
  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
549
  <div class="form-group">
550
  <label for="mycred-coupon-user"><?php _e( 'User Maximum', 'mycred' ); ?></label>
551
  <input type="text" name="mycred_coupon[user]" class="form-control" id="mycred-coupon-user" value="<?php echo absint( $coupon->max_user ); ?>" />
552
- <span class="description"><?php _e( 'The maximum number of times this coupon can be used by a user.', 'mycred' ); ?></span>
553
  </div>
554
  </div>
555
  </div>
542
  <div class="form-group">
543
  <label for="mycred-coupon-global"><?php _e( 'Global Maximum', 'mycred' ); ?></label>
544
  <input type="text" name="mycred_coupon[global]" class="form-control" id="mycred-coupon-global" value="<?php echo absint( $coupon->max_global ); ?>" />
545
+ <span class="description"><?php _e( 'The maximum number of times this coupon can be used in total. Once this is reached, the coupon is automatically trashed. If 0 is selected then the coupon will not work and will automatically expire. For more info please read the <a href="https://codex.mycred.me/chapter-iii/coupons/creating-coupons/">Description</a>', 'mycred' ); ?></span>
546
  </div>
547
  </div>
548
  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
549
  <div class="form-group">
550
  <label for="mycred-coupon-user"><?php _e( 'User Maximum', 'mycred' ); ?></label>
551
  <input type="text" name="mycred_coupon[user]" class="form-control" id="mycred-coupon-user" value="<?php echo absint( $coupon->max_user ); ?>" />
552
+ <span class="description"><?php _e( 'The maximum number of times this coupon can be used by a user. If 0 is selected then the coupon will not work.', 'mycred' ); ?></span>
553
  </div>
554
  </div>
555
  </div>
addons/email-notices/includes/mycred-email-functions.php CHANGED
@@ -60,54 +60,6 @@ if ( ! function_exists( 'mycred_user_wants_email' ) ) :
60
  }
61
  endif;
62
 
63
- /**
64
- * Get Email Notice Instances
65
- * Returns an array of supported instances where an email can be sent by this add-on.
66
- * @since 1.8
67
- * @version 1.0
68
- */
69
- if ( ! function_exists( 'mycred_get_email_instances' ) ) :
70
- function mycred_get_email_instances( $none = true ) {
71
-
72
- $instances = array();
73
-
74
- if ( $none ) $instances[''] = __( 'Select', 'mycred' );
75
-
76
- $instances['any'] = __( 'users balance changes', 'mycred' );
77
- $instances['positive'] = __( 'users balance increases', 'mycred' );
78
- $instances['negative'] = __( 'users balance decreases', 'mycred' );
79
- $instances['zero'] = __( 'users balance reaches zero', 'mycred' );
80
- $instances['minus'] = __( 'users balance goes negative', 'mycred' );
81
-
82
- if ( class_exists( 'myCRED_Badge_Module' ) ) {
83
- $instances['badge_new'] = __( 'user gains a badge', 'mycred' );
84
- $instances['badge_level'] = __( 'user gains a new badge level', 'mycred' );
85
- }
86
-
87
- if ( class_exists( 'myCRED_Ranks_Module' ) ) {
88
- $instances['rank_up'] = __( 'user is promoted to a higher rank', 'mycred' );
89
- $instances['rank_down'] = __( 'user is demoted to a lower rank', 'mycred' );
90
- }
91
-
92
- if ( class_exists( 'myCRED_Transfer_Module' ) ) {
93
- $instances['transfer_out'] = __( 'user sends a transfer', 'mycred' );
94
- $instances['transfer_in'] = __( 'user receives a transfer', 'mycred' );
95
- }
96
-
97
- if ( class_exists( 'myCRED_cashCRED_Module' ) ) {
98
- $instances['cashcred_approved'] = __( 'cashcred withdraw approval', 'mycred' );
99
- $instances['cashcred_pending'] = __( 'cashcred withdraw pending', 'mycred' );
100
- $instances['cashcred_cancel'] = __( 'cashcred cancel', 'mycred' );
101
- }
102
-
103
-
104
- $instances['custom'] = __( 'a custom event occurs', 'mycred' );
105
-
106
- return apply_filters( 'mycred_email_instances', $instances );
107
-
108
- }
109
- endif;
110
-
111
  /**
112
  * Get Email Triggers
113
  * Retreaves the saved email triggers for a given point type.
60
  }
61
  endif;
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  /**
64
  * Get Email Triggers
65
  * Retreaves the saved email triggers for a given point type.
addons/gateway/carts/mycred-woocommerce.php CHANGED
@@ -512,7 +512,8 @@ add_filter( 'woocommerce_payment_gateways', 'mycred_register_woo_gateway' );
512
  * - Users balance is too low
513
  *
514
  * @since 0.1
515
- * @version 1.3
 
516
  */
517
  if ( ! function_exists( 'mycred_woo_available_gateways' ) ) :
518
  function mycred_woo_available_gateways( $gateways ) {
@@ -552,7 +553,15 @@ if ( ! function_exists( 'mycred_woo_available_gateways' ) ) :
552
 
553
  // Calculate cost in CREDs
554
  $currency = get_woocommerce_currency();
555
- if( ! is_object( $woocommerce ) || empty( $woocommerce->cart ) ) return;
 
 
 
 
 
 
 
 
556
  $cost = $woocommerce->cart->total;
557
  if ( ! mycred_point_type_exists( $currency ) && $currency != 'MYC' )
558
  $cost = $mycred->number( ( $woocommerce->cart->total / $gateways['mycred']->get_option( 'exchange_rate' ) ) );
512
  * - Users balance is too low
513
  *
514
  * @since 0.1
515
+ * @since 2.3 Return existing gateways atleast
516
+ * @version 1.4
517
  */
518
  if ( ! function_exists( 'mycred_woo_available_gateways' ) ) :
519
  function mycred_woo_available_gateways( $gateways ) {
553
 
554
  // Calculate cost in CREDs
555
  $currency = get_woocommerce_currency();
556
+
557
+ //Return existing gateways atleast
558
+ if( ! is_object( $woocommerce ) || empty( $woocommerce->cart ) )
559
+ {
560
+ unset( $gateways['mycred'] );
561
+
562
+ return $gateways;
563
+ }
564
+
565
  $cost = $woocommerce->cart->total;
566
  if ( ! mycred_point_type_exists( $currency ) && $currency != 'MYC' )
567
  $cost = $mycred->number( ( $woocommerce->cart->total / $gateways['mycred']->get_option( 'exchange_rate' ) ) );
addons/ranks/includes/mycred-rank-functions.php CHANGED
@@ -215,7 +215,7 @@ if ( ! function_exists( 'mycred_count_users_with_rank' ) ) :
215
 
216
  $user_count = mycred_get_post_meta( $rank_id, 'mycred_rank_users', true );
217
 
218
- if ( $user_count == '' ) {
219
 
220
  $point_type = mycred_get_post_meta( $rank_id, 'ctype', true );
221
  if ( $point_type == '' ) return 0;
@@ -288,14 +288,34 @@ if ( ! function_exists( 'mycred_save_users_rank' ) ) :
288
  $rank_id = absint( $rank_id );
289
  $point_type = sanitize_key( $point_type );
290
 
291
- global $mycred_current_account;
292
 
293
- mycred_update_user_meta( $user_id, MYCRED_RANK_KEY, ( ( $point_type != MYCRED_DEFAULT_TYPE_KEY ) ? $point_type : '' ), $rank_id );
 
 
294
 
295
- mycred_update_user_rank_id( $user_id, $rank_id );
 
 
 
 
 
 
 
 
 
 
 
296
 
297
- if ( isset( $mycred_current_account->ranks ) && $mycred_current_account->balance[ $point_type ] !== false )
298
- $mycred_current_account->balance[ $point_type ]->rank = new myCRED_Rank( $rank_id );
 
 
 
 
 
 
 
299
 
300
  return true;
301
 
@@ -791,4 +811,23 @@ if( !function_exists( 'mycred_update_user_rank_id' ) ):
791
  mycred_update_user_meta( $user_id, 'mycred_promoted_rank_ids', '', array( $current_rank_id ) );
792
  }
793
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
794
  endif;
215
 
216
  $user_count = mycred_get_post_meta( $rank_id, 'mycred_rank_users', true );
217
 
218
+ if ( empty($user_count) ) {
219
 
220
  $point_type = mycred_get_post_meta( $rank_id, 'ctype', true );
221
  if ( $point_type == '' ) return 0;
288
  $rank_id = absint( $rank_id );
289
  $point_type = sanitize_key( $point_type );
290
 
291
+ $current_rank = mycred_get_users_current_rank_id( $user_id, $point_type );
292
 
293
+ if ( !$current_rank || $current_rank != $rank_id ) {
294
+
295
+ global $mycred_current_account;
296
 
297
+ //Divest Old Rank
298
+ if ( ! empty( $current_rank ) )
299
+ {
300
+ $old_rank = new myCRED_Rank( $current_rank );
301
+
302
+ $old_rank->divest( $user_id );
303
+ }
304
+
305
+ mycred_update_user_rank_id( $user_id, $rank_id );
306
+
307
+ $new_rank = new myCRED_Rank( $rank_id );
308
+ $new_rank->assign( $user_id );
309
 
310
+ if (
311
+ isset( $mycred_current_account->user_id ) &&
312
+ $mycred_current_account->user_id == $user_id &&
313
+ isset( $mycred_current_account->ranks ) &&
314
+ $mycred_current_account->balance[ $point_type ] !== false
315
+ )
316
+ $mycred_current_account->balance[ $point_type ]->rank = $new_rank;
317
+
318
+ }
319
 
320
  return true;
321
 
811
  mycred_update_user_meta( $user_id, 'mycred_promoted_rank_ids', '', array( $current_rank_id ) );
812
  }
813
  }
814
+ endif;
815
+
816
+ /**
817
+ * Returns users current rank id
818
+ * @since 2.3
819
+ * @version 1.0
820
+ */
821
+ if( !function_exists( 'mycred_get_users_current_rank_id' ) ):
822
+ function mycred_get_users_current_rank_id( $user_id, $point_type = MYCRED_DEFAULT_TYPE_KEY )
823
+ {
824
+ $point_type = $point_type == MYCRED_DEFAULT_TYPE_KEY ? '' : $point_type;
825
+
826
+ $rank_id = mycred_get_user_meta( $user_id, MYCRED_RANK_KEY, $point_type, true );
827
+
828
+ if( !empty ( $rank_id ) )
829
+ return $rank_id;
830
+
831
+ return false;
832
+ }
833
  endif;
addons/ranks/includes/mycred-rank-object.php CHANGED
@@ -147,6 +147,7 @@ if ( ! class_exists( 'myCRED_Rank' ) ) :
147
  /**
148
  * Assign Rank to User
149
  * @since 1.8
 
150
  * @version 1.0
151
  */
152
  public function assign( $user_id = false ) {
@@ -161,7 +162,13 @@ if ( ! class_exists( 'myCRED_Rank' ) ) :
161
 
162
  $value = apply_filters( 'mycred_rank_user_value', $this->post_id, $user_id, $this );
163
 
164
- return mycred_update_user_meta( $user_id, MYCRED_RANK_KEY, ( ( $point_type != MYCRED_DEFAULT_TYPE_KEY ) ? $point_type : '' ), $value );
 
 
 
 
 
 
165
 
166
  }
167
 
@@ -205,6 +212,7 @@ if ( ! class_exists( 'myCRED_Rank' ) ) :
205
  /**
206
  * Divest User
207
  * @since 1.8
 
208
  * @version 1.0
209
  */
210
  public function divest( $user_id = false ) {
@@ -221,6 +229,8 @@ if ( ! class_exists( 'myCRED_Rank' ) ) :
221
 
222
  $results = mycred_delete_user_meta( $user_id, MYCRED_RANK_KEY, ( ( $post_type != MYCRED_DEFAULT_TYPE_KEY ) ? $post_type : '' ) );
223
 
 
 
224
  $this->count--;
225
 
226
  mycred_update_post_meta( $this->post_id, 'mycred_rank_users', $this->count );
147
  /**
148
  * Assign Rank to User
149
  * @since 1.8
150
+ * @since 2.3 Added `mycred_count_users_with_rank` for better counting
151
  * @version 1.0
152
  */
153
  public function assign( $user_id = false ) {
162
 
163
  $value = apply_filters( 'mycred_rank_user_value', $this->post_id, $user_id, $this );
164
 
165
+ $this->count = mycred_count_users_with_rank( $this->post_id );
166
+
167
+ $this->count++;
168
+
169
+ mycred_update_post_meta( $this->post_id, 'mycred_rank_users', $this->count );
170
+
171
+ return mycred_update_user_meta( $user_id, MYCRED_RANK_KEY, ( ( $post_type != MYCRED_DEFAULT_TYPE_KEY ) ? $post_type : '' ), $value );
172
 
173
  }
174
 
212
  /**
213
  * Divest User
214
  * @since 1.8
215
+ * @since 2.3 Added `mycred_count_users_with_rank` for better counting
216
  * @version 1.0
217
  */
218
  public function divest( $user_id = false ) {
229
 
230
  $results = mycred_delete_user_meta( $user_id, MYCRED_RANK_KEY, ( ( $post_type != MYCRED_DEFAULT_TYPE_KEY ) ? $post_type : '' ) );
231
 
232
+ $this->count = mycred_count_users_with_rank( $this->post_id );
233
+
234
  $this->count--;
235
 
236
  mycred_update_post_meta( $this->post_id, 'mycred_rank_users', $this->count );
addons/ranks/myCRED-addon-ranks.php CHANGED
@@ -167,6 +167,8 @@ if ( ! class_exists( 'myCRED_Ranks_Module' ) ) :
167
  add_action( 'manage_' . MYCRED_RANK_KEY . '_posts_custom_column', array( $this, 'adjust_column_content' ), 10, 2 );
168
  add_action( 'save_post_' . MYCRED_RANK_KEY, array( $this, 'save_rank' ), 10, 2 );
169
  add_filter( 'views_edit-mycred_rank', array( $this, 'modify_ranks_views_links' ) );
 
 
170
  }
171
 
172
  /**
@@ -1061,27 +1063,23 @@ if ( ! class_exists( 'myCRED_Ranks_Module' ) ) :
1061
  if ( $this->is_manual_mode( $type_key ) ) {
1062
 
1063
  if ( isset( $_POST[ 'rank-' . $type_key ] ) && mycred_is_admin( NULL, $type_key ) ) {
1064
-
1065
- // Get users current rank for comparison
1066
- $users_rank = mycred_get_users_rank( $user_id, $type_key );
1067
-
1068
- $rank = false;
1069
 
1070
  if ( $_POST[ 'rank-' . $type_key ] != '' )
1071
  $rank = absint( $_POST[ 'rank-' . $type_key ] );
1072
 
1073
  // Save users rank if a valid rank id is provided and it differs from the users current one
1074
- if ( $rank !== false && $rank > 0 && $users_rank->rank_id != $rank )
1075
  mycred_save_users_rank( $user_id, $rank, $type_key );
1076
-
1077
  // Delete users rank
1078
  elseif ( $rank === false ) {
1079
 
1080
- $end = '';
1081
- if ( $type_key != MYCRED_DEFAULT_TYPE_KEY )
1082
- $end = $type_key;
1083
 
1084
- mycred_delete_user_meta( $user_id, MYCRED_RANK_KEY, $end );
 
1085
 
1086
  }
1087
 
@@ -2022,6 +2020,12 @@ jQuery(function($){
2022
  return $view;
2023
  }
2024
 
 
 
 
 
 
 
2025
  }
2026
  endif;
2027
 
167
  add_action( 'manage_' . MYCRED_RANK_KEY . '_posts_custom_column', array( $this, 'adjust_column_content' ), 10, 2 );
168
  add_action( 'save_post_' . MYCRED_RANK_KEY, array( $this, 'save_rank' ), 10, 2 );
169
  add_filter( 'views_edit-mycred_rank', array( $this, 'modify_ranks_views_links' ) );
170
+
171
+ add_action( 'delete_user', array( $this, 'delete_user_rank_data' ) );
172
  }
173
 
174
  /**
1063
  if ( $this->is_manual_mode( $type_key ) ) {
1064
 
1065
  if ( isset( $_POST[ 'rank-' . $type_key ] ) && mycred_is_admin( NULL, $type_key ) ) {
1066
+
1067
+ $rank = false;
 
 
 
1068
 
1069
  if ( $_POST[ 'rank-' . $type_key ] != '' )
1070
  $rank = absint( $_POST[ 'rank-' . $type_key ] );
1071
 
1072
  // Save users rank if a valid rank id is provided and it differs from the users current one
1073
+ if ( $rank !== false && $rank > 0 && $users_rank->post_id != $rank ){
1074
  mycred_save_users_rank( $user_id, $rank, $type_key );
1075
+ }
1076
  // Delete users rank
1077
  elseif ( $rank === false ) {
1078
 
1079
+ $users_rank = mycred_get_users_rank( $user_id, $type_key );
 
 
1080
 
1081
+ if ( ! empty( $users_rank->post_id ) )
1082
+ $users_rank->divest( $user_id );
1083
 
1084
  }
1085
 
2020
  return $view;
2021
  }
2022
 
2023
+ public function delete_user_rank_data( $user_id )
2024
+ {
2025
+ $current_assign_rank = mycred_get_users_rank($user_id);
2026
+ mycred_update_post_meta( $current_assign_rank->post_id, 'mycred_rank_users', mycred_count_users_with_rank( $current_assign_rank->post_id ) - 1 );
2027
+ }
2028
+
2029
  }
2030
  endif;
2031
 
addons/sell-content/includes/mycred-sell-functions.php CHANGED
@@ -453,13 +453,13 @@ if ( ! function_exists( 'mycred_sell_content_payment_buttons' ) ) :
453
  $buttons = array();
454
 
455
  foreach ( $settings['type'] as $point_type ) {
456
-
457
  // Load point type
458
  $mycred = mycred( $point_type );
459
  $setup = mycred_get_option( 'mycred_sell_this_' . $point_type );
460
  $price = mycred_get_content_price( $post_id, $point_type, $user_id );
461
  $status = $setup['status'];
462
-
463
  // Manual mode
464
  if ( $settings['filters'][ $post->post_type ]['by'] == 'manual' ) {
465
 
@@ -490,7 +490,7 @@ if ( ! function_exists( 'mycred_sell_content_payment_buttons' ) ) :
490
  $result = implode( ' ', $buttons );
491
 
492
  }
493
-
494
  // Return a string of buttons or false if user can not afford
495
  return apply_filters( 'mycred_sellcontent_buttons', $result, $user_id, $post_id );
496
 
@@ -919,3 +919,27 @@ if ( ! function_exists( 'mycred_seconds_to_time' ) ) :
919
  return $dtF->diff($dtT)->format('%a days, %h hours,%i minutes ,%s Seconds');
920
  }
921
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  $buttons = array();
454
 
455
  foreach ( $settings['type'] as $point_type ) {
456
+
457
  // Load point type
458
  $mycred = mycred( $point_type );
459
  $setup = mycred_get_option( 'mycred_sell_this_' . $point_type );
460
  $price = mycred_get_content_price( $post_id, $point_type, $user_id );
461
  $status = $setup['status'];
462
+
463
  // Manual mode
464
  if ( $settings['filters'][ $post->post_type ]['by'] == 'manual' ) {
465
 
490
  $result = implode( ' ', $buttons );
491
 
492
  }
493
+
494
  // Return a string of buttons or false if user can not afford
495
  return apply_filters( 'mycred_sellcontent_buttons', $result, $user_id, $post_id );
496
 
919
  return $dtF->diff($dtT)->format('%a days, %h hours,%i minutes ,%s Seconds');
920
  }
921
  endif;
922
+
923
+ /**
924
+ * Check if points enable
925
+ * @since 2.3
926
+ * @version 1.0
927
+ */
928
+ if ( ! function_exists( 'mycred_sc_is_point_enable' ) ) :
929
+ function mycred_sc_is_points_enable()
930
+ {
931
+ $point_types = mycred_get_types();
932
+
933
+ foreach( array_keys( $point_types ) as $point_type )
934
+ {
935
+ $settings = mycred_get_option( "mycred_sell_this_{$point_type}" );
936
+
937
+ if( !empty( $settings ) && $settings['status'] == 'enabled' )
938
+ return true;
939
+
940
+ continue;
941
+ }
942
+
943
+ return false;
944
+ }
945
+ endif;
addons/sell-content/myCRED-addon-sell-content.php CHANGED
@@ -338,10 +338,14 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
338
  * Handles content sales by replacing the posts content with the appropriate template
339
  * for those who have not paid. Admins and authors are excluded.
340
  * @since 0.1
341
- * @version 1.2.2
 
342
  */
343
  public function the_content( $content ) {
344
 
 
 
 
345
  global $mycred_partial_content_sale, $mycred_sell_this;
346
 
347
  $post_id = mycred_sell_content_post_id();
338
  * Handles content sales by replacing the posts content with the appropriate template
339
  * for those who have not paid. Admins and authors are excluded.
340
  * @since 0.1
341
+ * @since 2.3 Added function `mycred_sc_is_points_enable` If points are disabled just return the content
342
+ * @version 1.2.3
343
  */
344
  public function the_content( $content ) {
345
 
346
+ if( !mycred_sc_is_points_enable() )
347
+ return $content;
348
+
349
  global $mycred_partial_content_sale, $mycred_sell_this;
350
 
351
  $post_id = mycred_sell_content_post_id();
addons/transfer/assets/js/mycred-transfer.js CHANGED
@@ -64,7 +64,7 @@
64
  var transferform = $(this);
65
  var formrefid = transferform.data( 'ref' );
66
  var formid = '#mycred-transfer-form-' + formrefid;
67
- var submitbutton = $( formid + ' input.mycred-submit-transfer' );
68
  var buttonlabel = submitbutton.val();
69
 
70
  e.preventDefault();
64
  var transferform = $(this);
65
  var formrefid = transferform.data( 'ref' );
66
  var formid = '#mycred-transfer-form-' + formrefid;
67
+ var submitbutton = $( formid + ' button.mycred-submit-transfer' );
68
  var buttonlabel = submitbutton.val();
69
 
70
  e.preventDefault();
addons/transfer/includes/mycred-transfer-functions.php CHANGED
@@ -307,19 +307,21 @@ endif;
307
  * Render Transfer Message
308
  * @see http://codex.mycred.me/functions/mycred_transfer_render_message/
309
  * @since 1.7.6
310
- * @version 1.0
311
  */
312
  if ( ! function_exists( 'mycred_transfer_render_message' ) ) :
313
  function mycred_transfer_render_message( $original = '', $data = array() ) {
 
 
314
 
315
  if ( empty( $original ) || empty( $data ) ) return $original;
316
 
317
  // Default message
318
- $message = apply_filters( 'mycred_transfer_default_message', $original, $data );
319
 
320
  // Get saved message
321
  if ( ! empty( $data ) && array_key_exists( 'message', $data ) && ! empty( $data['message'] ) )
322
- $original .= ' - ' . $data['message'];
323
 
324
  $content = str_replace( '%transfer_message%', $message, $original );
325
 
307
  * Render Transfer Message
308
  * @see http://codex.mycred.me/functions/mycred_transfer_render_message/
309
  * @since 1.7.6
310
+ * @version 1.1
311
  */
312
  if ( ! function_exists( 'mycred_transfer_render_message' ) ) :
313
  function mycred_transfer_render_message( $original = '', $data = array() ) {
314
+
315
+ $message = '';
316
 
317
  if ( empty( $original ) || empty( $data ) ) return $original;
318
 
319
  // Default message
320
+ $original = apply_filters( 'mycred_transfer_default_message', $original, $data );
321
 
322
  // Get saved message
323
  if ( ! empty( $data ) && array_key_exists( 'message', $data ) && ! empty( $data['message'] ) )
324
+ $original .= ' - ' . $data['message'];
325
 
326
  $content = str_replace( '%transfer_message%', $message, $original );
327
 
addons/transfer/includes/mycred-transfer-object.php CHANGED
@@ -843,6 +843,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
843
  * Get Transfer Form
844
  * Renders the transfer form based on our setup.
845
  * @since 1.8
 
846
  * @version 1.0
847
  */
848
  public function get_transfer_form( $args = array() ) {
@@ -896,7 +897,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
896
  <input type="hidden" name="mycred_new_transfer[token]" value="<?php echo wp_create_nonce( 'mycred-new-transfer-' . $this->reference ); ?>" />
897
  <input type="hidden" name="mycred_new_transfer[reference]" value="<?php echo esc_attr( $this->reference ); ?>" />
898
  <input type="hidden" name="mycred_new_transfer[transfered_attributes]" value="<?php echo esc_attr( $this->encode( $this->shortcode_attr ) ); ?>" />
899
- <input type="submit" class="mycred-submit-transfer<?php echo ' ' . esc_attr( $this->args['button_class'] ); ?>" value="<?php echo esc_attr( $this->args['button'] ); ?>" />
900
  </div>
901
 
902
  </div>
843
  * Get Transfer Form
844
  * Renders the transfer form based on our setup.
845
  * @since 1.8
846
+ * @since 2.3 Changed submit input tag with button tag to make compatible with modern UI
847
  * @version 1.0
848
  */
849
  public function get_transfer_form( $args = array() ) {
897
  <input type="hidden" name="mycred_new_transfer[token]" value="<?php echo wp_create_nonce( 'mycred-new-transfer-' . $this->reference ); ?>" />
898
  <input type="hidden" name="mycred_new_transfer[reference]" value="<?php echo esc_attr( $this->reference ); ?>" />
899
  <input type="hidden" name="mycred_new_transfer[transfered_attributes]" value="<?php echo esc_attr( $this->encode( $this->shortcode_attr ) ); ?>" />
900
+ <button class="mycred-submit-transfer<?php echo ' ' . esc_attr( $this->args['button_class'] ); ?>"><?php echo esc_attr( $this->args['button'] ); ?></button>
901
  </div>
902
 
903
  </div>
assets/css/admin-subscription.css CHANGED
@@ -88,8 +88,20 @@ p {
88
  }
89
 
90
  /** myCred Membership Table **/
91
- .mmc_table{/* background-color:#FFF; */ padding: 0 20px 0 20px;}
92
- .mmc_table_column{background-color:#FFF;}
 
 
 
 
 
 
 
 
 
 
 
 
93
  .mmc_table .mmc_table_plan {
94
  font-size: 18px;
95
  font-weight: bold;
@@ -192,6 +204,8 @@ p {
192
  margin: 10% 0 0 0;
193
  display: block;
194
  padding: 10px 40px;
 
 
195
  }
196
 
197
  .mmc_table .border-right{
@@ -229,8 +243,8 @@ div#tabs_package_1 {
229
  line-height: 42px;
230
  color: #000;
231
  text-decoration: none;
232
- text-transform: uppercase;
233
- position: relative;
234
  }
235
 
236
  #tabs_package_1 a sup {
@@ -328,10 +342,10 @@ line-height:34px;
328
  border-radius: 50%;
329
  }
330
  .show_cont{
331
- display:block!important;
332
  }
333
  .hide_cont{
334
- display:none!important;
335
  }
336
  .row.mycred-money-back {
337
  display: none;
@@ -395,10 +409,10 @@ line-height:34px;
395
  }
396
  @media (max-width: 440px) {
397
  #tabs_package_1 a sup{
398
- margin: 0px;
399
- width:80px;
400
- padding:3px 1px;
401
- }
402
 
403
  #tabs_package_1 a{
404
  display: block;
@@ -470,6 +484,8 @@ line-height:34px;
470
  display: block;
471
  float: none;
472
  position: relative!important;
 
 
473
  }
474
 
475
  #myCRED-wrap h1{
@@ -551,4 +567,30 @@ line-height:34px;
551
 
552
  .mycred-treasure-pack .theme-id-container .theme-actions {
553
  padding: 14px 20px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
  }
88
  }
89
 
90
  /** myCred Membership Table **/
91
+ .mmc_table{
92
+ /* background-color:#FFF; */ padding: 0 20px 0 20px;
93
+ }
94
+ .mmc-packages {
95
+ display: table;
96
+ margin: 0 auto;
97
+ }
98
+ .most-popular{
99
+ position: relative;
100
+ }
101
+ .mmc_table_column{
102
+ background-color:#FFF;
103
+ display: table-cell;
104
+ }
105
  .mmc_table .mmc_table_plan {
106
  font-size: 18px;
107
  font-weight: bold;
204
  margin: 10% 0 0 0;
205
  display: block;
206
  padding: 10px 40px;
207
+ width: 100px;
208
+ margin: 0 auto;
209
  }
210
 
211
  .mmc_table .border-right{
243
  line-height: 42px;
244
  color: #000;
245
  text-decoration: none;
246
+ text-transform: uppercase;
247
+ position: relative;
248
  }
249
 
250
  #tabs_package_1 a sup {
342
  border-radius: 50%;
343
  }
344
  .show_cont{
345
+ display:block!important;
346
  }
347
  .hide_cont{
348
+ display:none!important;
349
  }
350
  .row.mycred-money-back {
351
  display: none;
409
  }
410
  @media (max-width: 440px) {
411
  #tabs_package_1 a sup{
412
+ margin: 0px;
413
+ width:80px;
414
+ padding:3px 1px;
415
+ }
416
 
417
  #tabs_package_1 a{
418
  display: block;
484
  display: block;
485
  float: none;
486
  position: relative!important;
487
+ height: 262.19px;
488
+ width: 262.19px;
489
  }
490
 
491
  #myCRED-wrap h1{
567
 
568
  .mycred-treasure-pack .theme-id-container .theme-actions {
569
  padding: 14px 20px !important;
570
+ }
571
+ .mycred-tools-ba-award-table p{
572
+ margin: 0px;
573
+ }
574
+
575
+ .mycred-tools-ba-award-table tr td:first-child {
576
+ min-width: 200px;
577
+ max-width: 200px;
578
+ }
579
+ .mycred-tools-ba-award-table .tb-zero-padding{
580
+ padding-top: 0px!important;
581
+ padding-bottom: 0px!important;
582
+ }
583
+
584
+ .theme-screenshot-item {
585
+ width: 278px;
586
+ height: 278px;
587
+ margin: auto;
588
+ display: flex;
589
+ align-items: center;
590
+ justify-content: center;
591
+ }
592
+
593
+ .theme-screenshot .theme-screenshot-item img {
594
+ height: unset !important;
595
+ width: 100% !important;
596
  }
assets/css/mycred-admin.css CHANGED
@@ -194,4 +194,11 @@ body.version-3-8 #myCRED-wrap #accordion .ui-accordion-content { border-top: 1px
194
  @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } }
195
  @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
196
 
197
- .mycred-after-core-prefs, .mycred-type-prefs {margin: 0px !important;padding: 0px !important;}
 
 
 
 
 
 
 
194
  @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } }
195
  @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
196
 
197
+ .mycred-after-core-prefs, .mycred-type-prefs {margin: 0px !important;padding: 0px !important;}
198
+ .buycred-cashcred-more-tab-btn .additional-text { font-size: 10px;color: #fff;background: #808080;padding: 4px 5px;border-radius: 3px;margin: 0px 8px;}
199
+ body #myCRED-wrap #accordion .ui-accordion-header.buycred-cashcred-more-tab-btn.disabled-tab, #myCRED-wrap #accordion h4.disabled-tab .dashicons.static {
200
+ color: #929292;
201
+ }
202
+ h4.buycred-cashcred-more-tab-btn.ui-accordion-header.ui-state-active:before, h4.buycred-cashcred-more-tab-btn.ui-accordion-header:before {
203
+ content: '';
204
+ }
assets/css/mycred-buttons.css ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Switch1 */
2
+ .mycred-switch1 {
3
+ position: relative;
4
+ display: inline-block;
5
+ width: 34px;
6
+ height: 21px;
7
+ }
8
+
9
+ .mycred-switch1 input {
10
+ opacity: 0;
11
+ width: 0;
12
+ height: 0;
13
+ }
14
+
15
+ .mycred-switch1 input:checked + .slider {
16
+ background-color: #2196f3;
17
+ }
18
+
19
+ .mycred-switch1 .slider.round {
20
+ border-radius: 34px;
21
+ }
22
+
23
+ .mycred-switch1 .slider {
24
+ position: absolute;
25
+ cursor: pointer;
26
+ top: 0;
27
+ left: 0;
28
+ right: 0;
29
+ bottom: 0;
30
+ background-color: #ccc;
31
+ -webkit-transition: 0.4s;
32
+ transition: 0.4s;
33
+ }
34
+
35
+ .mycred-switch1 input:checked + .slider:before {
36
+ -webkit-transform: translateX(13px);
37
+ -ms-transform: translateX(13px);
38
+ transform: translateX(13px);
39
+ }
40
+
41
+ .mycred-switch1 .slider.round:before {
42
+
43
+ border-radius: 50%;
44
+ }
45
+ .mycred-switch1 .slider:before {
46
+ position: absolute;
47
+ content: "";
48
+ height: 17px;
49
+ width: 16px;
50
+ left: 2px;
51
+ bottom: 2px;
52
+ background-color: #fff;
53
+ -webkit-transition: 0.4s;
54
+ transition: 0.4s;
55
+ }
56
+ /*
57
+ Sample Code
58
+ <label class="mycred-switch1">
59
+ <input type="checkbox" name="" id="">
60
+ <span class="slider round"></span>
61
+ </label>
62
+ */
63
+
64
+ /* Button1 */
65
+ .mycred-button1 {
66
+ -webkit-animation: spin 2s linear infinite;
67
+ animation: spin 2s linear infinite;
68
+ vertical-align: middle;
69
+ display: none;
70
+ }
71
+
72
+ @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } }
73
+ @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
74
+
75
+ /* Sample Code
76
+ <button class="button button-large large button-primary">
77
+ <span class="dashicons dashicons-update mycred-button1"></span>
78
+ Award User
79
+ </button>
80
+ */
assets/css/mycred-front.css CHANGED
@@ -1,4 +1,4 @@
1
- .widget .myCRED-rank{float:right}.widget .myCRED-rank span{padding-right:4px;color:gray}.widget .myCRED-balance{display:block;margin-bottom:24px;text-align:center;font-size:larger}.widget .myCRED-leaderboard .cred{float:right}.widget .myCRED-leaderboard .first-item{font-size:110%}.widget .myCRED-history{padding:0;margin:0;list-style-type:none}.widget .myCRED-history .creds{float:right;padding:0;clear:left}.mycred-nav-rank img{display:inherit}input.mycred-submit-transfer.btn.btn-primary.btn-block.btn-lg{margin:20px 0}input.mycred-autofill.form-control.ui-autocomplete-input{margin-left:20px}.mycred-transfer-form input.form-control{margin-left:28px;margin-top:10px}.site .button:focus,.wp-block-button .wp-block-button__link:focus,.wp-block-search__button:focus,input[type=reset]:focus,input[type=submit]:focus{background:0;outline-offset:-6px;outline:2px solid currentColor}.site textarea:focus,input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus{color:var(--form--color-text);outline-offset:2px;outline:0}.site .button:focus,.wp-block-button .wp-block-button__link:focus,.wp-block-search__button:focus,input[type=reset]:focus,input[type=submit]:focus{background:0;outline-offset:-6px;outline:0}span.form-control-static{text-transform:capitalize;font-weight:400;margin-left:20px}p.form-control-static{margin:0 16px}form#mycred-transfer-form-transfer{background:#f9f9f9;padding:25px;margin:150px 0;box-shadow:0 0 20px 0 rgb(0 0 0 / 20%),0 5px 5px 0 rgb(0 0 0 / 24%);border-radius:10px}form#mycred-transfer-form-donation{background:#f9f9f9;padding:25px;margin:150px 0;box-shadow:0 0 20px 0 rgb(0 0 0 / 20%),0 5px 5px 0 rgb(0 0 0 / 24%);border-radius:10px}input#mycred-transfer-form-message-field{margin-left:24px}span#mycred-transfer-form-amount-field{margin-left:28px}.mycred-badges-list-item img{width:25%;display:inline-block;float:left}.mycred-badges-list-item h3{color:red}.mycred-badges-list-item .mycred-left{float:left;width:72%;margin-left:15px}.mycred-badges-list-item .clear{clear:both}.mycred-badges-list-item .mycred-mr-l{margin-left:25px}.mycred-badges-list-item{border-top:0 solid #9c9c9c;min-height:180px;padding:15px 0;cursor:pointer}.mycred-badges-list-item~.mycred-badges-list-item{border-top-width:1px}.mycred-badges-list h3:first-child{margin-bottom:15px;margin-top:0}.mycred-badges-list-item.not-earned{filter:grayscale(1)}.mycred-tabset .mycred-badge-count{color:#fff;font-size:18px;background:#0173aa;border-radius:50%;padding:0 7px}.mycred-badges-list-item .mycred-sup-category{background:#0173aa;color:#fff;margin:0 3px;padding:2px 6px;font-size:14px;border-radius:4px}ul.mycred-badges-list-tabs{list-style-type:none;display:flex;margin:0;padding:0}ul.mycred-badges-list-tabs li{padding:10px;cursor:pointer;border:1px solid transparent;margin-right:5px;margin-bottom:-1px}ul.mycred-badges-list-tabs li.active{border:1px solid #47525d;border-bottom:1px solid #ccc}.mycred-badges-list-panels{border-top:1px solid #47525d}.mycred-badges-list-panel.active{display:initial}.mycred-badges-list-panel{display:none}.mycred-badge-count{color:#fff;font-size:18px;background:#0173aa;border-radius:50%;padding:0 7px;margin-left:5px}.mycred-badge-page .mycred-level-image{width:150px}.mycred-badge-page .mycred-badge-page-level{float:left;width:30%;text-align:center}.mycred-badge-page .mycred-level-requirement{font-size:19px;text-align:left}.mycred-badge-page .mycred-badge-image{width:150px}.mycred-badge-page-level .mycred-level-image{width:70px}.mycred-float-left{float:left}.mycred-float-right{float:right}.mycred-badge-earner-grid img{width:150px;height:150px;padding:10px}.mycred-badge-earner-grid h4{margin:0}.mycred-badge-earner-grid{text-align:center}.mycred-badges-list-item p{margin-top:0}.mycred-left{float:left}.mycred-right{float:right}.mycred-clear{clear:both}.mycred-remove-margin{margin:0}.mycred-remove-padding{padding:0}.mycred-evidence-page .intro{margin-left:45px}.mycred-evidence-page p{font-size:19px;margin:0}.mycred-evidence-page a{text-decoration:none;color:red}.mycred-evidence-page .dashicons-yes-alt{line-height:inherit;color:green}.mycred-badge-page-level ul{margin-left:0;padding-left:20px}.mycred-badge-page-level .mycred-level-reward{text-align:left}.mycred-level-reward{margin-bottom:15px}.mycred-badge-page-level{margin-right:15px}.mycred-badges-list-item:hover{background:#efefef}.mycred-badge-congratulation-msg{background:#f0f0f0;padding:25px 10px;margin:20px 0;border-radius:5px}li.mycred-strike-off{text-decoration:line-through}.mycred-search-bar{padding:10px 0}.mycred-history-wrapper .pagination>li{display:inline-block;padding:5px}.mycred-badge-page-level h4 {text-align: left;}
2
 
3
 
4
  .mycred_align_left {
1
+ .widget .myCRED-rank{float:right}.widget .myCRED-rank span{padding-right:4px;color:gray}.widget .myCRED-balance{display:block;margin-bottom:24px;text-align:center;font-size:larger}.widget .myCRED-leaderboard .cred{float:right}.widget .myCRED-leaderboard .first-item{font-size:110%}.widget .myCRED-history{padding:0;margin:0;list-style-type:none}.widget .myCRED-history .creds{float:right;padding:0;clear:left}.mycred-nav-rank img{display:inherit}button.mycred-submit-transfer.btn.btn-primary.btn-block.btn-lg{margin:20px 0}input.mycred-autofill.form-control.ui-autocomplete-input{margin-left:20px}.mycred-transfer-form input.form-control{margin-left:28px;margin-top:10px}.site .button:focus,.wp-block-button .wp-block-button__link:focus,.wp-block-search__button:focus,input[type=reset]:focus,input[type=submit]:focus{background:0;outline-offset:-6px;outline:2px solid currentColor}.site textarea:focus,input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus{color:var(--form--color-text);outline-offset:2px;outline:0}.site .button:focus,.wp-block-button .wp-block-button__link:focus,.wp-block-search__button:focus,input[type=reset]:focus,input[type=submit]:focus{background:0;outline-offset:-6px;outline:0}span.form-control-static{text-transform:capitalize;font-weight:400;margin-left:20px}p.form-control-static{margin:0 16px}form#mycred-transfer-form-transfer{background:#f9f9f9;padding:25px;box-shadow:0 0 20px 0 rgb(0 0 0 / 20%),0 5px 5px 0 rgb(0 0 0 / 24%);border-radius:10px}form#mycred-transfer-form-donation{background:#f9f9f9;padding:25px;margin:150px 0;box-shadow:0 0 20px 0 rgb(0 0 0 / 20%),0 5px 5px 0 rgb(0 0 0 / 24%);border-radius:10px}input#mycred-transfer-form-message-field{margin-left:24px}span#mycred-transfer-form-amount-field{margin-left:28px}.mycred-badges-list-item img{width:25%;display:inline-block;float:left}.mycred-badges-list-item h3{color:red}.mycred-badges-list-item .mycred-left{float:left;width:72%;margin-left:15px}.mycred-badges-list-item .clear{clear:both}.mycred-badges-list-item .mycred-mr-l{margin-left:25px}.mycred-badges-list-item{border-top:0 solid #9c9c9c;min-height:180px;padding:15px 0;cursor:pointer}.mycred-badges-list-item~.mycred-badges-list-item{border-top-width:1px}.mycred-badges-list h3:first-child{margin-bottom:15px;margin-top:0}.mycred-badges-list-item.not-earned{filter:grayscale(1)}.mycred-tabset .mycred-badge-count{color:#fff;font-size:18px;background:#0173aa;border-radius:50%;padding:0 7px}.mycred-badges-list-item .mycred-sup-category{background:#0173aa;color:#fff;margin:0 3px;padding:2px 6px;font-size:14px;border-radius:4px}ul.mycred-badges-list-tabs{list-style-type:none;display:flex;margin:0;padding:0}ul.mycred-badges-list-tabs li{padding:10px;cursor:pointer;border:1px solid transparent;margin-right:5px;margin-bottom:-1px}ul.mycred-badges-list-tabs li.active{border:1px solid #47525d;border-bottom:1px solid #ccc}.mycred-badges-list-panels{border-top:1px solid #47525d}.mycred-badges-list-panel.active{display:initial}.mycred-badges-list-panel{display:none}.mycred-badge-count{color:#fff;font-size:18px;background:#0173aa;border-radius:50%;padding:0 7px;margin-left:5px}.mycred-badge-page .mycred-level-image{width:150px}.mycred-badge-page .mycred-badge-page-level{float:left;width:30%;text-align:center}.mycred-badge-page .mycred-level-requirement{font-size:19px;text-align:left}.mycred-badge-page .mycred-badge-image{width:150px}.mycred-badge-page-level .mycred-level-image{width:70px}.mycred-float-left{float:left}.mycred-float-right{float:right}.mycred-badge-earner-grid img{width:150px;height:150px;padding:10px}.mycred-badge-earner-grid h4{margin:0}.mycred-badge-earner-grid{text-align:center}.mycred-badges-list-item p{margin-top:0}.mycred-left{float:left}.mycred-right{float:right}.mycred-clear{clear:both}.mycred-remove-margin{margin:0}.mycred-remove-padding{padding:0}.mycred-evidence-page .intro{margin-left:45px}.mycred-evidence-page p{font-size:19px;margin:0}.mycred-evidence-page a{text-decoration:none;color:red}.mycred-evidence-page .dashicons-yes-alt{line-height:inherit;color:green}.mycred-badge-page-level ul{margin-left:0;padding-left:20px}.mycred-badge-page-level .mycred-level-reward{text-align:left}.mycred-level-reward{margin-bottom:15px}.mycred-badge-page-level{margin-right:15px}.mycred-badges-list-item:hover{background:#efefef}.mycred-badge-congratulation-msg{background:#f0f0f0;padding:25px 10px;margin:20px 0;border-radius:5px}li.mycred-strike-off{text-decoration:line-through}.mycred-search-bar{padding:10px 0}.mycred-history-wrapper .pagination>li{display:inline-block;padding:5px}.mycred-badge-page-level h4 {text-align: left;}
2
 
3
 
4
  .mycred_align_left {
assets/js/mycred-accordion.js CHANGED
@@ -1,6 +1,7 @@
1
  /**
2
  * Accordion
3
  * @since 0.1
 
4
  * @version 1.1
5
  */
6
  jQuery(function($) {
@@ -13,4 +14,9 @@ jQuery(function($) {
13
 
14
  $( "#accordion" ).accordion({ collapsible: true, header: "h4", heightStyle: "content", active: active_box });
15
 
16
- });
 
 
 
 
 
1
  /**
2
  * Accordion
3
  * @since 0.1
4
+ * @since 2.3 Added open in new tab
5
  * @version 1.1
6
  */
7
  jQuery(function($) {
14
 
15
  $( "#accordion" ).accordion({ collapsible: true, header: "h4", heightStyle: "content", active: active_box });
16
 
17
+ $( document ).on( 'click', '.buycred-cashcred-more-tab-btn', function(){
18
+ var $url = $( this ).data( 'url' );
19
+ window.open( $url, '_blank');
20
+ } )
21
+ });
22
+
assets/js/mycred-tools.js ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function() {
2
+
3
+ var $selector = jQuery( '.bulk-award-type' );
4
+
5
+ $selector.select2();
6
+
7
+ $selector.on( "select2:select", function ( e ) {
8
+ if( e.params.data.id == 'points' )
9
+ {
10
+ jQuery( '.bulk-award-point' ).fadeIn();
11
+ jQuery( '.bulk-award-badge' ).fadeOut();
12
+ jQuery( '.bulk-award-rank' ).fadeOut();
13
+ jQuery( '.tools-revoke-btn' ).remove();
14
+ jQuery( '.tools-bulk-assign-award-btn' ).addClass( 'award-points' );
15
+ jQuery( '.tools-bulk-assign-award-btn' ).removeClass( 'award-badges' );
16
+ jQuery( '.tools-bulk-assign-award-btn' ).removeClass( 'award-ranks' );
17
+ jQuery( '.tools-bulk-assign-award-btn' ).html(`Update <span class="dashicons dashicons-update mycred-button1"></span> `);
18
+ }
19
+ else if( e.params.data.id == 'badges' )
20
+ {
21
+ jQuery( '.bulk-award-badge' ).fadeIn();
22
+ jQuery( '.bulk-award-point' ).fadeOut();
23
+ jQuery( '.bulk-award-rank' ).fadeOut();
24
+ jQuery( '.tools-bulk-assign-award-btn' ).after(
25
+ `<button class="button button-large large button-primary tools-revoke-btn" style="margin-left: 10px;">
26
+ <span class="dashicons dashicons-update mycred-button1"></span>
27
+ Revoke
28
+ </button>`
29
+ );
30
+ jQuery( '.tools-bulk-assign-award-btn' ).html(`<span class="dashicons dashicons-update mycred-button1"></span> Award`);
31
+ jQuery( '.tools-bulk-assign-award-btn' ).addClass( 'award-badges' );
32
+ jQuery( '.tools-bulk-assign-award-btn' ).removeClass( 'award-points' );
33
+ jQuery( '.tools-bulk-assign-award-btn' ).removeClass( 'award-ranks' );
34
+ }
35
+ else if( e.params.data.id == 'ranks' )
36
+ {
37
+ jQuery( '.bulk-award-rank' ).fadeIn();
38
+ jQuery( '.bulk-award-point' ).fadeOut();
39
+ jQuery( '.bulk-award-badge' ).fadeOut();
40
+ jQuery( '.tools-revoke-btn' ).remove();
41
+ jQuery( '.tools-bulk-assign-award-btn' ).addClass( 'award-ranks' );
42
+ jQuery( '.tools-bulk-assign-award-btn' ).removeClass( 'award-points' );
43
+ jQuery( '.tools-bulk-assign-award-btn' ).removeClass( 'award-badges' );
44
+ jQuery( '.tools-bulk-assign-award-btn' ).html(`Update <span class="dashicons dashicons-update mycred-button1"></span>`);
45
+ }
46
+ } );
47
+
48
+ //Log Entry
49
+ var $logEntry = jQuery( '.log-entry' ).is( ':checked' );
50
+
51
+ if( $logEntry )
52
+ jQuery( '.log-entry-row' ).show();
53
+ else
54
+ jQuery( '.log-entry-row' ).hide();
55
+
56
+ jQuery(".log-entry").change(function() {
57
+ if( this.checked )
58
+ jQuery( '.log-entry-row' ).show();
59
+ else
60
+ jQuery( '.log-entry-row' ).hide();
61
+ });
62
+
63
+
64
+ //Pointtype
65
+ $selector = jQuery( '.bulk-award-pt' );
66
+ $selector.select2( {
67
+
68
+ } );
69
+
70
+ //Users
71
+ $selector = jQuery( '.bulk-users' );
72
+ $selector.select2();
73
+
74
+ var $awardToAll = jQuery( '.award-to-all' ).is( ':checked' );
75
+
76
+ if( !$awardToAll )
77
+ jQuery( '.users-row' ).show();
78
+ else
79
+ jQuery( '.users-row' ).hide();
80
+
81
+ jQuery(".award-to-all").change(function() {
82
+ if( !this.checked )
83
+ jQuery( '.users-row' ).show();
84
+ else
85
+ jQuery( '.users-row' ).hide();
86
+ });
87
+
88
+ //User Roles
89
+ $selector = jQuery( '.bulk-roles' );
90
+ $selector.select2();
91
+
92
+
93
+ //Badges
94
+ $selector = jQuery( '.bulk-badges' );
95
+ $selector.select2();
96
+
97
+ //Ranks
98
+ $selector = jQuery( '.bulk-ranks' );
99
+ $selector.select2();
100
+
101
+ //Bulk Assign AJAX
102
+ jQuery( document ).on( 'click', '.tools-bulk-assign-award-btn', function(e){
103
+
104
+ e.preventDefault();
105
+
106
+ var $confirm;
107
+
108
+ var $selectedType = jQuery( '.bulk-award-type' ).find( ':selected' ).val();
109
+ var $pointsToAward = jQuery( '[name="bulk_award_point"]' ).val();
110
+ var $pointType = jQuery( '[name="bulk_award_pt"]' ).val();
111
+ var $logEntry = jQuery( '.log-entry' ).prop('checked');
112
+ var $logEntryText = jQuery( '[name="log_entry_text"]' ).val();
113
+ var $awardToAllUsers = jQuery( '.award-to-all' ).prop('checked');
114
+ var $users = JSON.stringify( jQuery( '[name="bulk_users"]' ).val() );
115
+ var $user_roles = JSON.stringify( jQuery( '[name="bulk_roles"]' ).val() );
116
+
117
+ if( $pointsToAward < 0 )
118
+ $confirm = confirm( mycredTools.revokeConfirmText );
119
+ else
120
+ $confirm = confirm( mycredTools.awardConfirmText );
121
+
122
+ if( !$confirm )
123
+ return false;
124
+
125
+ //Ranks
126
+ var $rankToAward = jQuery( '.bulk-ranks' ).find( ':selected' ).val();
127
+
128
+ //Badges
129
+ var $badgesToAward = JSON.stringify( jQuery( '[name="bulk_badges"]' ).val() );
130
+
131
+ jQuery.ajax({
132
+ url: ajaxurl,
133
+ type: 'POST',
134
+ data: {
135
+ action: 'mycred-tools-assign-award',
136
+ selected_type: $selectedType,
137
+ points_to_award: $pointsToAward,
138
+ point_type: $pointType,
139
+ log_entry: $logEntry,
140
+ log_entry_text: $logEntryText,
141
+ award_to_all_users: $awardToAllUsers,
142
+ users: $users,
143
+ user_roles: $user_roles,
144
+ //Ranks
145
+ rank_to_award: $rankToAward,
146
+ //Badges
147
+ badges_to_award: $badgesToAward
148
+
149
+ },
150
+ beforeSend: function()
151
+ {
152
+ jQuery( '.tools-bulk-assign-award-btn' ).find( 'span' ).css( 'display','inherit' );
153
+ },
154
+ success: function( data )
155
+ {
156
+ jQuery( '.tools-bulk-assign-award-btn' ).find( 'span' ).hide();
157
+
158
+ if( data.success === true && $pointsToAward < 0 )
159
+ {
160
+ alert( mycredTools.successfullyDeducted );
161
+ resetForm();
162
+ return;
163
+ }
164
+
165
+ if( data.success === true )
166
+ {
167
+ alert( mycredTools.successfullyAwarded );
168
+ resetForm();
169
+ }
170
+
171
+ if( data.success == 'pointsRequired' )
172
+ {
173
+ alert( mycredTools.pointsRequired );
174
+ }
175
+ if( data.success == 'logEntryRequired' )
176
+ {
177
+ alert( mycredTools.logEntryRequired );
178
+ }
179
+ if( data.success == 'userOrRoleIsRequired' )
180
+ {
181
+ alert( mycredTools.userOrRoleIsRequired );
182
+ }
183
+ if( data.success == 'badgesFieldRequried' )
184
+ {
185
+ alert( mycredTools.badgesFieldRequried );
186
+ }
187
+ }
188
+ })
189
+ } );
190
+
191
+ //jQuery Bulk Revoke
192
+ jQuery( document ).on( 'click', '.tools-revoke-btn', function(e){
193
+
194
+ e.preventDefault();
195
+
196
+ var $confirm = confirm( mycredTools.revokeConfirmText );
197
+
198
+ if( !$confirm )
199
+ return false;
200
+
201
+ var $selectedType = jQuery( '.bulk-award-type' ).find( ':selected' ).val();
202
+ var $badgesToRevoke = JSON.stringify( jQuery( '[name="bulk_badges"]' ).val() );
203
+ var $awardToAllUsers = jQuery( '.award-to-all' ).prop('checked');
204
+ var $users = JSON.stringify( jQuery( '[name="bulk_users"]' ).val() );
205
+ var $user_roles = JSON.stringify( jQuery( '[name="bulk_roles"]' ).val() );
206
+
207
+
208
+ jQuery.ajax({
209
+ url: ajaxurl,
210
+ type: 'POST',
211
+ data: {
212
+ action: 'mycred-tools-assign-award',
213
+ selected_type: $selectedType,
214
+ revoke: 'revoke',
215
+ badges_to_revoke: $badgesToRevoke,
216
+ award_to_all_users: $awardToAllUsers,
217
+ users: $users,
218
+ user_roles: $user_roles,
219
+ },
220
+ beforeSend: function()
221
+ {
222
+ jQuery( '.tools-revoke-btn' ).find( 'span' ).css( 'display','inherit' );
223
+ },
224
+ success: function( data )
225
+ {
226
+ jQuery( '.tools-revoke-btn' ).find( 'span' ).hide();
227
+
228
+ if( data.success === true )
229
+ {
230
+ alert( mycredTools.successfullyRevoked );
231
+ resetForm();
232
+ }
233
+ if( data.success == 'userOrRoleIsRequired' )
234
+ {
235
+ alert( mycredTools.userOrRoleIsRequired );
236
+ }
237
+ if( data.success == 'badgesFieldRequried' )
238
+ {
239
+ alert( mycredTools.badgesFieldRequried );
240
+ }
241
+ }
242
+ });
243
+ } );
244
+ } );
245
+
246
+ //Reset Form
247
+ function resetForm()
248
+ {
249
+ var $selectedValue = jQuery('.bulk-award-type').val();
250
+ jQuery(".mycred-tools-ba-award-form").trigger('reset');
251
+ jQuery('#bulk-users').val(null).trigger('change');
252
+ jQuery('#bulk-roles').val(null).trigger('change');
253
+ jQuery('#bulk-badges').val(null).trigger('change');
254
+ jQuery('#bulk-ranks').val(null).trigger('change');
255
+ jQuery(".log-entry").removeAttr("checked");
256
+ jQuery( '.log-entry-row' ).hide();
257
+ jQuery(".award-to-all").removeAttr("checked");
258
+ jQuery( '.users-row' ).show();
259
+ jQuery('.bulk-award-type').val( $selectedValue );
260
+ }
assets/js/mycred-type-management.js CHANGED
@@ -426,4 +426,13 @@ jQuery(function($) {
426
 
427
  });
428
 
429
- });
 
 
 
 
 
 
 
 
 
426
 
427
  });
428
 
429
+ /**
430
+ * Select2 Exclude User by ID and Roles
431
+ * @since 2.3
432
+ */
433
+ jQuery( '#generalexcludelist' ).select2();
434
+ jQuery( '#generalexcludebyroles' ).select2();
435
+
436
+ });
437
+
438
+
assets/screenshot-1.png CHANGED
Binary file
assets/screenshot-2.png CHANGED
Binary file
assets/screenshot-3.png CHANGED
Binary file
assets/screenshot-4.png CHANGED
Binary file
assets/screenshot-5.png CHANGED
Binary file
includes/classes/class.query-leaderboard.php CHANGED
@@ -734,25 +734,29 @@ if ( ! class_exists( 'myCRED_Query_Leaderboard' ) ) :
734
 
735
  global $wpdb;
736
 
737
- // Start of the week based of our settings
738
- $week_starts = get_option( 'start_of_week' );
739
- if ( $week_starts == 0 )
740
- $week_starts = 'sunday';
741
- else
742
- $week_starts = 'monday';
743
-
744
  // Filter: Daily
745
- if ( $this->args['timeframe'] == 'today' )
746
  $query = $wpdb->prepare( "AND l.time BETWEEN %d AND %d", strtotime( 'today midnight', $this->now ), $this->args['now'] );
747
-
748
  // Filter: Weekly
749
- elseif ( $this->args['timeframe'] == 'this-week' )
750
- $query = $wpdb->prepare( "AND l.time BETWEEN %d AND %d", strtotime( $week_starts . ' this week', $this->now ), $this->args['now'] );
 
 
751
 
 
 
 
 
 
 
 
 
 
752
  // Filter: Monthly
753
- elseif ( $this->args['timeframe'] == 'this-month' )
754
  $query = $wpdb->prepare( "AND l.time BETWEEN %d AND %d", strtotime( date( 'Y-m-01', $this->now ) ), $this->args['now'] );
755
-
756
  else {
757
 
758
  $start_from = strtotime( $this->args['timeframe'], $this->now );
734
 
735
  global $wpdb;
736
 
 
 
 
 
 
 
 
737
  // Filter: Daily
738
+ if ( $this->args['timeframe'] == 'today' ) {
739
  $query = $wpdb->prepare( "AND l.time BETWEEN %d AND %d", strtotime( 'today midnight', $this->now ), $this->args['now'] );
740
+ }
741
  // Filter: Weekly
742
+ elseif ( $this->args['timeframe'] == 'this-week' ) {
743
+
744
+ // Start of the week based of our settings
745
+ $days = array( 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' );
746
 
747
+ $week_starts = get_option( 'start_of_week' );
748
+
749
+ if ( $days[ $week_starts ] == date('l') )
750
+ $week_starts = 'today midnight';
751
+ else
752
+ $week_starts = 'last ' . $days[ $week_starts ];
753
+
754
+ $query = $wpdb->prepare( "AND l.time BETWEEN %d AND %d", strtotime( $week_starts, $this->now ), $this->args['now'] );
755
+ }
756
  // Filter: Monthly
757
+ elseif ( $this->args['timeframe'] == 'this-month' ) {
758
  $query = $wpdb->prepare( "AND l.time BETWEEN %d AND %d", strtotime( date( 'Y-m-01', $this->now ) ), $this->args['now'] );
759
+ }
760
  else {
761
 
762
  $start_from = strtotime( $this->args['timeframe'], $this->now );
includes/classes/class.query-log.php CHANGED
@@ -2754,14 +2754,15 @@ endif;
2754
  /**
2755
  * Get Search Args
2756
  * Converts URL arguments into an array of log query friendly arguments.
2757
- * @since 1.7
 
2758
  * @version 1.0.3
2759
  */
2760
  if ( ! function_exists( 'mycred_get_search_args' ) ) :
2761
  function mycred_get_search_args( $exclude = NULL ) {
2762
 
2763
  if ( $exclude === NULL )
2764
- $exclude = array( 'page', 'mycred-export', 'mycred-action', 'action', 'set', '_token' );
2765
 
2766
  $search_args = array();
2767
  if ( ! empty( $_GET ) ) {
2754
  /**
2755
  * Get Search Args
2756
  * Converts URL arguments into an array of log query friendly arguments.
2757
+ * @since 1.8
2758
+ * @since 2.3 Added `fields` in exclude array to prevent SQL Injection
2759
  * @version 1.0.3
2760
  */
2761
  if ( ! function_exists( 'mycred_get_search_args' ) ) :
2762
  function mycred_get_search_args( $exclude = NULL ) {
2763
 
2764
  if ( $exclude === NULL )
2765
+ $exclude = array( 'page', 'mycred-export', 'mycred-action', 'action', 'set', '_token', 'fields' );
2766
 
2767
  $search_args = array();
2768
  if ( ! empty( $_GET ) ) {
includes/hooks/mycred-hook-referrals.php CHANGED
@@ -448,6 +448,7 @@ if ( ! class_exists( 'myCRED_Hook_Affiliate' ) ) :
448
  * Get Ref ID
449
  * Returns a given users referral ID.
450
  * @since 1.4
 
451
  * @version 1.1
452
  */
453
  public function get_ref_id( $user_id ) {
@@ -473,13 +474,20 @@ if ( ! class_exists( 'myCRED_Hook_Affiliate' ) ) :
473
  $number = $counter+1;
474
 
475
  mycred_update_option( 'mycred_affiliate_counter', $number );
 
 
 
476
  mycred_update_user_meta( $user_id, 'mycred_affiliate_link', '', $number );
477
 
478
  $ref_id = $number;
479
 
480
  }
481
  else {
 
 
 
482
  $ref_id = $id;
 
483
  }
484
 
485
  break;
@@ -493,10 +501,14 @@ if ( ! class_exists( 'myCRED_Hook_Affiliate' ) ) :
493
  /**
494
  * Get User ID from Ref ID
495
  * @since 1.4
 
496
  * @version 1.0.1
497
  */
498
  public function get_user_id_from_ref_id( $string = '' ) {
499
 
 
 
 
500
  global $wpdb;
501
 
502
  $user_id = NULL;
@@ -526,6 +538,7 @@ if ( ! class_exists( 'myCRED_Hook_Affiliate' ) ) :
526
  if ( $user_id !== NULL && $this->core->exclude_user( $user_id ) )
527
  $user_id = NULL;
528
 
 
529
  return apply_filters( 'mycred_affiliate_get_user_id', $user_id, $string, $this );
530
 
531
  }
@@ -838,4 +851,4 @@ if ( ! function_exists( 'copy_ref_link' ) ) :
838
  </script>
839
  <?php
840
  }
841
- endif;
448
  * Get Ref ID
449
  * Returns a given users referral ID.
450
  * @since 1.4
451
+ * @since 2.3 Filter `mycred_affiliate_user_id` added
452
  * @version 1.1
453
  */
454
  public function get_ref_id( $user_id ) {
474
  $number = $counter+1;
475
 
476
  mycred_update_option( 'mycred_affiliate_counter', $number );
477
+
478
+ $number = apply_filters( 'mycred_affiliate_user_id', $number );
479
+
480
  mycred_update_user_meta( $user_id, 'mycred_affiliate_link', '', $number );
481
 
482
  $ref_id = $number;
483
 
484
  }
485
  else {
486
+
487
+ $id = apply_filters( 'mycred_affiliate_user_id', $id );
488
+
489
  $ref_id = $id;
490
+
491
  }
492
 
493
  break;
501
  /**
502
  * Get User ID from Ref ID
503
  * @since 1.4
504
+ * @since 2.3 @filter added `mycred_affiliate_by_user_id`
505
  * @version 1.0.1
506
  */
507
  public function get_user_id_from_ref_id( $string = '' ) {
508
 
509
+ if( apply_filters( 'mycred_affiliate_by_user_id', false ) )
510
+ return $string;
511
+
512
  global $wpdb;
513
 
514
  $user_id = NULL;
538
  if ( $user_id !== NULL && $this->core->exclude_user( $user_id ) )
539
  $user_id = NULL;
540
 
541
+
542
  return apply_filters( 'mycred_affiliate_get_user_id', $user_id, $string, $this );
543
 
544
  }
851
  </script>
852
  <?php
853
  }
854
+ endif;
includes/mycred-about.php CHANGED
@@ -535,23 +535,15 @@ function mycred_about_page() {
535
  <div class="block">
536
  <h2>Change Log</h2>
537
  <ul>
538
- <li><strong>NEW</strong> - Moved general settings and menus into the newly introduced "myCred" main menu.</li>
539
- <li><strong>NEW</strong> - On plugin activation, the default point type will be created automatically.</li>
540
- <li><strong>NEW</strong> - Now user can upload a Point type image.</li>
541
- <li><strong>NEW</strong> - Introduced an image attribute in mycred_my_balance shortcode.</li>
542
- <li><strong>NEW</strong> - Introduced an image attribute in mycred_leaderboard shortcode.</li>
543
- <li><strong>NEW</strong> - Introduced Single badge page layout setting.</li>
544
- <li><strong>NEW</strong> - Introduced a enable/disable all addons button.</li>
545
- <li><strong>NEW</strong> - Added new template tags in email notification for transfer events.</li>
546
- <li><strong>NEW</strong> - Users can share their achieved Badges on social media.</li>
547
- <li><strong>FIX</strong> - Backend logs are not being exported whether the export raw/formatted log option is set.</li>
548
- <li><strong>FIX</strong> - Incorrect achieved badge level image in [mycred_badges] shortcode.</li>
549
- <li><strong>FIX</strong> - In the Ranks list page All/Published/Trash links not working properly.</li>
550
- <li><strong>FIX</strong> - Unable to revoke badge from the User profile page. FIX – Added some security validations in the transfer form.</li>
551
- <li><strong>FIX</strong> - MYSQL 8 syntax error in the leaderboard shortcode.</li>
552
- <li><strong>FIX</strong> - Added compatibility with BuddyPress version 8.0.</li>
553
- <li><strong>TWEAK</strong> - When a user deletes the log of buy_content, the sales count does not get updated. So, we have Introduced the "Update Sales Count" button in the settings.</li>
554
- <li><strong>TWEAK</strong> - Improve new point type creation form setting.</li>
555
  </ul>
556
  </div>
557
  </div><!-- /.mycred-change-log -->
535
  <div class="block">
536
  <h2>Change Log</h2>
537
  <ul>
538
+ <li><strong>NEW</strong> - Introduced a "Bulk Assign" tool for awarding/revoking points, badges, and ranks.</li>
539
+ <li><strong>NEW</strong> - Introduced a new feature "Exclude by user role" admin can exclude any user role from the specific point type.</li>
540
+ <li><strong>NEW</strong> - Introduced a timeframe attribute in [mycred_my_balance_converted] shortcode. Now you can show users converted balance of a given timeframe today, yesterday, this week, this month, last month.</li>
541
+ <li><strong>FIX</strong> - Sometimes user's ranks were not updating automatically.</li>
542
+ <li><strong>FIX</strong> - Membership page layout issues.</li>
543
+ <li><strong>FIX</strong> - Points conversion not working when using arrows to increase or decrease the amount in [mycred_cashcred] shortcode.</li>
544
+ <li><strong>FIX</strong> - buyCred payment dialog couldn’t load on the subsite.</li>
545
+ <li><strong>FIX</strong> - After deleting the badge their data will keep existing on the user's meta.</li>
546
+ <li><strong>FIX</strong> - "this-week" value not working in [mycred_leaderboard] timeframe attribute when the week starts other than "Monday" in your WordPress setting.</li>
 
 
 
 
 
 
 
 
547
  </ul>
548
  </div>
549
  </div><!-- /.mycred-change-log -->
includes/mycred-functions.php CHANGED
@@ -112,7 +112,8 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
112
  /**
113
  * Default Settings
114
  * @since 1.3
115
- * @version 1.1
 
116
  */
117
  public function defaults() {
118
 
@@ -140,7 +141,8 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
140
  'exclude' => array(
141
  'plugin_editors' => 0,
142
  'cred_editors' => 0,
143
- 'list' => ''
 
144
  ),
145
  'frequency' => array(
146
  'rate' => 'always',
@@ -1010,7 +1012,8 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
1010
  * Check if user id is in exclude list
1011
  * @return true or false
1012
  * @since 0.1
1013
- * @version 1.1
 
1014
  */
1015
  public function in_exclude_list( $user_id = '' ) {
1016
 
@@ -1027,6 +1030,26 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
1027
  if ( in_array( $user_id, $list ) )
1028
  $result = true;
1029
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1030
  return apply_filters( 'mycred_is_excluded_list', $result, $user_id );
1031
 
1032
  }
@@ -1348,14 +1371,15 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
1348
  * @param $user_id (int), required user id
1349
  * @param $new_balance (int|float), amount to add/deduct from users balance. This value must be pre-formated.
1350
  * @returns (bool) true on success or false on fail.
 
1351
  * @since 1.7.3
1352
- * @version 1.1
1353
  */
1354
  public function set_users_balance( $user_id = NULL, $new_balance = NULL ) {
1355
 
1356
  // Minimum Requirements: User id and amount can not be null
1357
  if ( $user_id === NULL || $new_balance === NULL ) return false;
1358
-
1359
  global $mycred_current_account;
1360
 
1361
  $point_type = $this->get_point_type_key();
@@ -1370,6 +1394,15 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
1370
  // Clear caches
1371
  mycred_delete_option( 'mycred-cache-total-' . $point_type );
1372
 
 
 
 
 
 
 
 
 
 
1373
  // Let others play
1374
  do_action( 'mycred_set_user_balance', $user_id, $new_balance, $this );
1375
 
@@ -1910,7 +1943,7 @@ if ( ! function_exists( 'mycred_get_addon_settings' ) ) :
1910
  if ( isset( $mycred->$addon ) )
1911
  $settings = $mycred->$addon;
1912
 
1913
- if ( $settings === false && isset( $main_type->$addon ) )
1914
  $settings = $main_type->$addon;
1915
 
1916
  if ( empty( $settings ) )
@@ -2629,7 +2662,7 @@ if ( ! function_exists( 'mycred_types_select_from_checkboxes' ) ) :
2629
 
2630
  $id .= '-' . $type;
2631
 
2632
- $output .= '<label for="' . $id . '"><input type="checkbox" name="' . $name . '" id="' . $id . '" value="' . $type . '"' . $selected . ' /> ' . $label . '</label>';
2633
  }
2634
  }
2635
 
@@ -4106,4 +4139,117 @@ function mycred_get_default_point_image_id()
4106
 
4107
  return $image_id;
4108
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4109
  endif;
112
  /**
113
  * Default Settings
114
  * @since 1.3
115
+ * @since 2.3 Added `by_roles` in exclude
116
+ * @version 1.2
117
  */
118
  public function defaults() {
119
 
141
  'exclude' => array(
142
  'plugin_editors' => 0,
143
  'cred_editors' => 0,
144
+ 'list' => '',
145
+ 'by_roles' => ''
146
  ),
147
  'frequency' => array(
148
  'rate' => 'always',
1012
  * Check if user id is in exclude list
1013
  * @return true or false
1014
  * @since 0.1
1015
+ * @since 2.3 Added to check is user is excluded by role
1016
+ * @version 1.2
1017
  */
1018
  public function in_exclude_list( $user_id = '' ) {
1019
 
1030
  if ( in_array( $user_id, $list ) )
1031
  $result = true;
1032
 
1033
+ //Check if Excluded by Role
1034
+ if( !$result && !empty( $this->exclude['by_roles'] ) )
1035
+ {
1036
+ $roles = explode( ',', $this->exclude['by_roles'] );
1037
+
1038
+ $user = get_user_by( 'id', $user_id );
1039
+
1040
+ $user_roles = $user->roles;
1041
+
1042
+ foreach( $roles as $role )
1043
+ {
1044
+ if( in_array( $role, $user_roles ) )
1045
+ {
1046
+ $result = true;
1047
+ break;
1048
+ }
1049
+ }
1050
+
1051
+ }
1052
+
1053
  return apply_filters( 'mycred_is_excluded_list', $result, $user_id );
1054
 
1055
  }
1371
  * @param $user_id (int), required user id
1372
  * @param $new_balance (int|float), amount to add/deduct from users balance. This value must be pre-formated.
1373
  * @returns (bool) true on success or false on fail.
1374
+ * @since 2.3 `$results` and do_action `mycred_finish_without_log_entry` added, to update users' rank when updating from profile page manually.
1375
  * @since 1.7.3
1376
+ * @version 1.2
1377
  */
1378
  public function set_users_balance( $user_id = NULL, $new_balance = NULL ) {
1379
 
1380
  // Minimum Requirements: User id and amount can not be null
1381
  if ( $user_id === NULL || $new_balance === NULL ) return false;
1382
+
1383
  global $mycred_current_account;
1384
 
1385
  $point_type = $this->get_point_type_key();
1394
  // Clear caches
1395
  mycred_delete_option( 'mycred-cache-total-' . $point_type );
1396
 
1397
+ $result = array(
1398
+ 'current' => $new_balance,
1399
+ 'user_id' => $user_id,
1400
+ 'reference' => 'manual',
1401
+ 'type' => $point_type
1402
+ );
1403
+
1404
+ do_action( 'mycred_finish_without_log_entry', $result );
1405
+
1406
  // Let others play
1407
  do_action( 'mycred_set_user_balance', $user_id, $new_balance, $this );
1408
 
1943
  if ( isset( $mycred->$addon ) )
1944
  $settings = $mycred->$addon;
1945
 
1946
+ if ( $settings === false && isset( $main_type->$addon ) && $point_type == MYCRED_DEFAULT_TYPE_KEY )
1947
  $settings = $main_type->$addon;
1948
 
1949
  if ( empty( $settings ) )
2662
 
2663
  $id .= '-' . $type;
2664
 
2665
+ $output .= '<div class="mycred-notify-pt-wrapper"><label for="' . $id . '"><input type="checkbox" name="' . $name . '" id="' . $id . '" value="' . $type . '"' . $selected . ' /> ' . $label . '</label></div>';
2666
  }
2667
  }
2668
 
4139
 
4140
  return $image_id;
4141
  }
4142
+ endif;
4143
+
4144
+ /**
4145
+ * Creates select2
4146
+ * @since 2.3
4147
+ * @version 1.0
4148
+ */
4149
+ if( !function_exists( 'mycred_create_select2' ) ):
4150
+ function mycred_create_select2( $options = '', $attributes = array(), $selected = array() )
4151
+ {
4152
+ $content = '';
4153
+ $is_selected = false;
4154
+ $content .= "<select ";
4155
+
4156
+ if( !empty( $attributes ) )
4157
+ foreach( $attributes as $attr => $value )
4158
+ $content .= "{$attr}='{$value}'";
4159
+
4160
+ $content .= "style='width: 168px;'>";
4161
+
4162
+ if( !empty( $options ) )
4163
+ {
4164
+ foreach( $options as $key => $value )
4165
+ {
4166
+ foreach( $selected as $s_key )
4167
+ {
4168
+ if( $s_key == $key )
4169
+ {
4170
+ $content .= "<option selected='selected' value='{$key}'>{$value}</option>";
4171
+ $is_selected = true;
4172
+ }
4173
+ }
4174
+ if( $is_selected )
4175
+ {
4176
+ $is_selected = false;
4177
+ continue;
4178
+ }
4179
+ $content .= "<option value='{$key}'>{$value}</option>";
4180
+ }
4181
+ }
4182
+
4183
+ $content .= "</select>";
4184
+
4185
+ return $content;
4186
+ }
4187
+ endif;
4188
+
4189
+ /**
4190
+ * Get Ranks Point type
4191
+ * @var int $rank_id
4192
+ * @since 2.3
4193
+ * @version 1.0
4194
+ * @return bool|string
4195
+ */
4196
+ if ( !function_exists( 'mycred_get_rank_pt' ) ):
4197
+ function mycred_get_rank_pt( $rank_id )
4198
+ {
4199
+ $pt = get_post_meta( $rank_id, 'ctype', true );
4200
+
4201
+ if( $pt )
4202
+ return $pt;
4203
+ else
4204
+ return false;
4205
+ }
4206
+ endif;
4207
+
4208
+ /**
4209
+ * Get Email Notice Instances
4210
+ * Returns an array of supported instances where an email can be sent by this add-on.
4211
+ * @since 1.8
4212
+ * @since 2.3 Moved from Email Norification
4213
+ * @version 1.0
4214
+ */
4215
+ if ( ! function_exists( 'mycred_get_email_instances' ) ) :
4216
+ function mycred_get_email_instances( $none = true ) {
4217
+
4218
+ $instances = array();
4219
+
4220
+ if ( $none ) $instances[''] = __( 'Select', 'mycred' );
4221
+
4222
+ $instances['any'] = __( 'users balance changes', 'mycred' );
4223
+ $instances['positive'] = __( 'users balance increases', 'mycred' );
4224
+ $instances['negative'] = __( 'users balance decreases', 'mycred' );
4225
+ $instances['zero'] = __( 'users balance reaches zero', 'mycred' );
4226
+ $instances['minus'] = __( 'users balance goes negative', 'mycred' );
4227
+
4228
+ if ( class_exists( 'myCRED_Badge_Module' ) ) {
4229
+ $instances['badge_new'] = __( 'user gains a badge', 'mycred' );
4230
+ $instances['badge_level'] = __( 'user gains a new badge level', 'mycred' );
4231
+ }
4232
+
4233
+ if ( class_exists( 'myCRED_Ranks_Module' ) ) {
4234
+ $instances['rank_up'] = __( 'user is promoted to a higher rank', 'mycred' );
4235
+ $instances['rank_down'] = __( 'user is demoted to a lower rank', 'mycred' );
4236
+ }
4237
+
4238
+ if ( class_exists( 'myCRED_Transfer_Module' ) ) {
4239
+ $instances['transfer_out'] = __( 'user sends a transfer', 'mycred' );
4240
+ $instances['transfer_in'] = __( 'user receives a transfer', 'mycred' );
4241
+ }
4242
+
4243
+ if ( class_exists( 'myCRED_cashCRED_Module' ) ) {
4244
+ $instances['cashcred_approved'] = __( 'cashcred withdraw approval', 'mycred' );
4245
+ $instances['cashcred_pending'] = __( 'cashcred withdraw pending', 'mycred' );
4246
+ $instances['cashcred_cancel'] = __( 'cashcred cancel', 'mycred' );
4247
+ }
4248
+
4249
+
4250
+ $instances['custom'] = __( 'a custom event occurs', 'mycred' );
4251
+
4252
+ return apply_filters( 'mycred_email_instances', $instances );
4253
+
4254
+ }
4255
  endif;
includes/mycred-tools-bulk-assign.php ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( !class_exists( 'myCRED_Tools_Bulk_Assign' ) ):
3
+ class myCRED_Tools_Bulk_Assign extends myCRED_Tools
4
+ {
5
+
6
+ private static $_instance;
7
+
8
+ public static function get_instance()
9
+ {
10
+ if (self::$_instance == null)
11
+ self::$_instance = new self();
12
+
13
+ return self::$_instance;
14
+ }
15
+
16
+ public function __construct()
17
+ {
18
+ add_action( 'wp_ajax_mycred-tools-assign-award', array( $this, 'tools_assign_award' ) );
19
+ }
20
+
21
+ public function get_page()
22
+ {
23
+ // Points
24
+ $award_type = array(
25
+ 'points' => __( 'Points', 'mycred' )
26
+ );
27
+
28
+ if( class_exists( 'myCRED_Badge_Module' ) ) $award_type['badges'] = __( 'Badges', 'mycred' );
29
+
30
+ if( class_exists( 'myCRED_Ranks_Module' ) ) $award_type['ranks'] = __( 'Ranks', 'mycred' );
31
+
32
+ $award_args = array(
33
+ 'class' => 'bulk-award-type',
34
+ 'name' => 'bulk_award_type',
35
+ 'id' => 'bulk-award-type'
36
+ );
37
+
38
+ $point_types = mycred_get_types();
39
+
40
+ $pt_args = array(
41
+ 'name' => 'bulk_award_pt',
42
+ 'id' => 'bulk-award-pt',
43
+ 'class' => 'bulk-award-pt'
44
+ );
45
+
46
+ $user_args = array(
47
+ 'users' => array(
48
+ 'name' => 'bulk_users',
49
+ 'class' => 'bulk-users',
50
+ 'id' => 'bulk-users'
51
+ ),
52
+ 'roles' => array(
53
+ 'name' => 'bulk_roles',
54
+ 'class' => 'bulk-roles',
55
+ 'id' => 'bulk-roles'
56
+ ),
57
+ );
58
+
59
+ //Badges
60
+ $badges_args = array(
61
+ 'name' => 'bulk_badges',
62
+ 'id' => 'bulk-badges',
63
+ 'class' => 'bulk-badges',
64
+ 'multiple' => 'multiple'
65
+ );
66
+
67
+ $badges = array();
68
+ if (class_exists('myCRED_Badge')){
69
+
70
+ $badge_ids = mycred_get_badge_ids();
71
+
72
+ foreach( $badge_ids as $id )
73
+ $badges[$id] = get_the_title( $id );
74
+ }
75
+
76
+ //Ranks
77
+ $ranks_args = array(
78
+ 'name' => 'bulk_ranks',
79
+ 'id' => 'bulk-ranks',
80
+ 'class' => 'bulk-ranks'
81
+ );
82
+
83
+ $ranks = array();
84
+
85
+ foreach( $point_types as $key => $pt )
86
+ {
87
+ $mycred_ranks = '';
88
+
89
+ if( class_exists( 'myCRED_Ranks_Module' ) && mycred_manual_ranks( $key ) )
90
+ {
91
+ $mycred_ranks = mycred_get_ranks( 'publish', '-1', 'ASC', $key );
92
+
93
+ foreach( $mycred_ranks as $key => $value )
94
+ {
95
+ $ranks[$value->post->ID] = "{$value->post->post_title} ({$pt})";
96
+ }
97
+ }
98
+ }
99
+
100
+ ?>
101
+ <h1>Award/ Revoke</h1>
102
+ <form class="mycred-tools-ba-award-form">
103
+ <table width="" class="mycred-tools-ba-award-table" cellpadding="10">
104
+ <thead>
105
+ <tr>
106
+ <td><label for=""><?php _e( 'Select Type', 'mycred' ) ?></label></td>
107
+ <td><?php echo mycred_create_select2( $award_type, $award_args ); ?></td>
108
+ </tr>
109
+ </thead>
110
+
111
+ <tbody class="bulk-award-point">
112
+
113
+ <tr>
114
+ <td><label for=""><?php _e( 'Points to Award/ Revoke', 'mycred' ) ?></label></td>
115
+ <td>
116
+ <input type="number" name="bulk_award_point">
117
+ </td>
118
+ </tr>
119
+
120
+ <tr>
121
+ <td class="tb-zero-padding"></td>
122
+ <td class="tb-zero-padding">
123
+ <p><i>
124
+ <?php _e( 'Either set points are Positive to award or in Negative to deduct.', 'mycred' ); ?>
125
+ </i></p>
126
+ <p><i>
127
+ <?php _e( 'eg. 10 or -100 ', 'mycred' ); ?>
128
+ </i></p>
129
+ </td>
130
+ </tr>
131
+
132
+ <tr>
133
+ <td><label for=""><?php _e( 'Select Point Type', 'mycred' ) ?></label></td>
134
+ <td><?php echo mycred_create_select2( $point_types, $pt_args ); ?></td>
135
+ </tr>
136
+
137
+ <tr>
138
+ <td><label for=""><?php _e( 'Enable to Log Entry', 'mycred' ) ?></label></td>
139
+ <td>
140
+ <label class="mycred-switch1">
141
+ <input type="checkbox" value="1" class="log-entry">
142
+ <span class="slider round"></span>
143
+ </label>
144
+ </td>
145
+ </tr>
146
+
147
+ <tr>
148
+ <td class="tb-zero-padding"></td>
149
+ <td class="tb-zero-padding">
150
+ <p><i>
151
+ <?php _e( 'Check if you want to create log of this entry.', 'mycred' ) ?>
152
+ </i></p>
153
+ </td>
154
+ </tr>
155
+
156
+ <tr class="log-entry-row">
157
+ <td><label for=""><?php _e( 'Log Entry', 'mycred' ) ?></label></td>
158
+ <td>
159
+ <input type="text" name="log_entry_text">
160
+ <p><i>
161
+ <?php _e( 'Enter Text for log entry.', 'mycred' ) ?>
162
+ </i></p>
163
+ </td>
164
+ </tr>
165
+
166
+ </tbody>
167
+
168
+
169
+ <tbody class="bulk-award-badge" style="display: none;">
170
+ <tr>
171
+ <td><label for=""><?php _e( 'Select Badge(s)', 'mycred' ) ?></label></td>
172
+ <td><?php echo mycred_create_select2( $badges, $badges_args ); ?></td>
173
+ </tr>
174
+ </tbody>
175
+
176
+ <tbody class="bulk-award-rank" style="display: none;">
177
+ <tr>
178
+ <td><label for=""><?php _e( 'Select Rank', 'mycred' ) ?></label></td>
179
+ <td>
180
+ <?php echo mycred_create_select2( $ranks, $ranks_args ); ?>
181
+ </td>
182
+ </tr>
183
+ <tr class="bulk-award-rank">
184
+ <td class="tb-zero-padding"></td>
185
+ <td class="tb-zero-padding">
186
+ <p>
187
+ <i>Rank Behaviour should be set to Manual Mode.</i>
188
+ </p>
189
+ </td>
190
+ </tr>
191
+ </tbody>
192
+
193
+ <!-- User fields -->
194
+ <?php echo $this->users_fields( $user_args ) ?>
195
+
196
+ <!-- Award Button -->
197
+ <tbody>
198
+ <tr>
199
+ <td>
200
+ <button class="button button-large large button-primary tools-bulk-assign-award-btn award-points">
201
+ <span class="dashicons dashicons-update mycred-button1"></span>
202
+ Update
203
+ </button>
204
+ </td>
205
+ </tr>
206
+ </tbody>
207
+ </table>
208
+ </form>
209
+ <?php
210
+ }
211
+
212
+ public function users_fields( $args )
213
+ {
214
+ $users = $this->get_all_users();
215
+
216
+ $users_args = array(
217
+ 'name' => $args['users']['name'],
218
+ 'id' => $args['users']['id'],
219
+ 'class' => $args['users']['class'],
220
+ 'multiple' => 'multiple'
221
+ );
222
+
223
+ $wp_roles = wp_roles();
224
+
225
+ $roles = array();
226
+
227
+ foreach( $wp_roles->roles as $role => $name )
228
+ {
229
+ $roles[$role] = $name['name'];
230
+ }
231
+
232
+ $roles_args = array(
233
+ 'name' => $args['roles']['name'],
234
+ 'id' => $args['roles']['id'],
235
+ 'class' => $args['roles']['class'],
236
+ 'multiple' => 'multiple'
237
+ );
238
+
239
+ $content = '';
240
+
241
+ $content .=
242
+ '<tr>
243
+ <td><label for="">Award/ Revoke to All Users</label></td>
244
+ <td>
245
+ <label class="mycred-switch1">
246
+ <input type="checkbox" name="" class="award-to-all">
247
+ <span class="slider round"></span>
248
+ </label>
249
+ </td>
250
+ </tr>
251
+
252
+ <tr class="users-row">
253
+ <td class="tb-zero-padding">
254
+ </td>
255
+ <td class="tb-zero-padding">
256
+ <p><i>
257
+ Check if you want to award to all users.
258
+ </i></p>
259
+ </td>
260
+ </tr>
261
+
262
+ <tr class="users-row">
263
+ <td><label for="">Users to Award/ Revoke</label></td>
264
+ <td>';
265
+
266
+ $content .= mycred_create_select2( $users, $users_args );
267
+
268
+ $content .='
269
+ </td>
270
+ </tr>
271
+
272
+ <tr class="users-row">
273
+ <td class="tb-zero-padding">
274
+ </td>
275
+ <td class="tb-zero-padding">
276
+ <p><i>
277
+ Choose users to award.
278
+ </i></p>
279
+ </td>
280
+ </tr>
281
+
282
+ <tr class="users-row">
283
+ <td><label for="">Roles to Award/ Revoke</label></td>
284
+ <td>';
285
+
286
+ $content .= mycred_create_select2( $roles, $roles_args );
287
+
288
+ $content .= '
289
+ </td>
290
+ </tr>
291
+ <tr class="users-row">
292
+ <td class="tb-zero-padding">
293
+ </td>
294
+ <td class="tb-zero-padding">
295
+ <p><i>
296
+ Choose roles to award.
297
+ </i></p>
298
+ </td>
299
+ </tr>
300
+ ';
301
+
302
+ return $content;
303
+ }
304
+ }
305
+ endif;
306
+
307
+ myCRED_Tools_Bulk_Assign::get_instance();
includes/mycred-tools.php ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
+
4
+ // If this file is called directly, abort.
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+ if ( ! class_exists( 'myCRED_Tools' ) ) :
9
+ class myCRED_Tools {
10
+
11
+ /**
12
+ * Construct
13
+ */
14
+ public function __construct() {
15
+
16
+ add_action( 'admin_menu', array( $this, 'tools_sub_menu' ) );
17
+
18
+ if( isset( $_GET['page'] ) && $_GET['page'] == 'mycred-tools' )
19
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
20
+
21
+ }
22
+
23
+ public function admin_enqueue_scripts()
24
+ {
25
+ wp_enqueue_script( MYCRED_SLUG . '-select2-script' );
26
+
27
+ wp_enqueue_style( MYCRED_SLUG . '-select2-style' );
28
+
29
+ wp_enqueue_script( MYCRED_SLUG . '-tools-script', plugins_url( 'assets/js/mycred-tools.js', __DIR__ ), 'jquery', myCRED_VERSION, true );
30
+
31
+ wp_enqueue_style( MYCRED_SLUG . '-buttons' );
32
+
33
+ wp_localize_script(
34
+ MYCRED_SLUG . '-tools-script',
35
+ 'mycredTools',
36
+ array(
37
+ 'awardConfirmText' => __( 'Do you really want to bulk award?', 'mycred' ),
38
+ 'revokeConfirmText' => __( 'Do you really want to bulk deduct?', 'mycred' ),
39
+ 'successfullyAwarded' => __( 'Successfully Awarded.', 'mycred' ),
40
+ 'successfullyDeducted' => __( 'Successfully Deducted.', 'mycred' ),
41
+ 'pointsRequired' => __( 'Points field is required.', 'mycred' ),
42
+ 'logEntryRequired' => __( 'Log Entry is requried.', 'mycred' ),
43
+ 'revokeConfirmText' => __( 'Do you really want to bulk revoke?', 'mycred' ),
44
+ 'successfullyRevoked' => __( 'Successfully Revoked.', 'mycred' ),
45
+ 'userOrRoleIsRequired' => __( 'Username or Role field required.', 'mycred' ),
46
+ 'badgesFieldRequried' => __( 'Badges field required.', 'mycred' )
47
+ )
48
+ );
49
+ }
50
+
51
+ /**
52
+ * Register tools menu
53
+ */
54
+ public function tools_sub_menu() {
55
+ mycred_add_main_submenu(
56
+ 'Tools',
57
+ 'Tools',
58
+ 'manage_options',
59
+ 'mycred-tools',
60
+ array( $this, 'tools_page' ),
61
+ 2
62
+ );
63
+ }
64
+
65
+ /**
66
+ * Tools menu callback
67
+ */
68
+ public function tools_page() {
69
+
70
+ $import_export = get_mycred_tools_page_url('import-export');
71
+ $logs_cleanup = get_mycred_tools_page_url('logs-cleanup');
72
+ $reset_data = get_mycred_tools_page_url('reset-data');
73
+
74
+ ?>
75
+
76
+ <div class="" id="myCRED-wrap">
77
+ <div class="mycredd-tools">
78
+ <h1>Tools</h1>
79
+ </div>
80
+ <div class="clear"></div>
81
+ <div class="mycred-tools-main-nav">
82
+ <h2 class="nav-tab-wrapper">
83
+ <a href="<?php echo admin_url('admin.php?page=mycred-tools') ?>" class="nav-tab <?php echo !isset( $_GET['mycred-tools'] ) ? 'nav-tab-active' : ''; ?>">Bulk Assign</a>
84
+ <!-- <a href="<?php //echo $import_export ?>" class="nav-tab <?php //echo ( isset( $_GET['mycred-tools'] ) && $_GET['mycred-tools'] == 'import-export' ) ? 'nav-tab-active' : ''; ?>">Import/Export</a>
85
+ <a href="<?php //echo $logs_cleanup ?>" class="nav-tab <?php //echo ( isset( $_GET['mycred-tools'] ) && $_GET['mycred-tools'] == 'logs-cleanup' ) ? 'nav-tab-active' : ''; ?>">Logs Cleanup</a>
86
+ <a href="<?php //echo $reset_data ?>" class="nav-tab <?php //echo ( isset( $_GET['mycred-tools'] ) && $_GET['mycred-tools'] == 'reset-data' ) ? 'nav-tab-active' : ''; ?>">Reset Data</a> -->
87
+ </h2>
88
+ </div>
89
+
90
+ <?php
91
+
92
+ if ( isset( $_GET['mycred-tools'] ) ) {
93
+ if ( $_GET['mycred-tools'] == 'import-export' ) { ?>
94
+ <h1>IMPORT/EXPORT</h1>
95
+ <?php
96
+ }
97
+ }
98
+
99
+ if ( isset( $_GET['mycred-tools'] ) ) {
100
+ if ( $_GET['mycred-tools'] == 'logs-cleanup' ) { ?>
101
+ <h1>LOGS-CLEANUP</h1>
102
+ <?php
103
+ }
104
+ }
105
+
106
+ if ( isset( $_GET['mycred-tools'] ) )
107
+ {
108
+ if ( $_GET['mycred-tools'] == 'reset-data' ) { ?>
109
+ <h1>RESET-DATA</h1>
110
+ <?php
111
+ }
112
+ }
113
+ else
114
+ {
115
+
116
+ $mycred_tools_bulk_assign = new myCRED_Tools_Bulk_Assign();
117
+
118
+ $mycred_tools_bulk_assign->get_page();
119
+
120
+ }
121
+
122
+ ?>
123
+ </div>
124
+ <?php
125
+ }
126
+
127
+ public function get_all_users()
128
+ {
129
+ $users = array();
130
+
131
+ $wp_users = get_users();
132
+
133
+ foreach( $wp_users as $user )
134
+ $users[$user->user_email] = $user->display_name;
135
+
136
+ return $users;
137
+ }
138
+
139
+ public function get_users_by_email( $emails )
140
+ {
141
+ $ids = array();
142
+
143
+ foreach( $emails as $email )
144
+ $ids[] = get_user_by( 'email', $email )->ID;
145
+
146
+ return $ids;
147
+ }
148
+
149
+ public function get_users_by_role( $roles )
150
+ {
151
+ $user_ids = array();
152
+
153
+ foreach( $roles as $role )
154
+ {
155
+ $args = array(
156
+ 'role' => $role
157
+ );
158
+
159
+ $user_query = new WP_User_Query( $args );
160
+
161
+ if ( ! empty( $user_query->get_results() ) )
162
+ {
163
+ foreach ( $user_query->get_results() as $user )
164
+ $user_ids[] = $user->ID;
165
+ }
166
+ }
167
+
168
+ return $user_ids;
169
+ }
170
+
171
+ public function tools_assign_award()
172
+ {
173
+ if( isset( $_REQUEST['selected_type'] ) ):
174
+
175
+ $selected_type = sanitize_text_field( $_REQUEST['selected_type'] );
176
+
177
+ $award_to_all_users = sanitize_text_field( $_REQUEST['award_to_all_users'] ) == 'true' ? true : false;
178
+ $users = sanitize_text_field( $_REQUEST['users'] );
179
+ $user_roles = sanitize_text_field( $_REQUEST['user_roles'] );
180
+
181
+ //Gathering users
182
+ $users_to_award = array();
183
+ if( $award_to_all_users )
184
+ {
185
+ $users = $this->get_all_users();
186
+
187
+ foreach( $users as $email => $user_name )
188
+ {
189
+ $users_to_award[] = $email;
190
+ }
191
+
192
+ $users_to_award = $this->get_users_by_email( $users_to_award );
193
+ }
194
+ else
195
+ {
196
+ $users = json_decode( stripslashes( $users ) );
197
+
198
+ $roles = json_decode( stripslashes( $user_roles ) );
199
+
200
+ if( empty( $users ) && empty( $roles ) )
201
+ {
202
+ $response = array( 'success' => 'userOrRoleIsRequired' );
203
+
204
+ wp_send_json( $response );
205
+
206
+ die;
207
+ }
208
+
209
+ $users_to_award = $this->get_users_by_email( $users );
210
+
211
+ if( $user_roles )
212
+ {
213
+ $users_by_role = $this->get_users_by_role( $roles );
214
+
215
+ $users_to_award = array_merge( $users_by_role, $users_to_award );
216
+
217
+ $users_to_award = array_unique( $users_to_award );
218
+ }
219
+ }
220
+
221
+ //Awarding Points
222
+ if( $selected_type == 'points' )
223
+ {
224
+ $response = '';
225
+ $log_entry_text = '';
226
+ $points_to_award = sanitize_text_field( $_REQUEST['points_to_award'] );
227
+ $point_type = sanitize_text_field( $_REQUEST['point_type'] );
228
+ $log_entry = sanitize_text_field( $_REQUEST['log_entry'] ) == 'true' ? true : false;
229
+
230
+ if( empty( $points_to_award ) )
231
+ {
232
+ $response = array( 'success' => 'pointsRequired' );
233
+
234
+ wp_send_json( $response );
235
+
236
+ die;
237
+ }
238
+
239
+ $mycred = mycred( $point_type );
240
+
241
+ foreach( $users_to_award as $user_id )
242
+ {
243
+ //Entries with log
244
+ if( $log_entry )
245
+ {
246
+ $log_entry_text = sanitize_text_field( $_REQUEST['log_entry_text'] );
247
+
248
+ if( empty( $log_entry_text ) )
249
+ {
250
+ $response = array( 'success' => 'logEntryRequired' );
251
+
252
+ wp_send_json( $response );
253
+
254
+ die;
255
+ }
256
+
257
+ mycred_add(
258
+ 'bulk_assign',
259
+ $user_id,
260
+ $points_to_award,
261
+ $log_entry_text,
262
+ '',
263
+ '',
264
+ $point_type
265
+ );
266
+
267
+ }
268
+
269
+ //Entries with log
270
+ if( !$log_entry )
271
+ {
272
+ $new_balance = $mycred->update_users_balance( $user_id, $points_to_award, $point_type );
273
+ }
274
+
275
+ $response = array( 'success' => true );
276
+ }
277
+
278
+ wp_send_json( $response );
279
+
280
+ die;
281
+ }
282
+
283
+ //Awarding Ranks
284
+ if( $selected_type == 'ranks' )
285
+ {
286
+ $rank_to_award = sanitize_text_field( $_REQUEST['rank_to_award'] );
287
+
288
+ foreach( $users_to_award as $user_id )
289
+ {
290
+ if( class_exists( 'myCRED_Ranks_Module' ) && mycred_manual_ranks() )
291
+ {
292
+ $rank_pt = mycred_get_rank_pt( $rank_to_award );
293
+ mycred_save_users_rank( $user_id, $rank_to_award, $rank_pt );
294
+ $response = array( 'success' => true );
295
+ }
296
+ }
297
+
298
+ wp_send_json( $response );
299
+
300
+ die;
301
+ }
302
+
303
+ //Awarding/ Revoking Badges
304
+ if( $selected_type == 'badges' )
305
+ {
306
+ //Awarding Badges
307
+ if( $_REQUEST['action'] == 'mycred-tools-assign-award' && !isset( $_REQUEST['revoke'] ) )
308
+ {
309
+ $badges_to_award = sanitize_text_field( $_REQUEST['badges_to_award'] );
310
+
311
+ $badges_to_award = json_decode( stripslashes( $badges_to_award ) );
312
+
313
+ if( empty( $badges_to_award ) )
314
+ {
315
+ $response = array( 'success' => 'badgesFieldRequried' );
316
+
317
+ wp_send_json( $response );
318
+
319
+ die;
320
+ }
321
+
322
+ foreach( $badges_to_award as $badge_id )
323
+ {
324
+ foreach( $users_to_award as $user_id )
325
+ {
326
+ $badge_id = (int)$badge_id;
327
+
328
+ mycred_assign_badge_to_user( $user_id, $badge_id );
329
+ }
330
+ }
331
+
332
+ $response = array( 'success' => true );
333
+
334
+ }
335
+
336
+ //Revoking Badges
337
+ if( $_REQUEST['action'] == 'mycred-tools-assign-award' && isset( $_REQUEST['revoke'] ) && $_REQUEST['revoke'] == 'revoke' )
338
+ {
339
+ $badges_to_revoke = sanitize_text_field( $_REQUEST['badges_to_revoke'] );
340
+
341
+ $badges_to_revoke = json_decode( stripslashes( $badges_to_revoke ) );
342
+
343
+ if( empty( $badges_to_revoke ) )
344
+ {
345
+ $response = array( 'success' => 'badgesFieldRequried' );
346
+
347
+ wp_send_json( $response );
348
+
349
+ die;
350
+ }
351
+
352
+ foreach( $badges_to_revoke as $badge_id )
353
+ {
354
+ foreach( $users_to_award as $user_id )
355
+ {
356
+ $badge = mycred_get_badge( $badge_id );
357
+
358
+ $badge->divest( $user_id );
359
+ }
360
+ }
361
+
362
+ $response = array( 'success' => true );
363
+
364
+ }
365
+
366
+ wp_send_json( $response );
367
+
368
+ die;
369
+ }
370
+
371
+ endif;
372
+ }
373
+ }
374
+ endif;
375
+
376
+ $mycred_tools = new myCRED_Tools();
377
+
378
+ if ( ! function_exists( 'get_mycred_tools_page_url' ) ) :
379
+ function get_mycred_tools_page_url( $urls ) {
380
+
381
+ $args = array(
382
+ 'page' => MYCRED_SLUG . '-tools',
383
+ 'mycred-tools' => $urls,
384
+ );
385
+
386
+ return esc_url( add_query_arg( $args, admin_url( 'admin.php' ) ) );
387
+
388
+ }
389
+ endif;
includes/shortcodes/mycred_my_balance_converted.php CHANGED
@@ -6,21 +6,24 @@ if ( ! defined( 'myCRED_VERSION' ) ) exit;
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
- 'decimal' => 1
 
20
  ), $atts, MYCRED_SLUG . '_my_balance_converted' ) );
21
 
22
  $output = '';
23
 
 
 
24
  // Not logged in
25
  if ( ! is_user_logged_in() )
26
  return $content;
@@ -39,7 +42,10 @@ if ( ! function_exists( 'mycred_render_shortcode_my_balance_converted' ) ) :
39
  // Check for exclusion
40
  if ( empty( $account->balance ) || ! array_key_exists( $ctype, $account->balance ) || $account->balance[ $ctype ] === false ) return;
41
 
42
- $balance = $account->balance[ $ctype ];
 
 
 
43
 
44
  $output = '<div class="mycred-my-balance-converted-wrapper">';
45
 
@@ -48,8 +54,8 @@ if ( ! function_exists( 'mycred_render_shortcode_my_balance_converted' ) ) :
48
 
49
  if( floatval( $rate ) == 0 ) $rate = 1;
50
 
51
- $converted_balance = floatval( $balance->current ) * floatval( $rate );
52
-
53
  $output .= number_format( $converted_balance, intval( $decimal ), '.', '' );
54
 
55
  if ( ! empty( $suffix ) )
@@ -61,4 +67,78 @@ if ( ! function_exists( 'mycred_render_shortcode_my_balance_converted' ) ) :
61
 
62
  }
63
  endif;
64
- add_shortcode( MYCRED_SLUG . '_my_balance_converted', 'mycred_render_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 2.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
+ 'decimal' => 1,
20
+ 'timeframe' => ''
21
  ), $atts, MYCRED_SLUG . '_my_balance_converted' ) );
22
 
23
  $output = '';
24
 
25
+ $timeframe_balance = '';
26
+
27
  // Not logged in
28
  if ( ! is_user_logged_in() )
29
  return $content;
42
  // Check for exclusion
43
  if ( empty( $account->balance ) || ! array_key_exists( $ctype, $account->balance ) || $account->balance[ $ctype ] === false ) return;
44
 
45
+ if( empty( $timeframe ) )
46
+ $balance = $account->balance[ $ctype ];
47
+ else
48
+ $timeframe_balance = mycred_my_bc_get_balance( $user_id, $timeframe, $ctype );
49
 
50
  $output = '<div class="mycred-my-balance-converted-wrapper">';
51
 
54
 
55
  if( floatval( $rate ) == 0 ) $rate = 1;
56
 
57
+ $converted_balance = floatval( empty( $timeframe ) ? $balance->current : $timeframe_balance ) * floatval( $rate );
58
+
59
  $output .= number_format( $converted_balance, intval( $decimal ), '.', '' );
60
 
61
  if ( ! empty( $suffix ) )
67
 
68
  }
69
  endif;
70
+ add_shortcode( MYCRED_SLUG . '_my_balance_converted', 'mycred_render_shortcode_my_balance_converted' );
71
+
72
+ if( !function_exists( 'mycred_my_bc_get_balance' ) ):
73
+ function mycred_my_bc_get_balance( $user_id, $timeframe, $ctype )
74
+ {
75
+ global $wpdb, $mycred_log_table;
76
+
77
+ //Current Timestamp
78
+ $timestamp = time();
79
+
80
+ //Current day end time
81
+ $end_day = DateTime::createFromFormat('Y-m-d H:i:s', (new DateTime())->setTimestamp($timestamp)->format('Y-m-d 23:59:59'))->getTimestamp();
82
+
83
+ $day_start = '';
84
+ $day_end = '';
85
+
86
+
87
+ if( $timeframe == 'today' )
88
+ {
89
+ $day_start = DateTime::createFromFormat( 'Y-m-d H:i:s', ( new DateTime() )->setTimestamp( $timestamp )->format( 'Y-m-d 00:00:00' ) )->getTimestamp();
90
+ }
91
+
92
+ if( $timeframe == 'yesterday' )
93
+ {
94
+ $timestamp = strtotime( '-1 day', $timestamp );
95
+
96
+ $day_start = DateTime::createFromFormat('Y-m-d H:i:s', (new DateTime())->setTimestamp($timestamp)->format('Y-m-d 00:00:00'))->getTimestamp();
97
+
98
+ $end_day = DateTime::createFromFormat('Y-m-d H:i:s', (new DateTime())->setTimestamp($timestamp)->format('Y-m-d 23:59:59'))->getTimestamp();
99
+ }
100
+
101
+ if( $timeframe == 'this-week' )
102
+ {
103
+ $week_day = apply_filters( 'mycred_my_bc_last_week_day', 'sunday' );
104
+
105
+ $day_start = strtotime( "{$week_day} last week", $timestamp );
106
+ }
107
+
108
+ if( $timeframe == 'this-month' )
109
+ {
110
+ $day_start = strtotime( "first day of this month", $timestamp );
111
+
112
+ $day_start = DateTime::createFromFormat('Y-m-d H:i:s', (new DateTime())->setTimestamp($day_start)->format('Y-m-d 00:00:00'))->getTimestamp();
113
+ }
114
+
115
+ if( $timeframe == 'last-month' )
116
+ {
117
+ $day_start = strtotime( "first day of -1 month", $timestamp );
118
+
119
+ $end_day = strtotime( "last day of -1 month", $timestamp );
120
+
121
+ $day_start = DateTime::createFromFormat('Y-m-d H:i:s', (new DateTime())->setTimestamp($day_start)->format('Y-m-d 00:00:00'))->getTimestamp();
122
+
123
+ $end_day = DateTime::createFromFormat('Y-m-d H:i:s', (new DateTime())->setTimestamp($end_day)->format('Y-m-d 23:59:59'))->getTimestamp();
124
+ }
125
+
126
+
127
+
128
+ $balance = $wpdb->get_var(
129
+ $wpdb->prepare(
130
+ "SELECT SUM(creds)
131
+ FROM {$mycred_log_table}
132
+ WHERE `user_id` = %d
133
+ AND `ctype` = %s
134
+ AND `time` BETWEEN %d AND %d",
135
+ $user_id,
136
+ $ctype,
137
+ $day_start,
138
+ $end_day
139
+ )
140
+ );
141
+
142
+ return $balance;
143
+ }
144
+ endif;
includes/shortcodes/mycred_referral_stats.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
+
4
+ /**
5
+ * myCRED Shortcode: mycred_referral_stats
6
+ * Returns the referral stats.
7
+ * @see http://codex.mycred.me/shortcodes/mycred_referral_stats/
8
+ * @since 2.1.1
9
+ * @version 1.0
10
+ */
11
+
12
+ if ( ! function_exists( 'mycred_referral_front' ) ) :
13
+ function mycred_referral_front( $atts ){
14
+
15
+ extract( shortcode_atts( array(
16
+
17
+ 'ctype' => MYCRED_DEFAULT_TYPE_KEY
18
+
19
+ ), $atts, MYCRED_SLUG . '_referral' ) );
20
+
21
+ $hooks = mycred_get_option( 'mycred_pref_hooks', false );
22
+
23
+ if ( $ctype != MYCRED_DEFAULT_TYPE_KEY )
24
+ $hooks = mycred_get_option( 'mycred_pref_hooks_' . sanitize_key( $ctype ), false );
25
+ $active = $hooks['active'];
26
+ if( is_array( $active) && in_array( 'affiliate' , $active )){
27
+
28
+ $visit = $hooks['hook_prefs']['affiliate']['visit'];
29
+ $signup = $hooks['hook_prefs']['affiliate']['signup'];
30
+
31
+ $output = '';
32
+
33
+ $user_id = get_current_user_id();
34
+
35
+ $output .= '<table class="profile-fields">';
36
+
37
+ // Show Visitor referral count
38
+ if ( $visit['creds'] != 0 )
39
+ $output .= sprintf( '<tr class="field_2 field_ref_count_visit"><td class="label">%s</td><td>%s</td></tr>', __( 'Visitors Referred', 'mycred' ), mycred_count_ref_instances( 'visitor_referral', $user_id, $ctype ) );
40
+
41
+ // Show Signup referral count
42
+ if ( $signup['creds'] != 0 )
43
+ $output .= sprintf( '<tr class="field_3 field_ref_count_signup"><td class="label">%s</td><td>%s</td></tr>', __( 'Signups Referred', 'mycred' ), mycred_count_ref_instances( 'signup_referral', $user_id, $ctype ) );
44
+
45
+ $output .= '</table>';
46
+ return $output;
47
+ }
48
+ }
49
+ endif;
50
+
51
+ add_shortcode( MYCRED_SLUG . '_referral_stats' , 'mycred_referral_front' );
membership/mycred-connect-membership.php CHANGED
@@ -360,8 +360,8 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
360
  </div>
361
  </div>
362
  </div>
363
- <div class="col-lg-1 col-md-1 hidden-sm hidden-xs"></div>
364
- <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12 mmc_table_column border-right">
365
  <div class="mmc_table_plan">AGENCY</div>
366
 
367
  <div class="mmc_table_pricing">
@@ -390,7 +390,7 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
390
  </div>
391
 
392
 
393
- <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12 mmc_table_column border-right">
394
  <div class="mmc_table_plan">BUSINESS</div>
395
 
396
  <div class="mmc_table_pricing">
@@ -419,7 +419,7 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
419
  </div>
420
 
421
 
422
- <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12 mmc_table_column border-right">
423
  <div class="mmc_table_most_popular">Most Popular</div>
424
  <div class="mmc_table_plan">PROFESSIONAL</div>
425
 
@@ -449,7 +449,7 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
449
  </div>
450
 
451
 
452
- <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12 mmc_table_column">
453
  <div class="mmc_table_plan">STARTER</div>
454
 
455
  <div class="mmc_table_pricing">
@@ -478,6 +478,7 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
478
  </div>
479
  <div class="col-lg-1 col-md-1 hidden-sm hidden-xs"></div>
480
  </div>
 
481
  <?php
482
  }
483
  }
@@ -490,7 +491,6 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
490
  /*.theme-browser .theme:focus, .theme-browser .theme:hover { cursor: default !important; }*/
491
  /*.theme-browser .theme:hover .more-details { opacity: 1; }*/
492
  .theme-browser .theme:hover a.more-details, .theme-browser .theme:hover a.more-details:hover { text-decoration: none; }
493
- .theme-browser .theme .theme-screenshot img { height: 100%; }
494
 
495
  .theme-browser .theme .theme-screenshot1 img { height: 100%; }
496
 
@@ -651,7 +651,9 @@ p.mycred-activate {
651
  <?php if ( $screenshot != '' ) : ?>
652
 
653
  <div class="theme-screenshot">
654
- <img src="<?php echo $screenshot; ?>" alt="" />
 
 
655
  </div>
656
 
657
  <?php else : ?>
@@ -755,7 +757,7 @@ p.mycred-activate {
755
  /* need to do this for multisite as well */
756
 
757
  $link_url = $this->get_membership_addon_action_url( $addon_folder, 'install' );
758
- $link_text = __( 'Install', 'mycred' );
759
  $network_active = false;
760
 
761
  if(is_multisite() && $this->is_addon_network_active( $addon_folder )){
@@ -869,13 +871,15 @@ p.mycred-activate {
869
  $plugin_directory = ABSPATH.'wp-content/plugins/'.$addon_folder.'.zip';
870
 
871
  $data = wp_remote_get($url);
872
-
873
  if ( is_array( $data ) && ! is_wp_error( $data ) ) {
874
 
875
- if ( file_put_contents($plugin_directory, $data['body'] ) ) {
 
 
 
 
876
  return true;
877
- }
878
-
879
  }
880
 
881
  }
360
  </div>
361
  </div>
362
  </div>
363
+ <div class="mmc-packages">
364
+ <div class="mmc_table_column border-right">
365
  <div class="mmc_table_plan">AGENCY</div>
366
 
367
  <div class="mmc_table_pricing">
390
  </div>
391
 
392
 
393
+ <div class="mmc_table_column border-right">
394
  <div class="mmc_table_plan">BUSINESS</div>
395
 
396
  <div class="mmc_table_pricing">
419
  </div>
420
 
421
 
422
+ <div class="mmc_table_column border-right most-popular">
423
  <div class="mmc_table_most_popular">Most Popular</div>
424
  <div class="mmc_table_plan">PROFESSIONAL</div>
425
 
449
  </div>
450
 
451
 
452
+ <div class="mmc_table_column">
453
  <div class="mmc_table_plan">STARTER</div>
454
 
455
  <div class="mmc_table_pricing">
478
  </div>
479
  <div class="col-lg-1 col-md-1 hidden-sm hidden-xs"></div>
480
  </div>
481
+ </div>
482
  <?php
483
  }
484
  }
491
  /*.theme-browser .theme:focus, .theme-browser .theme:hover { cursor: default !important; }*/
492
  /*.theme-browser .theme:hover .more-details { opacity: 1; }*/
493
  .theme-browser .theme:hover a.more-details, .theme-browser .theme:hover a.more-details:hover { text-decoration: none; }
 
494
 
495
  .theme-browser .theme .theme-screenshot1 img { height: 100%; }
496
 
651
  <?php if ( $screenshot != '' ) : ?>
652
 
653
  <div class="theme-screenshot">
654
+ <div class="theme-screenshot-item">
655
+ <img src="<?php echo $screenshot; ?>" alt="" />
656
+ </div>
657
  </div>
658
 
659
  <?php else : ?>
757
  /* need to do this for multisite as well */
758
 
759
  $link_url = $this->get_membership_addon_action_url( $addon_folder, 'install' );
760
+ $link_text = __( 'Download', 'mycred' );
761
  $network_active = false;
762
 
763
  if(is_multisite() && $this->is_addon_network_active( $addon_folder )){
871
  $plugin_directory = ABSPATH.'wp-content/plugins/'.$addon_folder.'.zip';
872
 
873
  $data = wp_remote_get($url);
874
+
875
  if ( is_array( $data ) && ! is_wp_error( $data ) ) {
876
 
877
+ header('Content-Disposition: attachment; filename="'.$addon_folder.'.zip"');
878
+ header("Content-Type: application/zip");
879
+ echo ($data['body']);
880
+ unlink($data['body']);
881
+ if( $data['body'] )
882
  return true;
 
 
883
  }
884
 
885
  }
modules/mycred-module-settings.php CHANGED
@@ -379,7 +379,7 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
379
  /**
380
  * Scripts & Styles
381
  * @since 1.7
382
- * @version 1.0
383
  */
384
  public function scripts_and_styles() {
385
 
@@ -393,6 +393,10 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
393
  myCRED_VERSION . '.1'
394
  );
395
 
 
 
 
 
396
  }
397
 
398
  /**
@@ -547,7 +551,8 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
547
  /**
548
  * Admin Page
549
  * @since 0.1
550
- * @version 1.5
 
551
  */
552
  public function admin_page() {
553
 
@@ -565,6 +570,29 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
565
  $social[] = '<a href="https://www.facebook.com/myCRED" class="facebook" target="_blank">Facebook</a>';
566
  $social[] = '<a href="https://plus.google.com/+MycredMe/posts" class="googleplus" target="_blank">Google+</a>';
567
  $social[] = '<a href="https://twitter.com/my_cred" class="twitter" target="_blank">Twitter</a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
 
569
  ?>
570
  <div class="wrap mycred-metabox" id="myCRED-wrap">
@@ -666,11 +694,10 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
666
  <p><span class="description"><?php _e( 'The maximum amount allowed to be paid out in a single instance.', 'mycred' ); ?></span></p>
667
  </div>
668
  </div>
669
- <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
670
  <div class="form-group">
671
- <label for="<?php echo $this->field_id( array( 'exclude' => 'list' ) ); ?>"><?php _e( 'Exclude by User ID', 'mycred' ); ?></label>
672
- <input type="text" name="<?php echo $this->field_name( array( 'exclude' => 'list' ) ); ?>" id="<?php echo $this->field_id( array( 'exclude' => 'list' ) ); ?>" placeholder="<?php _e( 'Optional', 'mycred' ); ?>" class="form-control" value="<?php echo esc_attr( $this->core->exclude['list'] ); ?>" />
673
- <p><span class="description"><?php _e( 'Comma separated list of user IDs to exclude from using this point type.', 'mycred' ); ?></span></p>
674
  </div>
675
  <div class="form-group">
676
  <div class="checkbox">
@@ -681,6 +708,12 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
681
  </div>
682
  </div>
683
  </div>
 
 
 
 
 
 
684
  </div>
685
  </div>
686
  </div>
@@ -993,7 +1026,8 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
993
  * Sanititze Settings
994
  * @filter 'mycred_save_core_prefs'
995
  * @since 0.1
996
- * @version 1.5.1
 
997
  */
998
  public function sanitize_settings( $post ) {
999
 
@@ -1108,17 +1142,34 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
1108
  if ( in_array( $new_data['caps']['plugin'], array( 'create_users', 'delete_themes', 'edit_plugins', 'edit_themes', 'edit_users' ) ) && is_multisite() )
1109
  $new_data['caps']['plugin'] = 'edit_theme_options';
1110
 
 
 
 
 
1111
  // Excludes
1112
  $new_data['exclude'] = array(
1113
- 'plugin_editors' => ( isset( $post['exclude']['plugin_editors'] ) ) ? $post['exclude']['plugin_editors'] : 0,
1114
- 'cred_editors' => ( isset( $post['exclude']['cred_editors'] ) ) ? $post['exclude']['cred_editors'] : 0,
1115
- 'list' => sanitize_text_field( $post['exclude']['list'] )
 
1116
  );
1117
 
1118
  // Remove Exclude users balances
1119
- if ( $new_data['exclude']['list'] != '' ) {
1120
 
1121
  $excluded_ids = wp_parse_id_list( $new_data['exclude']['list'] );
 
 
 
 
 
 
 
 
 
 
 
 
1122
  if ( ! empty( $excluded_ids ) ) {
1123
  foreach ( $excluded_ids as $user_id ) {
1124
 
@@ -1148,6 +1199,48 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
1148
 
1149
  }
1150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1151
  }
1152
  endif;
1153
 
379
  /**
380
  * Scripts & Styles
381
  * @since 1.7
382
+ * @version 1.1
383
  */
384
  public function scripts_and_styles() {
385
 
393
  myCRED_VERSION . '.1'
394
  );
395
 
396
+ wp_enqueue_style( MYCRED_SLUG . '-select2-style' );
397
+
398
+ wp_enqueue_script( MYCRED_SLUG . '-select2-script' );
399
+
400
  }
401
 
402
  /**
551
  /**
552
  * Admin Page
553
  * @since 0.1
554
+ * @since 2.3 Added select2, Exclude User by ID and Role
555
+ * @version 1.6
556
  */
557
  public function admin_page() {
558
 
570
  $social[] = '<a href="https://www.facebook.com/myCRED" class="facebook" target="_blank">Facebook</a>';
571
  $social[] = '<a href="https://plus.google.com/+MycredMe/posts" class="googleplus" target="_blank">Google+</a>';
572
  $social[] = '<a href="https://twitter.com/my_cred" class="twitter" target="_blank">Twitter</a>';
573
+
574
+ // Exclude Users by ID
575
+ $excluded_ids = explode( ',', esc_attr( $this->core->exclude['list'] ) );
576
+ $all_users = $this->get_all_users();
577
+ $excluded_ids_args = array(
578
+ 'name' => $this->field_name( array( 'exclude' => 'list' ) ) . '[]',
579
+ 'id' => $this->field_id( array( 'exclude' => 'list' ) ),
580
+ 'class' => 'form-control',
581
+ 'multiple' => 'multiple'
582
+ );
583
+
584
+ //Exclude Users by Role
585
+ $excluded_roles = explode( ',', esc_attr( $this->core->exclude['by_roles'] ) );
586
+ $wp_roles = wp_roles();
587
+ $roles = array();
588
+ foreach( $wp_roles->roles as $role => $name )
589
+ $roles[$role] = $name['name'];
590
+ $roles_args = array(
591
+ 'name' => $this->field_name( array( 'exclude' => 'by_roles' ) ) . '[]',
592
+ 'id' => $this->field_id( array( 'exclude' => 'by_roles' ) ),
593
+ 'class' => 'form-control',
594
+ 'multiple' => 'multiple'
595
+ );
596
 
597
  ?>
598
  <div class="wrap mycred-metabox" id="myCRED-wrap">
694
  <p><span class="description"><?php _e( 'The maximum amount allowed to be paid out in a single instance.', 'mycred' ); ?></span></p>
695
  </div>
696
  </div>
697
+ <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">
698
  <div class="form-group">
699
+ <label for="<?php echo $excluded_ids_args['id']; ?>"><?php _e( 'Exclude by User ID', 'mycred' ); ?></label>
700
+ <?php echo mycred_create_select2( $all_users, $excluded_ids_args, $excluded_ids ); ?>
 
701
  </div>
702
  <div class="form-group">
703
  <div class="checkbox">
708
  </div>
709
  </div>
710
  </div>
711
+ <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">
712
+ <div class="form-group">
713
+ <label for="<?php echo $roles_args['id']; ?>"><?php _e( 'Exclude by User Role', 'mycred' ); ?></label>
714
+ <?php echo mycred_create_select2( $roles, $roles_args, $excluded_roles ); ?>
715
+ </div>
716
+ </div>
717
  </div>
718
  </div>
719
  </div>
1026
  * Sanititze Settings
1027
  * @filter 'mycred_save_core_prefs'
1028
  * @since 0.1
1029
+ * @since 2.3 Added `by_role` Exclude user by role
1030
+ * @version 1.5.2
1031
  */
1032
  public function sanitize_settings( $post ) {
1033
 
1142
  if ( in_array( $new_data['caps']['plugin'], array( 'create_users', 'delete_themes', 'edit_plugins', 'edit_themes', 'edit_users' ) ) && is_multisite() )
1143
  $new_data['caps']['plugin'] = 'edit_theme_options';
1144
 
1145
+ //Exclude Users by roles and ID
1146
+ $sanitized_exclude_ids = !empty( $post['exclude']['list'] ) ? sanitize_text_field( implode( ',', $post['exclude']['list'] ) ) : '';
1147
+ $sanitized_exclude_roles = !empty( $post['exclude']['by_roles'] ) ? sanitize_text_field( implode( ',', $post['exclude']['by_roles'] ) ) : '';
1148
+
1149
  // Excludes
1150
  $new_data['exclude'] = array(
1151
+ 'plugin_editors' => ( isset( $post['exclude']['plugin_editors'] ) ) ? $post['exclude']['plugin_editors'] : 0,
1152
+ 'cred_editors' => ( isset( $post['exclude']['cred_editors'] ) ) ? $post['exclude']['cred_editors'] : 0,
1153
+ 'list' => $sanitized_exclude_ids,
1154
+ 'by_roles' => $sanitized_exclude_roles
1155
  );
1156
 
1157
  // Remove Exclude users balances
1158
+ if ( $new_data['exclude']['list'] != '' || $new_data['exclude']['by_roles'] != '' ) {
1159
 
1160
  $excluded_ids = wp_parse_id_list( $new_data['exclude']['list'] );
1161
+
1162
+ //Exclude by User Role
1163
+ $excluded_roles = $post['exclude']['by_roles'];
1164
+
1165
+ if( !empty( $excluded_roles ) )
1166
+ {
1167
+ $users_by_role = $this->get_users_by_role( $excluded_roles );
1168
+ $excluded_ids = array_merge( $excluded_ids, $users_by_role );
1169
+ $excluded_ids = array_unique( $excluded_ids );
1170
+ }
1171
+
1172
+
1173
  if ( ! empty( $excluded_ids ) ) {
1174
  foreach ( $excluded_ids as $user_id ) {
1175
 
1199
 
1200
  }
1201
 
1202
+ /**
1203
+ * @since 2.3
1204
+ * @version 1.0
1205
+ */
1206
+ public function get_all_users()
1207
+ {
1208
+ $users = array();
1209
+
1210
+ $wp_users = get_users();
1211
+
1212
+ foreach( $wp_users as $user )
1213
+ $users[$user->ID] = $user->display_name;
1214
+
1215
+ return $users;
1216
+ }
1217
+
1218
+ /**
1219
+ * @since 2.3
1220
+ * @version 1.0
1221
+ */
1222
+ public function get_users_by_role( $roles )
1223
+ {
1224
+ $user_ids = array();
1225
+
1226
+ foreach( $roles as $role )
1227
+ {
1228
+ $args = array(
1229
+ 'role' => $role
1230
+ );
1231
+
1232
+ $user_query = new WP_User_Query( $args );
1233
+
1234
+ if ( ! empty( $user_query->get_results() ) )
1235
+ {
1236
+ foreach ( $user_query->get_results() as $user )
1237
+ $user_ids[] = $user->ID;
1238
+ }
1239
+ }
1240
+
1241
+ return $user_ids;
1242
+ }
1243
+
1244
  }
1245
  endif;
1246
 
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: 2.2
7
  * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
8
  * Author: myCred
9
  * Author URI: https://mycred.me
@@ -20,7 +20,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
20
  final class myCRED_Core {
21
 
22
  // Plugin Version
23
- public $version = '2.2';
24
 
25
  // Instnace
26
  protected static $_instance = NULL;
@@ -54,14 +54,14 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
54
  * @since 1.7
55
  * @version 1.0
56
  */
57
- public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '2.2' ); }
58
 
59
  /**
60
  * Not allowed
61
  * @since 1.7
62
  * @version 1.0
63
  */
64
- public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '2.2' ); }
65
 
66
  /**
67
  * Get
@@ -250,6 +250,8 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
250
  $this->file( myCRED_INCLUDES_DIR . 'mycred-protect.php' );
251
  $this->file( myCRED_INCLUDES_DIR . 'mycred-about.php' );
252
  $this->file( myCRED_INCLUDES_DIR . 'mycred-nav-menu.php' );
 
 
253
 
254
  if( isset ( $_GET['mycred_tour_guide'] ) ){
255
 
@@ -530,7 +532,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
530
  // These shortcodes will not work if hooks are disabled
531
  if ( MYCRED_ENABLE_HOOKS ) {
532
 
533
- $this->file( myCRED_SHORTCODES_DIR . 'mycred_referal_stats.php' );
534
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_affiliate_id.php' );
535
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_affiliate_link.php' );
536
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_link.php' );
@@ -625,6 +627,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
625
  // Styles
626
  wp_register_style( 'mycred-front', plugins_url( 'assets/css/mycred-front.css', myCRED_THIS ), array(), $this->version, 'all' );
627
  wp_register_style( 'mycred-admin', plugins_url( 'assets/css/mycred-admin.css', myCRED_THIS ), array(), $this->version, 'all' );
 
628
  wp_register_style( 'mycred-edit-balance', plugins_url( 'assets/css/mycred-edit-balance.css', myCRED_THIS ), array(), $this->version, 'all' );
629
  wp_register_style( 'mycred-edit-log', plugins_url( 'assets/css/mycred-edit-log.css', myCRED_THIS ), array(), $this->version, 'all' );
630
  wp_register_style( 'mycred-bootstrap-grid', plugins_url( 'assets/css/bootstrap-grid.css', myCRED_THIS ), array(), $this->version, 'all' );
3
  * Plugin Name: myCred
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
+ * Version: 2.3
7
  * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
8
  * Author: myCred
9
  * Author URI: https://mycred.me
20
  final class myCRED_Core {
21
 
22
  // Plugin Version
23
+ public $version = '2.3';
24
 
25
  // Instnace
26
  protected static $_instance = NULL;
54
  * @since 1.7
55
  * @version 1.0
56
  */
57
+ public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '2.3' ); }
58
 
59
  /**
60
  * Not allowed
61
  * @since 1.7
62
  * @version 1.0
63
  */
64
+ public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '2.3' ); }
65
 
66
  /**
67
  * Get
250
  $this->file( myCRED_INCLUDES_DIR . 'mycred-protect.php' );
251
  $this->file( myCRED_INCLUDES_DIR . 'mycred-about.php' );
252
  $this->file( myCRED_INCLUDES_DIR . 'mycred-nav-menu.php' );
253
+ $this->file( myCRED_INCLUDES_DIR . 'mycred-tools.php' );
254
+ $this->file( myCRED_INCLUDES_DIR . 'mycred-tools-bulk-assign.php' );
255
 
256
  if( isset ( $_GET['mycred_tour_guide'] ) ){
257
 
532
  // These shortcodes will not work if hooks are disabled
533
  if ( MYCRED_ENABLE_HOOKS ) {
534
 
535
+ $this->file( myCRED_SHORTCODES_DIR . 'mycred_referral_stats.php' );
536
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_affiliate_id.php' );
537
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_affiliate_link.php' );
538
  $this->file( myCRED_SHORTCODES_DIR . 'mycred_link.php' );
627
  // Styles
628
  wp_register_style( 'mycred-front', plugins_url( 'assets/css/mycred-front.css', myCRED_THIS ), array(), $this->version, 'all' );
629
  wp_register_style( 'mycred-admin', plugins_url( 'assets/css/mycred-admin.css', myCRED_THIS ), array(), $this->version, 'all' );
630
+ wp_register_style( 'mycred-buttons', plugins_url( 'assets/css/mycred-buttons.css', myCRED_THIS ), array(), $this->version, 'all' );
631
  wp_register_style( 'mycred-edit-balance', plugins_url( 'assets/css/mycred-edit-balance.css', myCRED_THIS ), array(), $this->version, 'all' );
632
  wp_register_style( 'mycred-edit-log', plugins_url( 'assets/css/mycred-edit-log.css', myCRED_THIS ), array(), $this->version, 'all' );
633
  wp_register_style( 'mycred-bootstrap-grid', plugins_url( 'assets/css/bootstrap-grid.css', myCRED_THIS ), array(), $this->version, 'all' );
readme.txt CHANGED
@@ -1,403 +1,427 @@
1
- === myCred - Points, Rewards, Gamification, Ranks, Badges & Loyalty Plugin ===
2
- Contributors: mycred,wpexpertsio
3
- Tags: badges, gamification, loyalty, points, rewards
4
- Requires at least: 4.8
5
- Tested up to: 5.8.1
6
- Stable tag: 2.2
7
- Requires PHP: 7.0
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- An adaptive and powerful points management system for WordPress powered websites.
12
-
13
- == Description ==
14
-
15
- myCred is an intelligent and adaptive **points management system** that allows you to build and manage a broad range of digital rewards including points, ranks and, badges on your WordPress/WooCommerce powered website.
16
-
17
- [youtube https://www.youtube.com/watch?v=-M19tzYo1jo]
18
-
19
- Build **brand loyalty** by rewarding your customers through store reward systems, community leaderboards, monetizing your website content, etc. - The possibilities are endless.
20
-
21
- **Increase customer engagement tenfold - Rewarding your users for community engagement will help your business grow.**
22
-
23
- = AMAZING AWARD SYSTEMS TO ENGAGE AND REWARD LOYAL CUSTOMERS =
24
-
25
- myCred allows **THREE different ways** through which you can award your users:
26
-
27
- * **Points -** Set events and triggers to allow real-time tracking and automatically award your users with points.
28
-
29
- * **Ranks -** Set ranks within your leaderboards and reward your users with significant perks after they reach a certain milestone.
30
-
31
- * **Badges -** Boost your users' participation by rewarding them for their exceptional performance.
32
-
33
- **Latest update - myCred v2.2**
34
-
35
- **myCred v2.2** focuses on improving the overall user interface, single badge page layout, point-type image, and social media sharing for a better user experience and operational efficiency.
36
-
37
- * **New UI design of the main menu** - A fresh new look of our main menu allows users to easily navigate between logs, hooks, and general settings.
38
- * **Upload Point-type image** - Give your point type a unique identity by assigning them an image.
39
- * **Enable/Disable add-ons** - Save time and use toggle buttons for enabling or disabling add-ons.
40
- * **Social share setting** - Allow users to share their achieved badges on their social profiles.
41
- * **Treasures** - A brand new collection of attractive graphical images that can be used for ranks and badges.
42
- * **Suggestions** - Submit your ideas and suggestions on the new suggestion page.
43
-
44
- = BECOME A VIP MEMBER OF THE MYCRED MEMBERSHIP CLUB =
45
-
46
- Join the myCred membership club today and take advantage of premium services that include priority customer support and hundreds of add-ons at a super-saver price - Save 30% on all 3-year plans!
47
-
48
- - Instantly gain access to 50+ myCred add-ons.
49
- - Premium support & priority updates.
50
- - One membership license key that works for all add-ons.
51
- - Connect multiple sites with just one membership license key.
52
- - Upgrade your package at any time to get more add-ons.
53
-
54
- [Check the package pricing page for the add-on list](https://mycred.me/membership/)
55
-
56
- = Features =
57
- = Point Management =
58
- Empower your WordPress website users by rewarding them points – each user has their own POINT BALANCE that can be used in purchasing online products or online activities.
59
-
60
- **- Point Balances**: Each user on your website will have their own point balance, where they’ll be able to gain/lose viewpoints.
61
- **- Account History**: Each time a user gains or loses points on your website, the transaction is logged into a central log for accountability.
62
- **- Points Management**: You have full control over your users’ point balances; You can adjust your user/s balance by adding or removing points with or without a log entry.
63
- **- Automatic Points**: Automatically award or deduct points from your user’s balance for their interaction on your WordPress/WooCommerce website.
64
- **- Multiple Point Types**: Create multiple point types through the admin area to manage things easily. There is no limit to the number of point types you can have at your disposal.
65
- **- Buy Points**: The buyCred add-on allows your users to purchase points using real money using some of the most popular payment gateways available in the market today.
66
- **- Store Payments**: myCred supports some of the most popular store plugins for WordPress, allowing your users to pay for orders/tickets using their point balance instead of real money.
67
-
68
- = Badges =
69
-
70
- **- Open Badge Functionality** - new opportunities to recognize and validate achievements digitally.
71
- **- Add badge details** (name, achievement, website details, etc.).
72
- **- Badge recognition and validation** through different badge verification websites.
73
- **- Single Badge Page** is an exclusive page for each badge and its information (badge name, image, badge description, achievements, and benefits)
74
- **- Open Badge Search Filter** - [myCred badge list] shortcode gives you the ability to add search fields and filters for badges.
75
- **- Evidence Shortcode** - Technical support for badge verification purposes.
76
- **- Badge Evidence Download Button** - Access Open Badges of any users on the website. The admin can also download any given badge images.
77
- **- The “Quick Edit” badge option** will allow you to modify the information of any particular badge.
78
-
79
- = cashCred =
80
- **GIVE USERS THE POWER TO CONVERT THEIR MYCRED POINTS INTO REAL MONEY.**
81
-
82
- cashCred is a built-in myCred add-on that allows users to redeem myCred points for real money anytime, anywhere. Give users the power to earn points through myCred’s intelligent rewards system. Instead of giving them cash, you reward them with points that can be encashed at any time.
83
-
84
- cashCred works perfectly with a reward system that engages users to perform activities that require user interaction (watching a video, filling out a survey, and more).
85
-
86
- **- Convert Points to Cash** Users can redeem myCred points for money.
87
- **- Multiple Point Types** Allow multiple custom point types.
88
- **- Exchange Rates** – Define exchange rates for each point type.
89
- **- Cash Withdrawal** – Users can send a request to the admin for cash withdrawal
90
- **- User Requests** Approve or deny user requests for cash withdrawal.
91
- **- Additional Notes** – Write additional notes for users, which will be displayed on the payment form.
92
- **- Currency Code** Define the currency code (USD, GBP, AUD, etc.) for the payment form.
93
- **- Shortcode Support** – Display the cashCred module on the website using a shortcode.
94
- **- Set Limits & Restrictions** Set minimum or maximum restriction limits on point conversion requests.
95
- **- Pay Through PayPal** – cashCred supports payment through PayPal.
96
- **- Pay Through Stripe** cashCred supports payment through Stripe.
97
- **- Create email events/templates** for cashCred pending/approved/cancel requests.
98
-
99
- = Template Tags =
100
-
101
- **- Signup Referral Hook (%user_name%)** This hook returns a username whenever a user signup using a referral link.
102
- **- Sell Content (%Price%)** This template tag returns the number of points a user needs to purchase content.
103
- **- Badges (%badge_title% and %badge_image%)** Display users’ new badge title and image in the outgoing email.
104
- **- Ranks (%rank_title% and %rank_image%)** Display users’ new rank title and image in the outgoing email.
105
-
106
- = Dedicated Log =
107
- Each time myCred adds or deducts points from a user, the adjustment is logged in a dedicated log, allowing your users to browse their history. This log keeps a record of your user’s accountability, badges, and ranks, among other useful statistics.
108
-
109
- This log data can be converted into charts to help you visualize the usage and circulation of points on your website.
110
-
111
- You can achieve the following features by using a dedicated log for your points system:
112
-
113
- - Set a limit to the maximum number of times each hook can give out points to your user.
114
- - Badges will use the log’s data to determine which user has earned a badge.
115
- - Add-ons such as Sell Content use the log to track users who have purchased posts from your website.
116
- - Add-ons use the log to ensure that a user does not gain repetitive points for the same interaction within a given time frame.
117
-
118
- = Achievements/Assets =
119
-
120
- - Issue badges for any combination of achievements.
121
- - Detailed badge categorization.
122
- - Industry-related achievements.
123
- - Achievement list Shortcode allows you to display myCred badge listing in tabs individually or in a category.
124
-
125
- = Additional features =
126
-
127
- **- White-Labeling: myCred has built-in support for white-labeling**: This allows you to rename the plugin in your admin area to anything you like.
128
- **- Import & Export**: myCred comes with three built-in import tools allowing you to import points, log entries, or migrate your CubePoints installation.
129
- **- Multi-Site Support**: myCred has built-in support for multi-sites, allowing you to choose between using a unique myCred installation or centralize balances across your network.
130
- **- Leaderboards**: Generate leaderboards based on your user’s balance or points history – display users with the most points for a particular instance.
131
- **- myCred referral stats shortcode**: The [mycred_referral_stats] shortcode allows you to display the total count of referred visitors/signups users on your website.
132
- **- Theme Independent**: The myCred plugin is theme independent – Your theme needs to support widgets and shortcodes to run myCred.
133
- **- BuddyPress Ready**: myCred has had built-in support for BuddyPress through which you can access BuddyPress-related features like Insert point balances/badges/ranks into your user’s profiles.
134
- **- Bootstrap Ready**: myCred comes with minimal CSS styling to give you the freedom to style everything according to your needs.
135
- **- Translation Ready**: You can add your own language translation or adjust the built-in translation support.
136
- **- Back-up of your data** - Remove all/specific data upon plugin deletion from the database or keep it as a backup.
137
-
138
- = BUILT-IN ADD-ONS =
139
-
140
- myCred is much more than just a point management system - The plugin comes with several [built-in add-ons](https://www.mycred.me/add-ons/) that enable you to perform complex tasks such as transfer or buy points for real money, allow payments in stores, etc.
141
-
142
- **- Badges:** Award your users badges based on their points history.
143
- **- buyCred:** Let your users buy points in exchange for real money.
144
- **- Coupons:** Create coupons that can be redeemed for points.
145
- **- Email notifications:** Setup email notifications for status updates.
146
- **- Gateway:** Let users pay with points in your store.
147
- **- Notifications:** Enable popup notifications that display status updates.
148
- **- Ranks:** Create ranks based on the user's point balance.
149
- **- Sell Content:** Sell your content in exchange for points.
150
- **- Statistics:** Get a statistical overview of points in circulation, etc.
151
- **- Transfers:** Allow your users to transfer points to other users.
152
-
153
- Power your WordPress website with 50+ add-ons ranging from categories like **Gamification** and **Freebies** to **Third-Party Bridges** and **Store Gateway**.
154
-
155
- = BUILT-IN PLUGIN SUPPORT =
156
-
157
- myCred supports some of the most popular WordPress plugins like **BuddyPress, WooCommerce, Jetpack, Contact Form 7, Disqus, Gravity Forms,** among countless others.
158
-
159
- **Simple & organized“** To keep your admin area organized, myCred will only show features and setting for those third-party plugins that are installed and enabled.
160
-
161
-
162
- = INTEGRATED WITH THE MOST POPULAR LEARNING MANAGEMENT SYSTEMS =
163
- myCred is integrated with a large number of popular learning management systems, that include:
164
-
165
- - [LearnDash](https://wordpress.org/plugins/mycred-learndash/)
166
- - [LifterLMS](https://wordpress.org/plugins/mycred-lifterlms-integration/)
167
- - [WPLMS](https://wplms.io/support/knowledge-base/wplms-mycred-add-on/) (Free third-party integration)
168
- - [LearnPress](https://thimpress.com/product/mycred-add-on-for-learnpress/) (Paid third-party integration).
169
-
170
- = MYCRED'S INTEGRATION WITH YOUR FAVORITE PAGE BUILDERS: =
171
-
172
- - [myCred Elementor](https://www.mycred.me/store/mycred-elementor/)
173
- - [myCred Beaver Builder](https://www.mycred.me/store/mycred-beaver-builder/)
174
- - [myCred for WPBakery Page Builder](https://www.mycred.me/store/mycred-for-wpbakery-page-builder/)
175
-
176
-
177
- = MYCRED OFFERS A VARIETY OF FREE PLUGINS THAT INCLUDE: =
178
-
179
- - [LifterLMS Plugin Integration with myCred](https://www.mycred.me/store/mycred-lifterlms-integration/)
180
- - [myCred Credly](https://www.mycred.me/store/mycred-credly/)
181
- - [myCred BP Group Leaderboards](https://www.mycred.me/store/mycred-bp-group-leaderboards/)
182
- - [myCred for WP-Pro-Quiz](https://www.mycred.me/store/mycred-for-wp-pro-quiz/)
183
- - [myCred for Rating Form](https://www.mycred.me/store/mycred-for-rating-form/)
184
- [Explore to find out more...](https://www.mycred.me/product-category/freebies/)
185
-
186
-
187
- = MYCRED'S THIRD-PARTY BRIDGES PLUGINS: =
188
-
189
- - [Stripe - buyCred Gateway](https://www.mycred.me/store/buycred-stripe/)
190
- - [Easy Digital Downloads - myCred Gateway](https://www.mycred.me/store/mycred-for-easy-digital-downloads/)
191
- - [myCred Zapier Addon](https://mycred.me/store/mycred-zapier-addon/)
192
- - [myCred Dokan](https://www.mycred.me/store/mycred-dokan/)
193
- - [myCred WCVendors](https://www.mycred.me/store/mycred-wc-vendors/)
194
- - [myCred Learndash](https://www.mycred.me/store/mycred-learndash/)
195
- - [myCred for Users Ultra](https://www.mycred.me/store/mycred-for-users-ultra/)
196
- - [myCred for User Pro](https://www.mycred.me/store/mycred-for-user-pro/)
197
-
198
- = MYCRED'S GAMIFICATION PLUGINS: =
199
-
200
- - [myCred PacMan](https://www.mycred.me/store/mycred-pacman/)
201
- - [Wheel of Fortune Add-On](https://www.mycred.me/store/wheel-of-fortune-add-on/)
202
-
203
-
204
- = MYCRED'S ENHANCEMENT PLUGINS: =
205
-
206
- - [myCred WooCommerce Plus](https://www.mycred.me/store/mycred-woocommerce-plus/)
207
- - [myCred Email Digest](https://mycred.me/store/mycred-email-digest/)
208
- - [myCred Progress Map](https://mycred.me/store/mycred-progress-map/)
209
- - [myCred Points Cap](https://mycred.me/store/mycred-points-cap/)
210
- - [myCred Level Cred](https://www.mycred.me/store/mycred-level-cred/)
211
- - [myCred Social Proof](https://www.mycred.me/store/mycred-social-proof/)
212
- - [myCred SMS Payments - Twilio Transfers](https://www.mycred.me/store/sms-payments/)
213
- - [myCred Expiration Add on](https://www.mycred.me/store/mycred-expiration-add-on/)
214
- - [myCred Social Share Add on](https://www.mycred.me/store/mycred-social-share-add-on/)
215
- - [myCred Progress Bar Add on](https://www.mycred.me/store/mycred-progress-bar-add-on/)
216
- - [myCred Video Add-on For JW Player](https://www.mycred.me/store/jw-player-with-mycred/)
217
- - [myCred BP Charges](https://www.mycred.me/store/mycred-bp-charges/)
218
- - [myCred Rest API](https://www.mycred.me/store/mycred-rest-api/)
219
- - [myCred Transfer Plus](https://www.mycred.me/store/transfer-plus/)
220
- - [myCred Video Add-on For Vimeo](https://www.mycred.me/store/video-add-on/)
221
- - [myCred Notifications Plus Add-on](https://www.mycred.me/store/notifications-plus-add-on/)
222
-
223
-
224
- = Documentation =
225
-
226
- You can find extensive [documentation](http://codex.mycred.me/) on myCred related add-ons in the myCred Codex. You can also find a list of [frequently asked](https://mycred.me/about/faq/) questions on the myCred website.
227
-
228
-
229
- = Customizations =
230
-
231
- myCred has the ability to do-it-all because we have put in a lot of effort to make sure that the supported plugins are as developer-friendly as possible. If you need to build a custom feature, simply submit a [request for a quote](https://mycred.me/customize/request-quote/) via the myCred website.
232
-
233
-
234
- = Support =
235
-
236
- We offer support on our [myCred website](https://mycred.me/support/) from 9 AM - 5 PM, Monday to Friday (GMT+5).
237
-
238
- You can either submit a [customization request](https://mycred.me/customize/request-quote/) or open a [support ticket](https://mycred.me/support/) any time you're facing trouble with myCred.
239
-
240
- If you're facing a problem that is not described in our technical documentation, we suggest that you consult myCred's [online community](https://mycred.me/support/forums/) with your question. We pay users through myCred Store Tokens as a reward for reporting bugs and even their fixes.
241
-
242
- == Installation ==
243
-
244
- = myCRED Guides =
245
-
246
- [Chapter I - Introduction](http://codex.mycred.me/chapter-i/)
247
-
248
- [Chapter II - Getting Started](http://codex.mycred.me/chapter-ii/)
249
-
250
- [Chapter III - Add-ons](http://codex.mycred.me/chapter-iii/)
251
-
252
- [Chapter IV - Premium Add-ons](http://codex.mycred.me/chapter-iv/)
253
-
254
- [Chapter V - For Developers](http://codex.mycred.me/chapter-v/)
255
-
256
- [Chapter VI - Reference Guides](http://codex.mycred.me/chapter-vi/)
257
-
258
-
259
- == Frequently Asked Questions ==
260
-
261
- You can find a list of [frequently asked questions](https://mycred.me/about/faq/) on the myCRED website.
262
-
263
- == Screenshots ==
264
-
265
- 1. **Point Type Image**
266
- 2. **Built in Add-ons**
267
- 3. **Free Add-ons**
268
- 4. **Premium Add-ons**
269
- 5. **Badges Social Share**
270
- 6. **Badges Layout & Alignment**
271
-
272
- == Upgrade Notice ==
273
-
274
- = 2.2 =
275
- New features and Bug fixes.
276
-
277
- = 2.1.1 =
278
- New features and Bug fixes.
279
-
280
- = 2.1 =
281
- New features and Bug fixes.
282
-
283
- = 2.0 =
284
- The banking module have been replaced by Central deposite module, and interest related functionality has been removed. If you are using simple interest or compound interest related functionality, you will fine the respective functionalities missing after the update.
285
-
286
- == Other Notes ==
287
-
288
- = Requirements =
289
- * WordPress 4.8 or greater
290
- * PHP version 5.6 or greater
291
- * PHP mcrypt library enabled
292
- * MySQL version 5.0 or greater
293
-
294
- = Language Contributors =
295
- * Swedish - Gabriel S Merovingi
296
- * French - Chouf1 [Dan - BuddyPress France](http://bp-fr.net/)
297
- * Persian - Mani Akhtar
298
- * Spanish - Jose Maria Bescos [Website](http://www.ibidem-translations.com/spanish.php)
299
- * Russian - Skladchik
300
- * Chinese - suifengtec [Website](http://coolwp.com)
301
- * Portuguese (Brazil) - Guilherme
302
- * Japanese - Mochizuki Hiroshi
303
-
304
-
305
- == Changelog ==
306
-
307
- = 2.2 =
308
- - **NEW** - Moved general settings and menus into the newly introduced "myCred" main menu.
309
- - **NEW** - On plugin activation, the default point type will be created automatically.
310
- - **NEW** - Added new template tags in email notification for transfer events.
311
- - **NEW** - Now user can upload a Point type image.
312
- - **NEW** - Introduced an image attribute in mycred_my_balance shortcode.
313
- - **NEW** - Introduced an image attribute in mycred_leaderboard shortcode.
314
- - **NEW** - Introduced Single badge page layout setting.
315
- - **NEW** - Introduced a enable/disable all addons button.
316
- - **NEW** - Users can share their achieved Badges on social media.
317
- - **TWEAK** - When a user deletes the log of buy_content, the sales count does not get updated. So, we have Introduced the "Update Sales Count" button in the settings.
318
- - **TWEAK** - Improve new point type creation form setting.
319
- - **FIX** - Backend logs are not being exported whether the export raw/formatted log option is set.
320
- - **FIX** - Incorrect achieved badge level image in [mycred_badges] shortcode.
321
- - **FIX** - In the Ranks list page All/Published/Trash links not working properly.
322
- - **FIX** - Unable to revoke badge from the User profile page. FIX – Added some security validations in the transfer form.
323
- - **FIX** - MYSQL 8 syntax error in the leaderboard shortcode.
324
- - **FIX** - Added compatibility with BuddyPress version 8.0
325
-
326
- = 2.1.1 =
327
- - **NEW** - Introduced new template tags %badge_image%, %badge_title%, %rank_image% and %rank_title% for myCred email notification addon.
328
- - **NEW** - Added support for cashCred payment email in myCred email notification addon.
329
- - **NEW** - Added myCred Open badge image download button in the user profile(backend).
330
- - **NEW** - Added a new support menu in myCred for suggestions and support.
331
- - **NEW** - Added search bar and filters in mycred_badges_list shortcode.
332
- - **NEW** - Introduced a new template tag %price% for myCred sell content "Insufficient Funds Template".
333
- - **NEW** - myCred Badge Quick Edit.
334
- - **NEW** - Introduced a new shortcode mycred_referral_stats which shows the referral stats for logged-in users.
335
- - **NEW** - Introduced a new template tag %user_name% for "Signup Referral" log template.
336
- - **NEW** - Introduced a setting for uninstalling. Now users can select which data will be deleted during myCred uninstall.
337
- - **NEW** - Introduced new action hook mycred_after_points_referral.
338
- - **NEW** - Introduced new action hook mycred_after_referring_signups.
339
- - **NEW** - Introduced new filter hook mycred_hook_referrals.
340
- - **NEW** - Introduced new filter hook mycred_before_hooks_save.
341
- - **NEW** - Introduced new fitler hook mycred_woo_gateway_user_id.
342
- - **FIX** - Unable to deactivate point types in buyCred Setting.
343
- - **FIX** - The user was unable to export the log from the frontend.
344
- - **FIX** - Height and width attributes in the mycred_my_badges shortcode were not working.
345
- - **FIX** - myCred Cubepoints importer was not importing date correctly.
346
- - **FIX** - If badges AND ranks were not active email notifications were not sending emails.
347
- - **FIX** - The user was unable to export the log from the frontend.
348
- - **FIX** - In the mycred_sales_history shortcode expires time was incorrect.
349
- - **FIX** - A broken image shows when the badge image does not set.
350
-
351
- = 2.1.0.3 =
352
- - **FIX** - Email notification issues.
353
- - **FIX** - Broken image if badge default image wasn't set.
354
- - **FIX** - mycred_my_badges width and height attributes wasn't working.
355
-
356
- = 2.1.0.2 =
357
- Improvement - Code optimization
358
-
359
- = 2.1.0.1 =
360
- - **FIX** - Remove warnings
361
-
362
- = 2.1 =
363
- - **NEW** - Open badge functionality in myCred Badge addon.
364
- - **NEW** - Introduce Achievement Types.
365
- - **NEW** - Introduce a new shortcode mycred_badges_list.
366
- - **NEW** - Single badge page.
367
- - **NEW** - Added support into Badges for Anniversary hook.
368
- - **NEW** - Added support into Badges for wooCommerce purchase reward.
369
- - **NEW** - Added %rank_title% template tag support in Email Notifications.
370
- - **NEW** - Added attributes in mycred_transfer shortcode.
371
- - **FIX** - mycred_history shortcode pagination not working properly when cache enabled.
372
- - **FIX** - Ranks weren't working properly on the current balance.
373
- - **FIX** - mycred_sell_this shortcode not working in the bbPress topic
374
- - **FIX** - The central deposit missing log entry in some cases.
375
- - **TWEAK** - Removed deprecated functions.
376
- - **TWEAK** - Code Improvement.
377
- - **TWEAK** - Improve styling of mycred_transfer shortcode.
378
-
379
- = 2.0.2 =
380
- - **NEW** - Added compatibility for multiple currencies in CashCred Paypal addon
381
- - **FIX** - Php erros in myCred woocommerce gateway
382
- - **FIX** - Points on daily visit hooks not working in some conditions
383
- - **FIX** - myCred CashCred multisite issues
384
- - **TWEAK** - license system
385
-
386
- = 2.0.1 =
387
- - **FIX** - myCred membership license not activating for members
388
-
389
- = 2.0 =
390
- - **NEW** - myCred CashCred
391
- - **NEW** - Added filter 'mycred_link_click_amount'
392
- - **NEW** - Added exclude attribute in myCred leaderboard
393
- - **NEW** - Added 'NOT LIKE' and '!=' operator for expiration addon
394
- - **FIX** - Php notices in rank addon
395
- - **FIX** - Rewards points option not visible for other product type in woocommerce
396
- - **FIX** - Erros in mycred_total_balance shortcode
397
- - **FIX** - myCred logs export issue
398
- - **FIX** - Fixed mycred admin dashboard overview widget showing incorrect or same amount of points
399
- - **FIX** - buyCred gift_to attribute not working
400
- - **TWEAK** - myCred Central Deposit
401
-
402
- = Previous Versions =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  https://mycred.me/support/changelog/
1
+ === myCred - Points, Rewards, Gamification, Ranks, Badges & Loyalty Plugin ===
2
+ Contributors: mycred,wpexpertsio
3
+ Tags: badges, gamification, loyalty, points, rewards
4
+ Requires at least: 4.8
5
+ Tested up to: 5.8.1
6
+ Stable tag: 2.3
7
+ Requires PHP: 7.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ An adaptive and powerful points management system for WordPress powered websites.
12
+
13
+ == Description ==
14
+
15
+ myCred is an intelligent and adaptive **points management system** that allows you to build and manage a broad range of digital rewards including points, ranks and, badges on your WordPress/WooCommerce powered website.
16
+
17
+ [youtube https://www.youtube.com/watch?v=-M19tzYo1jo]
18
+
19
+ Build **brand loyalty** by rewarding your customers through store reward systems, community leaderboards, monetizing your website content, etc. - The possibilities are endless.
20
+
21
+ **Increase customer engagement tenfold - Rewarding your users for community engagement will help your business grow.**
22
+
23
+ = AMAZING AWARD SYSTEMS TO ENGAGE AND REWARD LOYAL CUSTOMERS =
24
+
25
+ myCred allows **THREE different ways** through which you can award your users:
26
+
27
+ * **Points -** Set events and triggers to allow real-time tracking and automatically award your users with points.
28
+
29
+ * **Ranks -** Set ranks within your leaderboards and reward your users with significant perks after they reach a certain milestone.
30
+
31
+ * **Badges -** Boost your users' participation by rewarding them for their exceptional performance.
32
+
33
+ **Latest update - myCred v2.3**
34
+
35
+ **myCred v2.3** is a core update that helps the admin award points, badges and ranks to users in bulk. Similarly, the admin can also choose to revoke these award types from multiple users simultaneously.
36
+
37
+ Here are some of the most prominent features of the latest update:
38
+
39
+ * A “Bulk Assign” tool for awarding/revoking points, badges, and ranks in bulk.
40
+ * The admin can exclude any user role from receiving points. Previously, the admin could only exclude users using user ID only.
41
+ * A timeframe attribute in [mycred_my_balance_converted] shortcode - users can see their converted point balance in a given timeframe using predefined filters (Yesterday, Today, this week, this month, last month).
42
+
43
+ **Last update - myCred v2.2**
44
+
45
+ **myCred v2.2** focuses on improving the overall user interface, single badge page layout, point-type image, and social media sharing for a better user experience and operational efficiency.
46
+
47
+ * **New UI design of the main menu** - A fresh new look of our main menu allows users to easily navigate between logs, hooks, and general settings.
48
+ * **Upload Point-type image** - Give your point type a unique identity by assigning them an image.
49
+ * **Enable/Disable add-ons** - Save time and use toggle buttons for enabling or disabling add-ons.
50
+ * **Social share setting** - Allow users to share their achieved badges on their social profiles.
51
+ * **Treasures** - A brand new collection of attractive graphical images that can be used for ranks and badges.
52
+ * **Suggestions** - Submit your ideas and suggestions on the new suggestion page.
53
+
54
+ = BECOME A VIP MEMBER OF THE MYCRED MEMBERSHIP CLUB =
55
+
56
+ Join the myCred membership club today and take advantage of premium services that include priority customer support and hundreds of add-ons at a super-saver price - Save 30% on all 3-year plans!
57
+
58
+ - Instantly gain access to 50+ myCred add-ons.
59
+ - Premium support & priority updates.
60
+ - One membership license key that works for all add-ons.
61
+ - Connect multiple sites with just one membership license key.
62
+ - Upgrade your package at any time to get more add-ons.
63
+
64
+ [Check the package pricing page for the add-on list](https://mycred.me/membership/)
65
+
66
+ = Features =
67
+ = Point Management =
68
+ Empower your WordPress website users by rewarding them points – each user has their own POINT BALANCE that can be used in purchasing online products or online activities.
69
+
70
+ **- Point Balances**: Each user on your website will have their own point balance, where they’ll be able to gain/lose viewpoints.
71
+ **- Account History**: Each time a user gains or loses points on your website, the transaction is logged into a central log for accountability.
72
+ **- Points Management**: You have full control over your users’ point balances; You can adjust your user/s balance by adding or removing points with or without a log entry.
73
+ **- Automatic Points**: Automatically award or deduct points from your user’s balance for their interaction on your WordPress/WooCommerce website.
74
+ **- Multiple Point Types**: Create multiple point types through the admin area to manage things easily. There is no limit to the number of point types you can have at your disposal.
75
+ **- Buy Points**: The buyCred add-on allows your users to purchase points using real money using some of the most popular payment gateways available in the market today.
76
+ **- Store Payments**: myCred supports some of the most popular store plugins for WordPress, allowing your users to pay for orders/tickets using their point balance instead of real money.
77
+
78
+ = Badges =
79
+
80
+ **- Open Badge Functionality** - new opportunities to recognize and validate achievements digitally.
81
+ **- Add badge details** (name, achievement, website details, etc.).
82
+ **- Badge recognition and validation** through different badge verification websites.
83
+ **- Single Badge Page** is an exclusive page for each badge and its information (badge name, image, badge description, achievements, and benefits)
84
+ **- Open Badge Search Filter** - [myCred badge list] shortcode gives you the ability to add search fields and filters for badges.
85
+ **- Evidence Shortcode** - Technical support for badge verification purposes.
86
+ **- Badge Evidence Download Button** - Access Open Badges of any users on the website. The admin can also download any given badge images.
87
+ **- The “Quick Edit” badge option** will allow you to modify the information of any particular badge.
88
+
89
+ = cashCred =
90
+ **GIVE USERS THE POWER TO CONVERT THEIR MYCRED POINTS INTO REAL MONEY.**
91
+
92
+ cashCred is a built-in myCred add-on that allows users to redeem myCred points for real money anytime, anywhere. Give users the power to earn points through myCred’s intelligent rewards system. Instead of giving them cash, you reward them with points that can be encashed at any time.
93
+
94
+ cashCred works perfectly with a reward system that engages users to perform activities that require user interaction (watching a video, filling out a survey, and more).
95
+
96
+ **- Convert Points to Cash** – Users can redeem myCred points for money.
97
+ **- Multiple Point Types** – Allow multiple custom point types.
98
+ **- Exchange Rates** – Define exchange rates for each point type.
99
+ **- Cash Withdrawal** – Users can send a request to the admin for cash withdrawal
100
+ **- User Requests** – Approve or deny user requests for cash withdrawal.
101
+ **- Additional Notes** – Write additional notes for users, which will be displayed on the payment form.
102
+ **- Currency Code** – Define the currency code (USD, GBP, AUD, etc.) for the payment form.
103
+ **- Shortcode Support** – Display the cashCred module on the website using a shortcode.
104
+ **- Set Limits & Restrictions** – Set minimum or maximum restriction limits on point conversion requests.
105
+ **- Pay Through PayPal** – cashCred supports payment through PayPal.
106
+ **- Pay Through Stripe** – cashCred supports payment through Stripe.
107
+ **- Create email events/templates** for cashCred pending/approved/cancel requests.
108
+
109
+ = Template Tags =
110
+
111
+ **- Signup Referral Hook (%user_name%)** – This hook returns a username whenever a user signup using a referral link.
112
+ **- Sell Content (%Price%)** – This template tag returns the number of points a user needs to purchase content.
113
+ **- Badges (%badge_title% and %badge_image%)** – Display users’ new badge title and image in the outgoing email.
114
+ **- Ranks (%rank_title% and %rank_image%)** – Display users’ new rank title and image in the outgoing email.
115
+
116
+ = Dedicated Log =
117
+ Each time myCred adds or deducts points from a user, the adjustment is logged in a dedicated log, allowing your users to browse their history. This log keeps a record of your user’s accountability, badges, and ranks, among other useful statistics.
118
+
119
+ This log data can be converted into charts to help you visualize the usage and circulation of points on your website.
120
+
121
+ You can achieve the following features by using a dedicated log for your points system:
122
+
123
+ - Set a limit to the maximum number of times each hook can give out points to your user.
124
+ - Badges will use the log’s data to determine which user has earned a badge.
125
+ - Add-ons such as Sell Content use the log to track users who have purchased posts from your website.
126
+ - Add-ons use the log to ensure that a user does not gain repetitive points for the same interaction within a given time frame.
127
+
128
+ = Achievements/Assets =
129
+
130
+ - Issue badges for any combination of achievements.
131
+ - Detailed badge categorization.
132
+ - Industry-related achievements.
133
+ - Achievement list Shortcode allows you to display myCred badge listing in tabs individually or in a category.
134
+
135
+ = Additional features =
136
+
137
+ **- White-Labeling: myCred has built-in support for white-labeling**: This allows you to rename the plugin in your admin area to anything you like.
138
+ **- Import & Export**: myCred comes with three built-in import tools allowing you to import points, log entries, or migrate your CubePoints installation.
139
+ **- Multi-Site Support**: myCred has built-in support for multi-sites, allowing you to choose between using a unique myCred installation or centralize balances across your network.
140
+ **- Leaderboards**: Generate leaderboards based on your user’s balance or points history – display users with the most points for a particular instance.
141
+ **- myCred referral stats shortcode**: The [mycred_referral_stats] shortcode allows you to display the total count of referred visitors/signups users on your website.
142
+ **- Theme Independent**: The myCred plugin is theme independent – Your theme needs to support widgets and shortcodes to run myCred.
143
+ **- BuddyPress Ready**: myCred has had built-in support for BuddyPress through which you can access BuddyPress-related features like Insert point balances/badges/ranks into your user’s profiles.
144
+ **- Bootstrap Ready**: myCred comes with minimal CSS styling to give you the freedom to style everything according to your needs.
145
+ **- Translation Ready**: You can add your own language translation or adjust the built-in translation support.
146
+ **- Back-up of your data** - Remove all/specific data upon plugin deletion from the database or keep it as a backup.
147
+
148
+ = BUILT-IN ADD-ONS =
149
+
150
+ myCred is much more than just a point management system - The plugin comes with several [built-in add-ons](https://www.mycred.me/add-ons/) that enable you to perform complex tasks such as transfer or buy points for real money, allow payments in stores, etc.
151
+
152
+ **- Badges:** Award your users badges based on their points history.
153
+ **- buyCred:** Let your users buy points in exchange for real money.
154
+ **- Coupons:** Create coupons that can be redeemed for points.
155
+ **- Email notifications:** Setup email notifications for status updates.
156
+ **- Gateway:** Let users pay with points in your store.
157
+ **- Notifications:** Enable popup notifications that display status updates.
158
+ **- Ranks:** Create ranks based on the user's point balance.
159
+ **- Sell Content:** Sell your content in exchange for points.
160
+ **- Statistics:** Get a statistical overview of points in circulation, etc.
161
+ **- Transfers:** Allow your users to transfer points to other users.
162
+
163
+ Power your WordPress website with 50+ add-ons ranging from categories like **Gamification** and **Freebies** to **Third-Party Bridges** and **Store Gateway**.
164
+
165
+ = BUILT-IN PLUGIN SUPPORT =
166
+
167
+ myCred supports some of the most popular WordPress plugins like **BuddyPress, WooCommerce, Jetpack, Contact Form 7, Disqus, Gravity Forms,** among countless others.
168
+
169
+ **Simple & organized“** To keep your admin area organized, myCred will only show features and setting for those third-party plugins that are installed and enabled.
170
+
171
+
172
+ = INTEGRATED WITH THE MOST POPULAR LEARNING MANAGEMENT SYSTEMS =
173
+ myCred is integrated with a large number of popular learning management systems, that include:
174
+
175
+ - [LearnDash](https://wordpress.org/plugins/mycred-learndash/)
176
+ - [LifterLMS](https://wordpress.org/plugins/mycred-lifterlms-integration/)
177
+ - [WPLMS](https://wplms.io/support/knowledge-base/wplms-mycred-add-on/) (Free third-party integration)
178
+ - [LearnPress](https://thimpress.com/product/mycred-add-on-for-learnpress/) (Paid third-party integration).
179
+
180
+ = MYCRED'S INTEGRATION WITH YOUR FAVORITE PAGE BUILDERS: =
181
+
182
+ - [myCred Elementor](https://www.mycred.me/store/mycred-elementor/)
183
+ - [myCred Beaver Builder](https://www.mycred.me/store/mycred-beaver-builder/)
184
+ - [myCred for WPBakery Page Builder](https://www.mycred.me/store/mycred-for-wpbakery-page-builder/)
185
+
186
+
187
+ = MYCRED OFFERS A VARIETY OF FREE PLUGINS THAT INCLUDE: =
188
+
189
+ - [LifterLMS Plugin Integration with myCred](https://www.mycred.me/store/mycred-lifterlms-integration/)
190
+ - [myCred Credly](https://www.mycred.me/store/mycred-credly/)
191
+ - [myCred BP Group Leaderboards](https://www.mycred.me/store/mycred-bp-group-leaderboards/)
192
+ - [myCred for WP-Pro-Quiz](https://www.mycred.me/store/mycred-for-wp-pro-quiz/)
193
+ - [myCred for Rating Form](https://www.mycred.me/store/mycred-for-rating-form/)
194
+ [Explore to find out more...](https://www.mycred.me/product-category/freebies/)
195
+
196
+
197
+ = MYCRED'S THIRD-PARTY BRIDGES PLUGINS: =
198
+
199
+ - [Stripe - buyCred Gateway](https://www.mycred.me/store/buycred-stripe/)
200
+ - [Easy Digital Downloads - myCred Gateway](https://www.mycred.me/store/mycred-for-easy-digital-downloads/)
201
+ - [myCred Zapier Addon](https://mycred.me/store/mycred-zapier-addon/)
202
+ - [myCred Dokan](https://www.mycred.me/store/mycred-dokan/)
203
+ - [myCred WCVendors](https://www.mycred.me/store/mycred-wc-vendors/)
204
+ - [myCred Learndash](https://www.mycred.me/store/mycred-learndash/)
205
+ - [myCred for Users Ultra](https://www.mycred.me/store/mycred-for-users-ultra/)
206
+ - [myCred for User Pro](https://www.mycred.me/store/mycred-for-user-pro/)
207
+
208
+ = MYCRED'S GAMIFICATION PLUGINS: =
209
+
210
+ - [myCred PacMan](https://www.mycred.me/store/mycred-pacman/)
211
+ - [Wheel of Fortune Add-On](https://www.mycred.me/store/wheel-of-fortune-add-on/)
212
+
213
+
214
+ = MYCRED'S ENHANCEMENT PLUGINS: =
215
+
216
+ - [myCred WooCommerce Plus](https://www.mycred.me/store/mycred-woocommerce-plus/)
217
+ - [myCred Email Digest](https://mycred.me/store/mycred-email-digest/)
218
+ - [myCred Progress Map](https://mycred.me/store/mycred-progress-map/)
219
+ - [myCred Points Cap](https://mycred.me/store/mycred-points-cap/)
220
+ - [myCred Level Cred](https://www.mycred.me/store/mycred-level-cred/)
221
+ - [myCred Social Proof](https://www.mycred.me/store/mycred-social-proof/)
222
+ - [myCred SMS Payments - Twilio Transfers](https://www.mycred.me/store/sms-payments/)
223
+ - [myCred Expiration Add on](https://www.mycred.me/store/mycred-expiration-add-on/)
224
+ - [myCred Social Share Add on](https://www.mycred.me/store/mycred-social-share-add-on/)
225
+ - [myCred Progress Bar Add on](https://www.mycred.me/store/mycred-progress-bar-add-on/)
226
+ - [myCred Video Add-on For JW Player](https://www.mycred.me/store/jw-player-with-mycred/)
227
+ - [myCred BP Charges](https://www.mycred.me/store/mycred-bp-charges/)
228
+ - [myCred Rest API](https://www.mycred.me/store/mycred-rest-api/)
229
+ - [myCred Transfer Plus](https://www.mycred.me/store/transfer-plus/)
230
+ - [myCred Video Add-on For Vimeo](https://www.mycred.me/store/video-add-on/)
231
+ - [myCred Notifications Plus Add-on](https://www.mycred.me/store/notifications-plus-add-on/)
232
+
233
+
234
+ = Documentation =
235
+
236
+ You can find extensive [documentation](http://codex.mycred.me/) on myCred related add-ons in the myCred Codex. You can also find a list of [frequently asked](https://mycred.me/about/faq/) questions on the myCred website.
237
+
238
+
239
+ = Customizations =
240
+
241
+ myCred has the ability to do-it-all because we have put in a lot of effort to make sure that the supported plugins are as developer-friendly as possible. If you need to build a custom feature, simply submit a [request for a quote](https://mycred.me/customize/request-quote/) via the myCred website.
242
+
243
+
244
+ = Support =
245
+
246
+ We offer support on our [myCred website](https://mycred.me/support/) from 9 AM - 5 PM, Monday to Friday (GMT+5).
247
+
248
+ You can either submit a [customization request](https://mycred.me/customize/request-quote/) or open a [support ticket](https://mycred.me/support/) any time you're facing trouble with myCred.
249
+
250
+ If you're facing a problem that is not described in our technical documentation, we suggest that you consult myCred's [online community](https://mycred.me/support/forums/) with your question. We pay users through myCred Store Tokens as a reward for reporting bugs and even their fixes.
251
+
252
+ == Installation ==
253
+
254
+ = myCRED Guides =
255
+
256
+ [Chapter I - Introduction](http://codex.mycred.me/chapter-i/)
257
+
258
+ [Chapter II - Getting Started](http://codex.mycred.me/chapter-ii/)
259
+
260
+ [Chapter III - Add-ons](http://codex.mycred.me/chapter-iii/)
261
+
262
+ [Chapter IV - Premium Add-ons](http://codex.mycred.me/chapter-iv/)
263
+
264
+ [Chapter V - For Developers](http://codex.mycred.me/chapter-v/)
265
+
266
+ [Chapter VI - Reference Guides](http://codex.mycred.me/chapter-vi/)
267
+
268
+
269
+ == Frequently Asked Questions ==
270
+
271
+ You can find a list of [frequently asked questions](https://mycred.me/about/faq/) on the myCRED website.
272
+
273
+ == Screenshots ==
274
+
275
+ 1. **Point Type Image**
276
+ 2. **Built in Add-ons**
277
+ 3. **Free Add-ons**
278
+ 4. **Premium Add-ons**
279
+ 5. **Badges Social Share**
280
+ 6. **Badges Layout & Alignment**
281
+
282
+ == Upgrade Notice ==
283
+
284
+ = 2.3 =
285
+ New features and Bug fixes.
286
+
287
+ = 2.2 =
288
+ New features and Bug fixes.
289
+
290
+ = 2.1.1 =
291
+ New features and Bug fixes.
292
+
293
+ = 2.1 =
294
+ New features and Bug fixes.
295
+
296
+ = 2.0 =
297
+ The banking module have been replaced by Central deposite module, and interest related functionality has been removed. If you are using simple interest or compound interest related functionality, you will fine the respective functionalities missing after the update.
298
+
299
+ == Other Notes ==
300
+
301
+ = Requirements =
302
+ * WordPress 4.8 or greater
303
+ * PHP version 5.6 or greater
304
+ * PHP mcrypt library enabled
305
+ * MySQL version 5.0 or greater
306
+
307
+ = Language Contributors =
308
+ * Swedish - Gabriel S Merovingi
309
+ * French - Chouf1 [Dan - BuddyPress France](http://bp-fr.net/)
310
+ * Persian - Mani Akhtar
311
+ * Spanish - Jose Maria Bescos [Website](http://www.ibidem-translations.com/spanish.php)
312
+ * Russian - Skladchik
313
+ * Chinese - suifengtec [Website](http://coolwp.com)
314
+ * Portuguese (Brazil) - Guilherme
315
+ * Japanese - Mochizuki Hiroshi
316
+
317
+
318
+ == Changelog ==
319
+
320
+ = 2.3 =
321
+ - **NEW** - Introduced a "Bulk Assign" tool for awarding/revoking points, badges, and ranks.
322
+ - **NEW** - Introduced a new feature "Exclude by user role" admin can exclude any user role from the specific point type.
323
+ - **NEW** - Introduced a timeframe attribute in [mycred_my_balance_converted] shortcode. Now you can show users converted balance of a given timeframe today, yesterday, this week, this month, last month.
324
+ - **FIX** - Sometimes user's ranks were not updating automatically.
325
+ - **FIX** - Membership page layout issues.
326
+ - **FIX** - Points conversion not working when using arrows to increase or decrease the amount in [mycred_cashcred] shortcode.
327
+ - **FIX** - buyCred payment dialog couldn’t load on the subsite.
328
+ - **FIX** - After deleting the badge their data will keep existing on the user's meta.
329
+ - **FIX** - "this-week" value not working in [mycred_leaderboard] timeframe attribute when the week starts other than "Monday" in your WordPress setting.
330
+
331
+ = 2.2 =
332
+ - **NEW** - Moved general settings and menus into the newly introduced "myCred" main menu.
333
+ - **NEW** - On plugin activation, the default point type will be created automatically.
334
+ - **NEW** - Added new template tags in email notification for transfer events.
335
+ - **NEW** - Now user can upload a Point type image.
336
+ - **NEW** - Introduced an image attribute in mycred_my_balance shortcode.
337
+ - **NEW** - Introduced an image attribute in mycred_leaderboard shortcode.
338
+ - **NEW** - Introduced Single badge page layout setting.
339
+ - **NEW** - Introduced a enable/disable all addons button.
340
+ - **NEW** - Users can share their achieved Badges on social media.
341
+ - **TWEAK** - When a user deletes the log of buy_content, the sales count does not get updated. So, we have Introduced the "Update Sales Count" button in the settings.
342
+ - **TWEAK** - Improve new point type creation form setting.
343
+ - **FIX** - Backend logs are not being exported whether the export raw/formatted log option is set.
344
+ - **FIX** - Incorrect achieved badge level image in [mycred_badges] shortcode.
345
+ - **FIX** - In the Ranks list page All/Published/Trash links not working properly.
346
+ - **FIX** - Unable to revoke badge from the User profile page. FIX – Added some security validations in the transfer form.
347
+ - **FIX** - MYSQL 8 syntax error in the leaderboard shortcode.
348
+ - **FIX** - Added compatibility with BuddyPress version 8.0
349
+
350
+ = 2.1.1 =
351
+ - **NEW** - Introduced new template tags %badge_image%, %badge_title%, %rank_image% and %rank_title% for myCred email notification addon.
352
+ - **NEW** - Added support for cashCred payment email in myCred email notification addon.
353
+ - **NEW** - Added myCred Open badge image download button in the user profile(backend).
354
+ - **NEW** - Added a new support menu in myCred for suggestions and support.
355
+ - **NEW** - Added search bar and filters in mycred_badges_list shortcode.
356
+ - **NEW** - Introduced a new template tag %price% for myCred sell content "Insufficient Funds Template".
357
+ - **NEW** - myCred Badge Quick Edit.
358
+ - **NEW** - Introduced a new shortcode mycred_referral_stats which shows the referral stats for logged-in users.
359
+ - **NEW** - Introduced a new template tag %user_name% for "Signup Referral" log template.
360
+ - **NEW** - Introduced a setting for uninstalling. Now users can select which data will be deleted during myCred uninstall.
361
+ - **NEW** - Introduced new action hook mycred_after_points_referral.
362
+ - **NEW** - Introduced new action hook mycred_after_referring_signups.
363
+ - **NEW** - Introduced new filter hook mycred_hook_referrals.
364
+ - **NEW** - Introduced new filter hook mycred_before_hooks_save.
365
+ - **NEW** - Introduced new fitler hook mycred_woo_gateway_user_id.
366
+ - **FIX** - Unable to deactivate point types in buyCred Setting.
367
+ - **FIX** - The user was unable to export the log from the frontend.
368
+ - **FIX** - Height and width attributes in the mycred_my_badges shortcode were not working.
369
+ - **FIX** - myCred Cubepoints importer was not importing date correctly.
370
+ - **FIX** - If badges AND ranks were not active email notifications were not sending emails.
371
+ - **FIX** - The user was unable to export the log from the frontend.
372
+ - **FIX** - In the mycred_sales_history shortcode expires time was incorrect.
373
+ - **FIX** - A broken image shows when the badge image does not set.
374
+
375
+ = 2.1.0.3 =
376
+ - **FIX** - Email notification issues.
377
+ - **FIX** - Broken image if badge default image wasn't set.
378
+ - **FIX** - mycred_my_badges width and height attributes wasn't working.
379
+
380
+ = 2.1.0.2 =
381
+ Improvement - Code optimization
382
+
383
+ = 2.1.0.1 =
384
+ - **FIX** - Remove warnings
385
+
386
+ = 2.1 =
387
+ - **NEW** - Open badge functionality in myCred Badge addon.
388
+ - **NEW** - Introduce Achievement Types.
389
+ - **NEW** - Introduce a new shortcode mycred_badges_list.
390
+ - **NEW** - Single badge page.
391
+ - **NEW** - Added support into Badges for Anniversary hook.
392
+ - **NEW** - Added support into Badges for wooCommerce purchase reward.
393
+ - **NEW** - Added %rank_title% template tag support in Email Notifications.
394
+ - **NEW** - Added attributes in mycred_transfer shortcode.
395
+ - **FIX** - mycred_history shortcode pagination not working properly when cache enabled.
396
+ - **FIX** - Ranks weren't working properly on the current balance.
397
+ - **FIX** - mycred_sell_this shortcode not working in the bbPress topic
398
+ - **FIX** - The central deposit missing log entry in some cases.
399
+ - **TWEAK** - Removed deprecated functions.
400
+ - **TWEAK** - Code Improvement.
401
+ - **TWEAK** - Improve styling of mycred_transfer shortcode.
402
+
403
+ = 2.0.2 =
404
+ - **NEW** - Added compatibility for multiple currencies in CashCred Paypal addon
405
+ - **FIX** - Php erros in myCred woocommerce gateway
406
+ - **FIX** - Points on daily visit hooks not working in some conditions
407
+ - **FIX** - myCred CashCred multisite issues
408
+ - **TWEAK** - license system
409
+
410
+ = 2.0.1 =
411
+ - **FIX** - myCred membership license not activating for members
412
+
413
+ = 2.0 =
414
+ - **NEW** - myCred CashCred
415
+ - **NEW** - Added filter 'mycred_link_click_amount'
416
+ - **NEW** - Added exclude attribute in myCred leaderboard
417
+ - **NEW** - Added 'NOT LIKE' and '!=' operator for expiration addon
418
+ - **FIX** - Php notices in rank addon
419
+ - **FIX** - Rewards points option not visible for other product type in woocommerce
420
+ - **FIX** - Erros in mycred_total_balance shortcode
421
+ - **FIX** - myCred logs export issue
422
+ - **FIX** - Fixed mycred admin dashboard overview widget showing incorrect or same amount of points
423
+ - **FIX** - buyCred gift_to attribute not working
424
+ - **TWEAK** - myCred Central Deposit
425
+
426
+ = Previous Versions =
427
  https://mycred.me/support/changelog/