myCRED - Version 1.8.8

Version Description

Bug fixes release.

=

Download this release

Release Info

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

Code changes from version 1.8.7 to 1.8.8

addons/badges/assets/js/edit-badge.js CHANGED
@@ -48,8 +48,27 @@ jQuery(function($){
48
  else
49
  required_reference = required_reference.text();
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  // Amount
52
- var required_amount = $(this).find( 'input.form-control' ).val();
53
 
54
  // Requirement type
55
  var required_type = $(this).find( 'select.req-type option:selected' );
@@ -72,6 +91,7 @@ jQuery(function($){
72
  level : badgelevel,
73
  reqlevel : required_row_id,
74
  selectedtype : required_point_type,
 
75
  selectedref : required_reference,
76
  reqamount : required_amount,
77
  selectedby : required_type,
@@ -91,6 +111,18 @@ jQuery(function($){
91
 
92
  console.log( 'Total levels detected: ' + TotalBadgeLevels );
93
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  // Change Requirement Compare Action
95
  RequirementCompare.click(function(e){
96
 
@@ -288,13 +320,71 @@ jQuery(function($){
288
  var badgelevel = $(this).data( 'level' );
289
  if ( badgelevel == 0 ) { return true; }
290
 
291
- var subrequirementrow = $(this).find( '#level' + badgelevel + 'requirement' + requirementrow + ' .level-ref p' );
292
  if ( subrequirementrow !== undefined ) {
293
 
294
  subrequirementrow.fadeOut(function(){
295
  subrequirementrow.empty().text( selectedref.text() ).fadeIn();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  });
 
 
 
 
 
 
 
 
 
297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  }
299
 
300
  });
@@ -451,6 +541,29 @@ jQuery(function($){
451
 
452
  });
453
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
  });
455
 
456
  });
48
  else
49
  required_reference = required_reference.text();
50
 
51
+ //Specific
52
+ var required_reference_specific = $(this).find( '.specific' );
53
+ if( required_reference_specific[0] != undefined ) {
54
+ console.log(required_reference_specific[0].tagName);
55
+ if( required_reference_specific[0].tagName === 'INPUT' ) {
56
+ required_reference_specific = required_reference_specific.val();
57
+ }
58
+ else if( required_reference_specific[0].tagName === 'SELECT' ) {
59
+ var required_reference_specific = $(this).find( 'select.specific option:selected' );
60
+ if ( required_reference === undefined || required_reference == '' )
61
+ required_reference_specific = '-';
62
+ else
63
+ required_reference_specific = required_reference_specific.text();
64
+ }
65
+ }
66
+ else{
67
+ required_reference_specific = '';
68
+ }
69
+
70
  // Amount
71
+ var required_amount = $(this).find( '.form-inline input.form-control' ).val();
72
 
73
  // Requirement type
74
  var required_type = $(this).find( 'select.req-type option:selected' );
91
  level : badgelevel,
92
  reqlevel : required_row_id,
93
  selectedtype : required_point_type,
94
+ refspecific : required_reference_specific,
95
  selectedref : required_reference,
96
  reqamount : required_amount,
97
  selectedby : required_type,
111
 
112
  console.log( 'Total levels detected: ' + TotalBadgeLevels );
113
 
114
+ if ( TotalBadgeLevels > 1 ) {
115
+
116
+ $( '#mycred-badge-setup #badge-levels .badge-level' ).each(function(index){
117
+
118
+ var subrequirementrow = $(this).find( '.level-ref p:last' );
119
+ if ( subrequirementrow !== undefined ) {
120
+ subrequirementrow.empty().text( $( '#mycred-badge-setup input.specific' ).val() );
121
+ }
122
+
123
+ });
124
+ }
125
+
126
  // Change Requirement Compare Action
127
  RequirementCompare.click(function(e){
128
 
320
  var badgelevel = $(this).data( 'level' );
321
  if ( badgelevel == 0 ) { return true; }
322
 
323
+ var subrequirementrow = $(this).find( '#level' + badgelevel + 'requirement' + requirementrow + ' .level-ref p:first' );
324
  if ( subrequirementrow !== undefined ) {
325
 
326
  subrequirementrow.fadeOut(function(){
327
  subrequirementrow.empty().text( selectedref.text() ).fadeIn();
328
+ subrequirementrow.next().empty().fadeIn();
329
+ });
330
+
331
+ }
332
+
333
+ });
334
+
335
+ });
336
+
337
+ $( '#mycred-badge-setup' ).on( 'blur', 'input.specific', function(e){
338
+
339
+ var refselectelement = $(this);
340
+
341
+ // Make sure there is more then one level
342
+ var numberoflevels = $( '#mycred-badge-setup #badge-levels .badge-level' ).length;
343
+ if ( numberoflevels == 1 ) return;
344
+
345
+ var requirementrow = refselectelement.data( 'row' );
346
+
347
+ // Loop through each level
348
+ $( '#mycred-badge-setup #badge-levels .badge-level' ).each(function(index){
349
+
350
+ var badgelevel = $(this).data( 'level' );
351
+ if ( badgelevel == 0 ) { return true; }
352
+
353
+ var subrequirementrow = $(this).find( '#level' + badgelevel + 'requirement' + requirementrow + ' .level-ref p:last' );
354
+ if ( subrequirementrow !== undefined ) {
355
+ subrequirementrow.fadeOut(function(){
356
+ subrequirementrow.empty().text( refselectelement.val() ).fadeIn();
357
  });
358
+ }
359
+
360
+ });
361
+
362
+ });
363
+
364
+
365
+
366
+ $( '#mycred-badge-setup' ).on( 'change', 'select.specific', function(e){
367
 
368
+ var refselectelement = $(this);
369
+ var selectedreftype = refselectelement.find( ':selected' );
370
+
371
+ // Make sure there is more then one level
372
+ var numberoflevels = $( '#mycred-badge-setup #badge-levels .badge-level' ).length;
373
+ if ( numberoflevels == 1 ) return;
374
+
375
+ var requirementrow = refselectelement.data( 'row' );
376
+
377
+ // Loop through each level
378
+ $( '#mycred-badge-setup #badge-levels .badge-level' ).each(function(index){
379
+
380
+ var badgelevel = $(this).data( 'level' );
381
+ if ( badgelevel == 0 ) { return true; }
382
+
383
+ var subrequirementrow = $(this).find( '#level' + badgelevel + 'requirement' + requirementrow + ' .level-ref p:last' );
384
+ if ( subrequirementrow !== undefined ) {
385
+ subrequirementrow.fadeOut(function(){
386
+ subrequirementrow.empty().text( selectedreftype.text() ).fadeIn();
387
+ });
388
  }
389
 
390
  });
541
 
542
  });
543
 
544
+ $(document).on('change', '.reference', function(){
545
+
546
+ var refrence_id = 'mycred_badge_'+$(this).val();
547
+ var ele_name = $(this).attr('name');
548
+ var row = $(this).data('row');
549
+
550
+ if( window[refrence_id] !== undefined ) {
551
+
552
+ totalBadgeLevels = $( '#mycred-badge-setup #badge-levels .badge-level' ).length;
553
+ totalRequirements = $( '#mycred-badge-setup .level-requirements .row-narrow' ).length;
554
+
555
+ var template = Mustache.render( window[refrence_id], {
556
+ element_name : ele_name.replace('reference', 'specific'),
557
+ reqlevel : row
558
+ });
559
+ $(this).parent().next().remove();
560
+ $( this ).closest('.form').append( template );
561
+ }
562
+ else {
563
+ $(this).parent().next().remove();
564
+ }
565
+ });
566
+
567
  });
568
 
569
  });
addons/badges/includes/mycred-badge-object.php CHANGED
@@ -256,6 +256,9 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
256
  $having = 'SUM(creds)';
257
 
258
  $query = $wpdb->get_var( $wpdb->prepare( "SELECT {$having} FROM {$mycred_log_table} WHERE ctype = %s AND ref = %s AND user_id = %d;", $requirement['type'], $requirement['reference'], $user_id ) );
 
 
 
259
  if ( $query === NULL ) $query = 0;
260
 
261
  $results[ $requirement['reference'] ] = $query;
256
  $having = 'SUM(creds)';
257
 
258
  $query = $wpdb->get_var( $wpdb->prepare( "SELECT {$having} FROM {$mycred_log_table} WHERE ctype = %s AND ref = %s AND user_id = %d;", $requirement['type'], $requirement['reference'], $user_id ) );
259
+
260
+ $query = apply_filters( 'mycred_badge_requirement', $query, $requirement_id, $requirement, $having, $user_id );
261
+
262
  if ( $query === NULL ) $query = 0;
263
 
264
  $results[ $requirement['reference'] ] = $query;
addons/badges/includes/mycred-badge-secondary.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
+
4
+ /**
5
+ * Hook for site visits
6
+ * @since 1.5
7
+ * @version 1.1
8
+ */
9
+ if ( ! class_exists( 'myCRED_Badge_Secondary' ) ) :
10
+ class myCRED_Badge_Secondary {
11
+
12
+ // Instnace
13
+ protected static $_instance = NULL;
14
+
15
+ /**
16
+ * Construct
17
+ */
18
+ function __construct() {
19
+ add_filter( 'mycred_badge_requirement', array( $this, 'mycred_badge_specific_requirement'), 10, 5 );
20
+ add_filter( 'mycred_badge_requirement_specific_template', array( $this, 'badge_specific_template'), 10, 5 );
21
+ add_action( 'admin_head', array( $this, 'admin_header' ) );
22
+ }
23
+
24
+ /**
25
+ * Setup Instance
26
+ * @since 1.7
27
+ * @version 1.0
28
+ */
29
+ public static function instance() {
30
+ if ( is_null( self::$_instance ) ) {
31
+ self::$_instance = new self();
32
+ }
33
+ return self::$_instance;
34
+ }
35
+
36
+ public function mycred_badge_specific_requirement( $query, $requirement_id, $requirement, $having, $user_id ) {
37
+
38
+ global $wpdb, $mycred_log_table;
39
+
40
+ if( $requirement['reference'] == 'link_click' && ! empty( $requirement['specific'] ) && $requirement['specific'] != 'Any' ) {
41
+
42
+ $query = $wpdb->get_var( $wpdb->prepare( "SELECT {$having} FROM {$mycred_log_table} WHERE ctype = %s AND ref = %s AND data LIKE %s AND user_id = %d;", $requirement['type'], $requirement['reference'], '%'.$requirement['specific'].'%', $user_id ) );
43
+
44
+ }
45
+ else if( $requirement['reference'] == 'gravity_form_submission' && ! empty( $requirement['specific'] ) && $requirement['specific'] != 'Any' ) {
46
+ $query = $wpdb->get_var( $wpdb->prepare( "SELECT {$having} FROM {$mycred_log_table} WHERE ctype = %s AND ref = %s AND ref_id = %d AND user_id = %d;", $requirement['type'], $requirement['reference'], $requirement['specific'], $user_id ) );
47
+ }
48
+ return $query;
49
+ }
50
+
51
+ public function badge_specific_template( $data, $requirement_id, $requirement, $badge, $level ) {
52
+
53
+ if( $requirement['reference'] == 'link_click' && ! empty( $requirement['specific'] ) && $requirement['specific'] != 'Any' ) {
54
+
55
+ $data = '<div class="form-group"><input type="text" name="mycred_badge[levels]['.$level.'][requires]['.$requirement_id.'][specific]" class="form-control specific" value="'.$requirement['specific'].'" data-row="'.$requirement_id.'" /></div>';
56
+
57
+ }
58
+ else if( $requirement['reference'] == 'gravity_form_submission' && ! empty( $requirement['specific'] ) && $requirement['specific'] != 'Any' ) {
59
+ if( class_exists('RGFormsModel') ) {
60
+ $gravityforms = RGFormsModel::get_forms();
61
+ $form_list = '<option>Any</option>';
62
+ foreach ($gravityforms as $form) {
63
+ $form_list .= '<option value="'.$form->id.'" '.( $requirement['specific'] == $form->id ? ' selected="selected"' : '').' >'.$form->title.'</option>';
64
+ }
65
+ $data = '<div class="form-group"><select name="mycred_badge[levels]['.$level.'][requires]['.$requirement_id.'][specific]" class="form-control specific" data-row="'.$requirement_id.'" >'.$form_list.'</select></div>';
66
+ }
67
+ }
68
+ return $data;
69
+
70
+ }
71
+
72
+ public function admin_header() {
73
+ $screen = get_current_screen();
74
+
75
+ if ( $screen->id == MYCRED_BADGE_KEY ):?>
76
+ <script type="text/javascript">
77
+ var mycred_badge_link_click = '<div class="form-group"><input type="text" name="{{element_name}}" data-row="{{reqlevel}}" class="form-control specific" /></div>';
78
+
79
+ <?php
80
+ if( class_exists('RGFormsModel') ) {
81
+ $gravityforms = RGFormsModel::get_forms();
82
+ $form_list = '<option>Any</option>';
83
+ foreach ( $gravityforms as $form ) {
84
+ $form_list .= '<option value="'.$form->id.'">'.$form->title.'</option>';
85
+ }
86
+ $data = '<div class="form-group"><select name="{{element_name}}" class="form-control specific" data-row="{{reqlevel}}" >'.$form_list.'</select></div>';
87
+ echo "var mycred_badge_gravity_form_submission = '".$data."';";
88
+ }
89
+ ?>
90
+ </script>
91
+ <?php endif;
92
+ }
93
+
94
+ }
95
+ endif;
96
+
97
+ function myCRED_Badge_Secondary_init() {
98
+ return myCRED_Badge_Secondary::instance();
99
+ }
100
+ myCRED_Badge_Secondary_init();
101
+
addons/badges/myCRED-addon-badges.php CHANGED
@@ -26,6 +26,7 @@ if ( ! defined( 'MYCRED_BADGE_HEIGHT' ) )
26
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-functions.php';
27
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-shortcodes.php';
28
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-object.php';
 
29
 
30
  /**
31
  * myCRED_buyCRED_Module class
@@ -694,10 +695,10 @@ th#badge-users { width: 10%; }
694
 
695
  // only first level dictates requirements
696
  if ( $level == 0 )
697
- return '<div class="row row-narrow" id="level{{level}}requirement{{reqlevel}}" data-row="{{reqlevel}}"><div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 form"><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][type]" data-row="{{reqlevel}}" class="form-control point-type">{{pointtypes}}</select></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-xs-12 form"><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][reference]" data-row="{{reqlevel}}" class="form-control reference">{{references}}</select></div></div><div class="col-lg-3 col-md-3 col-sm-6 col-xs-10 form-inline"><div class="form-group"><input type="text" size="5" name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][amount]" class="form-control" value="{{reqamount}}" /></div><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][by]" data-row="{{reqlevel}}" class="form-control req-type">{{requirementtype}}</select></div></div><div class="col-lg-1 col-md-1 col-sm-6 col-xs-2 form">{{reqbutton}}</div></div>';
698
 
699
  // All other requirements reflect the level 0's setup
700
- return '<div class="row row-narrow" id="level{{level}}requirement{{reqlevel}}"><div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 form"><div class="form-group level-type"><p class="form-control-static level-requirement{{reqlevel}}-type">{{selectedtype}}</p></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-xs-12 form"><div class="form-group level-ref"><p class="form-control-static level-requirement{{reqlevel}}-ref">{{selectedref}}</p></div></div><div class="col-lg-3 col-md-3 col-sm-6 col-xs-10 form-inline"><div class="form-group level-val"><input type="text" size="5" name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][amount]" class="form-control" value="{{reqamount}}" /></div><div class="form-group level-type-by"><p class="form-control-static level-requirement{{reqlevel}}-by">{{selectedby}}</p></div></div><div class="col-lg-1 col-md-1 col-sm-6 col-xs-2 level-compare form"><p class="form-control-static" data-row="{{reqlevel}}">{{comparelabel}}</p></div></div>';
701
 
702
  }
703
 
@@ -918,6 +919,10 @@ jQuery(function($) {
918
  }
919
 
920
  $requirement = str_replace( '{{references}}', $reference_options, $requirement );
 
 
 
 
921
  $requirement = str_replace( '{{reqamount}}', $reqsetup['amount'], $requirement );
922
 
923
  $reference_options = str_replace( 'selected="selected"', '', $reference_options );
@@ -945,6 +950,8 @@ jQuery(function($) {
945
 
946
  $requirement = str_replace( '{{selectedtype}}', $selectedtype, $requirement );
947
 
 
 
948
  $selectedreference = '-';
949
  if ( array_key_exists( $reqsetup['reference'], $references ) )
950
  $selectedreference = $references[ $reqsetup['reference'] ];
@@ -1077,6 +1084,7 @@ var BadgeRequirement = '<?php echo $js_requirement_clone; ?>';
1077
  $requirement['reference'] = ( ( array_key_exists( 'reference', $requirement_setup ) ) ? sanitize_key( $requirement_setup['reference'] ) : '' );
1078
  $requirement['amount'] = ( ( array_key_exists( 'amount', $requirement_setup ) ) ? sanitize_text_field( $requirement_setup['amount'] ) : '' );
1079
  $requirement['by'] = ( ( array_key_exists( 'by', $requirement_setup ) ) ? sanitize_key( $requirement_setup['by'] ) : '' );
 
1080
 
1081
  $level_requirements[ $row ] = $requirement;
1082
  $row ++;
26
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-functions.php';
27
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-shortcodes.php';
28
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-object.php';
29
+ require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-secondary.php';
30
 
31
  /**
32
  * myCRED_buyCRED_Module class
695
 
696
  // only first level dictates requirements
697
  if ( $level == 0 )
698
+ return '<div class="row row-narrow" id="level{{level}}requirement{{reqlevel}}" data-row="{{reqlevel}}"><div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 form"><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][type]" data-row="{{reqlevel}}" class="form-control point-type">{{pointtypes}}</select></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-xs-12 form"><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][reference]" data-row="{{reqlevel}}" class="form-control reference">{{references}}</select></div>{{{customrequirement}}}</div><div class="col-lg-3 col-md-3 col-sm-6 col-xs-10 form-inline"><div class="form-group"><input type="text" size="5" name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][amount]" class="form-control" value="{{reqamount}}" /></div><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][by]" data-row="{{reqlevel}}" class="form-control req-type">{{requirementtype}}</select></div></div><div class="col-lg-1 col-md-1 col-sm-6 col-xs-2 form">{{reqbutton}}</div></div>';
699
 
700
  // All other requirements reflect the level 0's setup
701
+ return '<div class="row row-narrow" id="level{{level}}requirement{{reqlevel}}"><div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 form"><div class="form-group level-type"><p class="form-control-static level-requirement{{reqlevel}}-type">{{selectedtype}}</p></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-xs-12 form"><div class="form-group level-ref"><p class="form-control-static level-requirement{{reqlevel}}-ref">{{selectedref}}</p><p>{{refspecific}}</p></div></div><div class="col-lg-3 col-md-3 col-sm-6 col-xs-10 form-inline"><div class="form-group level-val"><input type="text" size="5" name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][amount]" class="form-control" value="{{reqamount}}" /></div><div class="form-group level-type-by"><p class="form-control-static level-requirement{{reqlevel}}-by">{{selectedby}}</p></div></div><div class="col-lg-1 col-md-1 col-sm-6 col-xs-2 level-compare form"><p class="form-control-static" data-row="{{reqlevel}}">{{comparelabel}}</p></div></div>';
702
 
703
  }
704
 
919
  }
920
 
921
  $requirement = str_replace( '{{references}}', $reference_options, $requirement );
922
+
923
+ $requirement_specific = apply_filters( 'mycred_badge_requirement_specific_template', '', $req_level, $reqsetup, $badge, $level );
924
+ $requirement = str_replace( '{{{customrequirement}}}', $requirement_specific, $requirement );
925
+
926
  $requirement = str_replace( '{{reqamount}}', $reqsetup['amount'], $requirement );
927
 
928
  $reference_options = str_replace( 'selected="selected"', '', $reference_options );
950
 
951
  $requirement = str_replace( '{{selectedtype}}', $selectedtype, $requirement );
952
 
953
+ $requirement = str_replace( '{{refspecific}}', '', $requirement );
954
+
955
  $selectedreference = '-';
956
  if ( array_key_exists( $reqsetup['reference'], $references ) )
957
  $selectedreference = $references[ $reqsetup['reference'] ];
1084
  $requirement['reference'] = ( ( array_key_exists( 'reference', $requirement_setup ) ) ? sanitize_key( $requirement_setup['reference'] ) : '' );
1085
  $requirement['amount'] = ( ( array_key_exists( 'amount', $requirement_setup ) ) ? sanitize_text_field( $requirement_setup['amount'] ) : '' );
1086
  $requirement['by'] = ( ( array_key_exists( 'by', $requirement_setup ) ) ? sanitize_key( $requirement_setup['by'] ) : '' );
1087
+ $requirement['specific'] = ( ( array_key_exists( 'specific', $requirement_setup ) ) ? sanitize_text_field( $requirement_setup['specific'] ) : '' );
1088
 
1089
  $level_requirements[ $row ] = $requirement;
1090
  $row ++;
addons/ranks/includes/mycred-rank-functions.php CHANGED
@@ -528,6 +528,7 @@ if ( ! function_exists( 'mycred_get_ranks' ) ) :
528
 
529
  $cache_key = 'ranks-published-' . $point_type;
530
  $ranks = wp_cache_get( $cache_key, MYCRED_SLUG );
 
531
 
532
  if ( $ranks === false ) {
533
 
@@ -539,7 +540,6 @@ if ( ! function_exists( 'mycred_get_ranks' ) ) :
539
  $posts = mycred_get_db_column( 'posts' );
540
  $postmeta = mycred_get_db_column( 'postmeta' );
541
 
542
- $results = array();
543
  $rank_ids = $wpdb->get_col( $wpdb->prepare( "
544
  SELECT ranks.ID
545
  FROM {$posts} ranks
@@ -559,6 +559,8 @@ if ( ! function_exists( 'mycred_get_ranks' ) ) :
559
 
560
  wp_cache_set( $cache_key, $results, MYCRED_SLUG );
561
 
 
 
562
  }
563
 
564
  return apply_filters( 'mycred_get_ranks', $results, $status, $number, $order );
528
 
529
  $cache_key = 'ranks-published-' . $point_type;
530
  $ranks = wp_cache_get( $cache_key, MYCRED_SLUG );
531
+ $results = array();
532
 
533
  if ( $ranks === false ) {
534
 
540
  $posts = mycred_get_db_column( 'posts' );
541
  $postmeta = mycred_get_db_column( 'postmeta' );
542
 
 
543
  $rank_ids = $wpdb->get_col( $wpdb->prepare( "
544
  SELECT ranks.ID
545
  FROM {$posts} ranks
559
 
560
  wp_cache_set( $cache_key, $results, MYCRED_SLUG );
561
 
562
+ } else {
563
+ $results = $ranks;
564
  }
565
 
566
  return apply_filters( 'mycred_get_ranks', $results, $status, $number, $order );
addons/ranks/myCRED-addon-ranks.php CHANGED
@@ -739,6 +739,9 @@ if ( ! class_exists( 'myCRED_Ranks_Module' ) ) :
739
  // Load type
740
  $mycred = mycred( $type_id );
741
 
 
 
 
742
  // No settings
743
  if ( ! isset( $mycred->rank['bb_location'] ) ) continue;
744
 
@@ -785,6 +788,9 @@ if ( ! class_exists( 'myCRED_Ranks_Module' ) ) :
785
  // Load type
786
  $mycred = mycred( $type_id );
787
 
 
 
 
788
  // No settings
789
  if ( ! isset( $mycred->rank['bb_location'] ) ) continue;
790
 
739
  // Load type
740
  $mycred = mycred( $type_id );
741
 
742
+ //Nothing to do if we are excluded
743
+ if ( $mycred->exclude_user( $user_id ) ) continue;
744
+
745
  // No settings
746
  if ( ! isset( $mycred->rank['bb_location'] ) ) continue;
747
 
788
  // Load type
789
  $mycred = mycred( $type_id );
790
 
791
+ //Nothing to do if we are excluded
792
+ if ( $mycred->exclude_user( $user_id ) ) continue;
793
+
794
  // No settings
795
  if ( ! isset( $mycred->rank['bb_location'] ) ) continue;
796
 
addons/stats/includes/mycred-stats-shortcodes.php CHANGED
@@ -112,7 +112,7 @@ if ( ! function_exists( 'mycred_render_chart_history' ) ) :
112
  'type' => 'line',
113
  'ctype' => MYCRED_DEFAULT_TYPE_KEY,
114
  'period' => 'days',
115
- 'length' => 10,
116
  'order' => 'DESC',
117
  'title' => '',
118
  'animate' => 1,
@@ -127,7 +127,7 @@ if ( ! function_exists( 'mycred_render_chart_history' ) ) :
127
  $type = ( ! in_array( $type, array( 'line', 'bar' ) ) ) ? 'line' : $type;
128
 
129
  // Get data
130
- $data = mycred_get_history_data( $ctype, $period, $length, $order );
131
  if ( empty( $data ) ) return $no_data;
132
 
133
  // New Chart Object
@@ -255,7 +255,7 @@ if ( ! function_exists( 'mycred_render_chart_balance_history' ) ) :
255
  'ctype' => MYCRED_DEFAULT_TYPE_KEY,
256
  'user' => 'current',
257
  'period' => 'days',
258
- 'length' => 10,
259
  'order' => 'DESC',
260
  'title' => '',
261
  'animate' => 1,
@@ -274,7 +274,7 @@ if ( ! function_exists( 'mycred_render_chart_balance_history' ) ) :
274
  $type = ( ! in_array( $type, array( 'line', 'bar' ) ) ) ? 'line' : $type;
275
 
276
  // Get data
277
- $data = mycred_get_users_history_data( $user_id, $ctype, $period, $length, $order );
278
  if ( empty( $data ) ) return $no_data;
279
 
280
  // New Chart Object
@@ -308,7 +308,7 @@ if ( ! function_exists( 'mycred_render_chart_instance_history' ) ) :
308
  'ctype' => MYCRED_DEFAULT_TYPE_KEY,
309
  'ref' => '',
310
  'period' => 'days',
311
- 'length' => 10,
312
  'order' => 'DESC',
313
  'title' => '',
314
  'animate' => 1,
@@ -325,7 +325,7 @@ if ( ! function_exists( 'mycred_render_chart_instance_history' ) ) :
325
  $type = ( ! in_array( $type, array( 'line', 'bar', 'radar' ) ) ) ? 'line' : $type;
326
 
327
  // Get data
328
- $data = mycred_get_ref_history_data( $ref, $ctype, $period, $length, $order );
329
  if ( empty( $data ) ) return $no_data;
330
 
331
  // New Chart Object
112
  'type' => 'line',
113
  'ctype' => MYCRED_DEFAULT_TYPE_KEY,
114
  'period' => 'days',
115
+ 'number' => 10,
116
  'order' => 'DESC',
117
  'title' => '',
118
  'animate' => 1,
127
  $type = ( ! in_array( $type, array( 'line', 'bar' ) ) ) ? 'line' : $type;
128
 
129
  // Get data
130
+ $data = mycred_get_history_data( $ctype, $period, $number, $order );
131
  if ( empty( $data ) ) return $no_data;
132
 
133
  // New Chart Object
255
  'ctype' => MYCRED_DEFAULT_TYPE_KEY,
256
  'user' => 'current',
257
  'period' => 'days',
258
+ 'number' => 10,
259
  'order' => 'DESC',
260
  'title' => '',
261
  'animate' => 1,
274
  $type = ( ! in_array( $type, array( 'line', 'bar' ) ) ) ? 'line' : $type;
275
 
276
  // Get data
277
+ $data = mycred_get_users_history_data( $user_id, $ctype, $period, $number, $order );
278
  if ( empty( $data ) ) return $no_data;
279
 
280
  // New Chart Object
308
  'ctype' => MYCRED_DEFAULT_TYPE_KEY,
309
  'ref' => '',
310
  'period' => 'days',
311
+ 'number' => 10,
312
  'order' => 'DESC',
313
  'title' => '',
314
  'animate' => 1,
325
  $type = ( ! in_array( $type, array( 'line', 'bar', 'radar' ) ) ) ? 'line' : $type;
326
 
327
  // Get data
328
+ $data = mycred_get_ref_history_data( $ref, $ctype, $period, $number, $order );
329
  if ( empty( $data ) ) return $no_data;
330
 
331
  // New Chart Object
assets/css/admin-subscription.css ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /** myCRED Membership **/
2
+ .mmc_welcome{ margin: 12px;padding: 50px 10px;border-radius: 10px;text-align: center;width: 500p }
3
+ .mmc_title{ text-align: center;font-size: 30px;font-weight: 100 }
4
+ .mmc_welcome .mmc_lincense_key{ width: 404px;border-radius: 6px;font-size: 17px;padding: 9px 14px;margin-top: 30px }
5
+ .mmc_welcome .mmc_save_license{ font-size: 12px;height: 40px;width: 90px;font-size: 17px }
6
+ .mmc_welcome_content{ width: 500px;margin: 0 auto }
7
+ .mmc_welcome_content a{ text-align: left }
8
+ .mmc_license_link a{ text-decoration: none }
9
+ .mmc_license_link{ text-align: left;margin: 5px 0px}
10
+ .mycred-membership-menu-label { color: #ffffff; margin: 5px; background: #892bff; padding: 1px 5px 3px 5px; border-radius: 4px; font-size: 10px; }
includes/classes/class.query-leaderboard.php CHANGED
@@ -546,10 +546,10 @@ if ( ! class_exists( 'myCRED_Query_Leaderboard' ) ) :
546
  */
547
  elseif ( MYCRED_ENABLE_LOGGING ) {
548
 
549
- $reference_is = 'l.ref = %s';
550
  $reference_values = $this->references[0];
551
  if ( count( $this->references ) > 1 ) {
552
- $reference_is = 'l.ref IN ( %s' . str_repeat( ', %s', ( count( $this->references ) - 1 ) ) . ' )';
553
  $reference_values = $this->references;
554
  }
555
 
@@ -675,10 +675,10 @@ if ( ! class_exists( 'myCRED_Query_Leaderboard' ) ) :
675
  */
676
  elseif ( MYCRED_ENABLE_LOGGING ) {
677
 
678
- $reference_is = 'l.ref = %s';
679
  $reference_values = $this->references[0];
680
  if ( count( $this->references ) > 1 ) {
681
- $reference_is = 'l.ref IN ( %s' . str_repeat( ', %s', ( count( $this->references ) - 1 ) ) . ' )';
682
  $reference_values = $this->references;
683
  }
684
 
@@ -944,7 +944,7 @@ if ( ! class_exists( 'myCRED_Query_Leaderboard' ) ) :
944
  if ( $this->user_id > 0 && $user['ID'] == $this->user_id )
945
  $class[] = 'current-user';
946
 
947
- if ( $position % 2 != 0 )
948
  $class[] = 'alt';
949
 
950
  $row_template = $template;
546
  */
547
  elseif ( MYCRED_ENABLE_LOGGING ) {
548
 
549
+ $reference_is = 'AND l.ref = %s';
550
  $reference_values = $this->references[0];
551
  if ( count( $this->references ) > 1 ) {
552
+ $reference_is = 'AND l.ref IN ( %s' . str_repeat( ', %s', ( count( $this->references ) - 1 ) ) . ' )';
553
  $reference_values = $this->references;
554
  }
555
 
675
  */
676
  elseif ( MYCRED_ENABLE_LOGGING ) {
677
 
678
+ $reference_is = 'AND l.ref = %s';
679
  $reference_values = $this->references[0];
680
  if ( count( $this->references ) > 1 ) {
681
+ $reference_is = 'AND l.ref IN ( %s' . str_repeat( ', %s', ( count( $this->references ) - 1 ) ) . ' )';
682
  $reference_values = $this->references;
683
  }
684
 
944
  if ( $this->user_id > 0 && $user['ID'] == $this->user_id )
945
  $class[] = 'current-user';
946
 
947
+ if ( is_numeric( $position ) && $position % 2 != 0 )
948
  $class[] = 'alt';
949
 
950
  $row_template = $template;
includes/classes/class.query-log.php CHANGED
@@ -2831,7 +2831,7 @@ if ( ! function_exists( 'mycred_get_users_history' ) ) :
2831
  if ( ! in_array( $orderby, array( 'rows', 'reference', 'total', 'ref_id' ) ) ) $orderby = 'rows';
2832
  if ( ! in_array( $order, array( 'ASC', 'DESC' ) ) ) $order = 'DESC';
2833
 
2834
- $query = $wpdb->get_results( $wpdb->prepare( "SELECT COUNT(*) AS rows, ref AS reference, SUM(creds) AS total, MAX(time) AS last_entry FROM {$mycred_log_table} WHERE user_id = %d AND ctype = %s GROUP BY ref ORDER BY {$orderby} {$order};", $user_id, $point_type ) );
2835
 
2836
  if ( ! empty( $query ) ) {
2837
  foreach ( $query as $result ) {
2831
  if ( ! in_array( $orderby, array( 'rows', 'reference', 'total', 'ref_id' ) ) ) $orderby = 'rows';
2832
  if ( ! in_array( $order, array( 'ASC', 'DESC' ) ) ) $order = 'DESC';
2833
 
2834
+ $query = $wpdb->get_results( $wpdb->prepare( "SELECT COUNT(*) AS `rows`, ref AS reference, SUM(creds) AS total, MAX(time) AS last_entry FROM {$mycred_log_table} WHERE user_id = %d AND ctype = %s GROUP BY ref ORDER BY `{$orderby}` {$order};", $user_id, $point_type ) );
2835
 
2836
  if ( ! empty( $query ) ) {
2837
  foreach ( $query as $result ) {
includes/mycred-remote.php CHANGED
@@ -367,7 +367,7 @@ if ( ! class_exists( 'myCRED_Remote' ) ) :
367
  $type = $this->core->get_cred_id();
368
 
369
  // Prep Amount
370
- $amount = $this->core->format_number( $this->request['amount'] );
371
  if ( $this->request['action'] == 'DEBIT' )
372
  $amount = 0-$amount;
373
  else
367
  $type = $this->core->get_cred_id();
368
 
369
  // Prep Amount
370
+ $amount = floatval( $this->request['amount'] );
371
  if ( $this->request['action'] == 'DEBIT' )
372
  $amount = 0-$amount;
373
  else
includes/widgets/mycred-widget-wallet.php CHANGED
@@ -59,7 +59,7 @@ if ( ! class_exists( 'myCRED_Widget_Wallet' ) ) :
59
  // Loop through balances
60
  foreach ( $account->balance as $point_type_id => $balance ) {
61
 
62
- if ( $balance === false ) continue;
63
 
64
  $point_type = mycred( $point_type_id );
65
 
59
  // Loop through balances
60
  foreach ( $account->balance as $point_type_id => $balance ) {
61
 
62
+ if ( ! in_array( $point_type_id, $instance['types'] ) || $balance === false ) continue;
63
 
64
  $point_type = mycred( $point_type_id );
65
 
lang/mycred-en_US.po CHANGED
@@ -6738,5 +6738,5 @@ msgid "Gabriel S Merovingi"
6738
  msgstr ""
6739
 
6740
  #. Author URI of the plugin
6741
- msgid "https://www.merovingi.com"
6742
  msgstr ""
6738
  msgstr ""
6739
 
6740
  #. Author URI of the plugin
6741
+ msgid "https://www.mycred.me"
6742
  msgstr ""
lang/mycred-es_ES.po CHANGED
@@ -653,7 +653,7 @@ msgid "Gabriel S Merovingi"
653
  msgstr ""
654
 
655
  #. Author URI of the plugin
656
- msgid "https://www.merovingi.com"
657
  msgstr ""
658
 
659
  #: mycred.php:621
653
  msgstr ""
654
 
655
  #. Author URI of the plugin
656
+ msgid "https://www.mycred.me"
657
  msgstr ""
658
 
659
  #: mycred.php:621
lang/mycred-es_VE.po CHANGED
@@ -3871,7 +3871,7 @@ msgid "Gabriel S Merovingi"
3871
  msgstr ""
3872
 
3873
  #. Author URI of the plugin
3874
- msgid "https://www.merovingi.com"
3875
  msgstr ""
3876
 
3877
  #: mycred.php:621
3871
  msgstr ""
3872
 
3873
  #. Author URI of the plugin
3874
+ msgid "https://www.mycred.me"
3875
  msgstr ""
3876
 
3877
  #: mycred.php:621
lang/mycred-fa_IR.po CHANGED
@@ -4166,7 +4166,7 @@ msgid "Gabriel S Merovingi"
4166
  msgstr ""
4167
 
4168
  #. Author URI of the plugin
4169
- msgid "https://www.merovingi.com"
4170
  msgstr ""
4171
 
4172
  #: mycred.php:688 modules/mycred-module-settings.php:430
4166
  msgstr ""
4167
 
4168
  #. Author URI of the plugin
4169
+ msgid "https://www.mycred.me"
4170
  msgstr ""
4171
 
4172
  #: mycred.php:688 modules/mycred-module-settings.php:430
lang/mycred-fr_FR.po CHANGED
@@ -2980,7 +2980,7 @@ msgid "Gabriel S Merovingi"
2980
  msgstr ""
2981
 
2982
  #. Author URI of the plugin
2983
- msgid "https://www.merovingi.com"
2984
  msgstr ""
2985
 
2986
  #: mycred.php:621
2980
  msgstr ""
2981
 
2982
  #. Author URI of the plugin
2983
+ msgid "https://www.mycred.me"
2984
  msgstr ""
2985
 
2986
  #: mycred.php:621
lang/mycred-ja_JP.po CHANGED
@@ -2196,7 +2196,7 @@ msgid "Gabriel S Merovingi"
2196
  msgstr ""
2197
 
2198
  #. Author URI of the plugin
2199
- msgid "https://www.merovingi.com"
2200
  msgstr ""
2201
 
2202
  #: mycred.php:621
2196
  msgstr ""
2197
 
2198
  #. Author URI of the plugin
2199
+ msgid "https://www.mycred.me"
2200
  msgstr ""
2201
 
2202
  #: mycred.php:621
lang/mycred-lt_LT.po CHANGED
@@ -3351,7 +3351,7 @@ msgid "Gabriel S Merovingi"
3351
  msgstr ""
3352
 
3353
  #. Author URI of the plugin
3354
- msgid "https://www.merovingi.com"
3355
  msgstr ""
3356
 
3357
  #: mycred.php:622
3351
  msgstr ""
3352
 
3353
  #. Author URI of the plugin
3354
+ msgid "https://www.mycred.me"
3355
  msgstr ""
3356
 
3357
  #: mycred.php:622
lang/mycred-pt_BR.po CHANGED
@@ -3555,7 +3555,7 @@ msgid "Gabriel S Merovingi"
3555
  msgstr ""
3556
 
3557
  #. Author URI of the plugin
3558
- msgid "https://www.merovingi.com"
3559
  msgstr ""
3560
 
3561
  #: mycred.php:621
3555
  msgstr ""
3556
 
3557
  #. Author URI of the plugin
3558
+ msgid "https://www.mycred.me"
3559
  msgstr ""
3560
 
3561
  #: mycred.php:621
lang/mycred-ru_RU.po CHANGED
@@ -3615,7 +3615,7 @@ msgid "Gabriel S Merovingi"
3615
  msgstr ""
3616
 
3617
  #. Author URI of the plugin
3618
- msgid "https://www.merovingi.com"
3619
  msgstr ""
3620
 
3621
  #: mycred.php:621
3615
  msgstr ""
3616
 
3617
  #. Author URI of the plugin
3618
+ msgid "https://www.mycred.me"
3619
  msgstr ""
3620
 
3621
  #: mycred.php:621
lang/mycred-sv_SE.po CHANGED
@@ -4200,7 +4200,7 @@ msgid "Gabriel S Merovingi"
4200
  msgstr ""
4201
 
4202
  #. Author URI of the plugin
4203
- msgid "https://www.merovingi.com"
4204
  msgstr ""
4205
 
4206
  #: mycred.php:688 modules/mycred-module-settings.php:430
4200
  msgstr ""
4201
 
4202
  #. Author URI of the plugin
4203
+ msgid "https://www.mycred.me"
4204
  msgstr ""
4205
 
4206
  #: mycred.php:688 modules/mycred-module-settings.php:430
lang/mycred-zh_CN.po CHANGED
@@ -2661,7 +2661,7 @@ msgid "Gabriel S Merovingi"
2661
  msgstr ""
2662
 
2663
  #. Author URI of the plugin
2664
- msgid "https://www.merovingi.com"
2665
  msgstr ""
2666
 
2667
  #: mycred.php:621
2661
  msgstr ""
2662
 
2663
  #. Author URI of the plugin
2664
+ msgid "https://www.mycred.me"
2665
  msgstr ""
2666
 
2667
  #: mycred.php:621
lang/mycred.pot CHANGED
@@ -6738,5 +6738,5 @@ msgid "Gabriel S Merovingi"
6738
  msgstr ""
6739
 
6740
  #. Author URI of the plugin
6741
- msgid "https://www.merovingi.com"
6742
  msgstr ""
6738
  msgstr ""
6739
 
6740
  #. Author URI of the plugin
6741
+ msgid "https://www.mycred.me"
6742
  msgstr ""
membership/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ // Silence is golden.
3
+ ?>
membership/mycred-connect-membership.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class to connect mycred with membership
4
+ *
5
+ * @since 1.0
6
+ * @version 1.0
7
+ */
8
+
9
+ // If this file is called directly, abort.
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
15
+ Class myCRED_Connect_Membership {
16
+
17
+ /**
18
+ * Construct
19
+ */
20
+ public function __construct() {
21
+ add_action('admin_menu', array($this,'mycred_membership_menu'));
22
+ add_action('init',array($this,'add_styles'));
23
+ }
24
+
25
+ function add_styles() {
26
+
27
+ wp_register_style('admin-subscription-css', plugins_url( 'assets/css/admin-subscription.css', myCRED_THIS ), array(), '1.0', 'all');
28
+ wp_enqueue_style('admin-subscription-css');
29
+ }
30
+
31
+ /**
32
+ * Register membership menu
33
+ */
34
+ public function mycred_membership_menu() {
35
+ add_submenu_page( 'mycred', 'Membership', 'Membership<span class="mycred-membership-menu-label">New</span>', 'manage_options', 'mycred-membership',array($this,'mycred_membership_callback'));
36
+ }
37
+
38
+ /**
39
+ * Membership menu callback
40
+ */
41
+ public function mycred_membership_callback() {
42
+ $user_id = get_current_user_id();
43
+ $this->mycred_save_license();
44
+ $membership_key = get_option( 'mycred_membership_key' );
45
+ if( !isset( $membership_key ) && !empty( $membership_key ) )
46
+ $membership_key = '';
47
+ ?>
48
+ <div class="wrap">
49
+ <h1><?php _e( 'myCRED Membership Club', 'mycred' ); ?></h1>
50
+ <div class="mmc_welcome">
51
+ <div class="mmc_welcome_content">
52
+ <form action="#" method="post">
53
+ <div class="mmc_title"><?php _e( 'Welcome to myCRED Membership Club', 'mycred' ); ?></div>
54
+ <input type="text" name="mmc_lincense_key" class="mmc_lincense_key" placeholder="<?php _e( 'Add Your Membership License', 'mycred' ); ?>" value="<?php echo $membership_key?>">
55
+ <input type="submit" class="mmc_save_license button-primary" value="Save"/>
56
+ <div class="mmc_license_link"><a href="https://mycred.me/redirect-to-membership/" target="_blank"><span class="dashicons dashicons-editor-help"></span><?php _e('Click here to get your Membership License','mycred') ?></a></div>
57
+ </form>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ <?php
62
+ }
63
+
64
+ /**
65
+ * Saving user membership key
66
+ */
67
+ public function mycred_save_license() {
68
+
69
+ if( !isset($_POST['mmc_lincense_key']) ) return;
70
+
71
+ $license_key = sanitize_text_field( $_POST['mmc_lincense_key'] );
72
+ if( isset( $license_key ) ) {
73
+ update_option( 'mycred_membership_key', $license_key );
74
+ }
75
+ }
76
+ }
77
+ endif;
78
+
79
+ $myCRED_Connect_Membership = new myCRED_Connect_Membership();
membership/subscription-functions.php ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Global Functions which can be accessible everywhere to enhance the functionality
4
+ *
5
+ */
6
+
7
+ if ( ! defined( 'myCRED_VERSION' ) ) exit;
8
+
9
+ /**
10
+ * Get WooCommerce Subscription Products
11
+ *
12
+ * @since 1.0
13
+ * @version 1.0
14
+ */
15
+ if( !function_exists('mycred_get_subscription_products') ) {
16
+ function mycred_get_subscription_products() {
17
+
18
+ $args = array(
19
+ 'post_type' => 'product',
20
+ 'posts_per_page' => -1,
21
+ 'fields' => 'ids',
22
+ );
23
+
24
+ $loop = get_posts( $args );
25
+
26
+ $subs_prod = array();
27
+ foreach ( $loop as $prod_id ) {
28
+ $product_s = wc_get_product( $prod_id );
29
+
30
+ if ($product_s->is_type('subscription')) {
31
+ $subs_prod[ $product_s->get_id() ] = $product_s->get_title();
32
+ }
33
+ }
34
+
35
+ return $subs_prod;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Get available subscription plans
41
+ *
42
+ * @since 1.0
43
+ * @version 1.0
44
+ */
45
+ if( !function_exists('mycred_get_subscription_plans') ) {
46
+ function mycred_get_subscription_plans() {
47
+
48
+ $args = array(
49
+ 'post_type' => 'mycred-subscription',
50
+ 'posts_per_page' => -1,
51
+ 'fields' => 'ids',
52
+ );
53
+
54
+ $loop = get_posts( $args );
55
+
56
+ $subs_prod = array();
57
+ foreach ( $loop as $prod_id ) {
58
+ $subs_prod[ $prod_id] = get_the_title( $prod_id );
59
+ }
60
+
61
+ return $subs_prod;
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Get all myCRED Addons
67
+ *
68
+ * @since 1.0
69
+ * @version 1.0
70
+ */
71
+ if( !function_exists('mycred_get_mycred_addons') ) {
72
+ function mycred_get_mycred_addons() {
73
+
74
+ $args = array(
75
+ 'post_type' => 'product',
76
+ 'posts_per_page' => -1,
77
+ 'fields' => 'ids',
78
+ );
79
+
80
+ $loop = get_posts( $args );
81
+
82
+ $subs_prod = array();
83
+ foreach ( $loop as $prod_id ) {
84
+ $product_s = wc_get_product( $prod_id );
85
+
86
+ if ( !$product_s->is_type('subscription') ) {
87
+ $subs_prod[ $product_s->get_id() ] = $product_s->get_title();
88
+ }
89
+ }
90
+
91
+ return $subs_prod;
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Get user membership key
97
+ *
98
+ * @since 1.0
99
+ * @version 1.0
100
+ */
101
+ if( !function_exists('mycred_get_membership_key') ) {
102
+ function mycred_get_membership_key() {
103
+
104
+ $membership_key = wp_cache_get('mycred_membership_key');
105
+
106
+ if( false === $membership_key ) {
107
+ $membership_key = get_option( 'mycred_membership_key' );
108
+ wp_cache_set( 'mycred_membership_key', $membership_key );
109
+ }
110
+
111
+ return $membership_key;
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Get mycred USER ID (mycred.me)
117
+ *
118
+ * @since 1.0
119
+ * @version 1.0
120
+ */
121
+ if( !function_exists('mycred_get_my_id') ) {
122
+ function mycred_get_my_id() {
123
+
124
+ if( !empty( mycred_get_membership_key() ) ) {
125
+ $membership_key = mycred_get_membership_key();
126
+ $membership_key = explode( '-', $membership_key );
127
+
128
+ return $membership_key[0];
129
+ }
130
+ }
131
+ }
132
+
133
+ /**
134
+ * Get user membership order ID
135
+ *
136
+ * @since 1.0
137
+ * @version 1.0
138
+ */
139
+ if( !function_exists('mycred_get_subscription_order_id') ) {
140
+ function mycred_get_subscription_order_id( $user_id = 0 ) {
141
+
142
+ if( empty( $user_id ) ) $user_id = get_current_user_id();
143
+
144
+ $customer_subscriptions = get_posts( array(
145
+ 'numberposts' => -1,
146
+ 'meta_key' => '_customer_user',
147
+ 'meta_value' => $user_id, // Or $user_id
148
+ 'post_type' => 'shop_subscription', // WC orders post type
149
+ 'post_status' => 'wc-active' // Only orders with status "completed"
150
+ ) );
151
+
152
+ // Iterating through each post subscription object
153
+ foreach( $customer_subscriptions as $customer_subscription ){
154
+ // The subscription ID
155
+ $subscription_id = $customer_subscription->ID;
156
+ }
157
+
158
+ return $subscription_id;
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Get Membership purchase date
164
+ *
165
+ * @since 1.0
166
+ * @version 1.0
167
+ */
168
+ if( !function_exists('mycred_get_subscription_purchase_date') ) {
169
+ function mycred_get_subscription_purchase_date( $user_id = 0 ) {
170
+
171
+ if( empty( $user_id ) ) $user_id = get_current_user_id();
172
+
173
+ $subscription_id = mycred_get_subscription_order_id( $user_id );
174
+ $subscription = new WC_Subscription( $subscription_id );
175
+
176
+ return $subscription->get_date('date_created');
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Get membership end date
182
+ *
183
+ * @since 1.0
184
+ * @version 1.0
185
+ */
186
+ if( !function_exists('mycred_get_subscription_end_date') ) {
187
+ function mycred_get_subscription_end_date( $user_id = 0 ) {
188
+
189
+ if( empty( $user_id ) ) $user_id = get_current_user_id();
190
+
191
+ $subscription_id = mycred_get_subscription_order_id( $user_id );
192
+ $subscription = new WC_Subscription( $subscription_id );
193
+
194
+ return $subscription->get_date('next_payment');
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Get membership end date
200
+ *
201
+ * @since 1.0
202
+ * @version 1.0
203
+ */
204
+ if( !function_exists('mycred_is_membership_active') ) {
205
+ function mycred_is_membership_active() {
206
+
207
+ $membership_status = wp_cache_get('mycred_membership_status');
208
+
209
+ if( false === $membership_status ) {
210
+
211
+ $user_license_key = mycred_get_membership_key();
212
+
213
+ $url = rtrim( get_bloginfo( 'url' ), '/' );
214
+ if( myCRED_VERSION >= '1.8.8' && !empty( $user_license_key ) &&
215
+ mycred_get_membership_details()['plan'][0]['key'] == $user_license_key &&
216
+ in_array( $url, mycred_get_membership_details()['sites'][0] )
217
+ ) {
218
+ $membership_status = true;
219
+ }
220
+ wp_cache_set( 'mycred_membership_status', $membership_status );
221
+ }
222
+
223
+ return $membership_status;
224
+ }
225
+ }
226
+
227
+ /**
228
+ * Get membership details
229
+ *
230
+ * @since 1.0
231
+ * @version 1.0
232
+ */
233
+ if( !function_exists('mycred_get_membership_details') ) {
234
+ function mycred_get_membership_details() {
235
+
236
+ $membership_details = wp_cache_get('mycred_membership_details');
237
+
238
+ if( false === $membership_details ) {
239
+
240
+ $url = 'https://mycred.me/wp-json/membership/v1/member/'.mycred_get_my_id();
241
+ $data = wp_remote_get( $url );
242
+
243
+ $membership_details = json_decode( $data['body'], true );
244
+ wp_cache_set( 'mycred_membership_details', $membership_details );
245
+ }
246
+
247
+ return $membership_details;
248
+
249
+ }
250
+ }
modules/mycred-module-addons.php CHANGED
@@ -177,8 +177,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
177
  'description' => __( 'Give your users badges based on their interaction with your website.', 'mycred' ),
178
  'addon_url' => 'http://codex.mycred.me/chapter-iii/badges/',
179
  'version' => '1.3',
180
- 'author' => 'Gabriel S Merovingi',
181
- 'author_url' => 'https://www.merovingi.com',
182
  'screenshot' => plugins_url( 'assets/images/badges-addon.png', myCRED_THIS ),
183
  'requires' => array()
184
  );
@@ -189,8 +189,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
189
  'description' => __( 'Setup recurring payouts or offer / charge interest on user account balances.', 'mycred' ),
190
  'addon_url' => 'http://codex.mycred.me/chapter-iii/banking/',
191
  'version' => '2.0',
192
- 'author' => 'Gabriel S Merovingi',
193
- 'author_url' => 'https://www.merovingi.com',
194
  'screenshot' => plugins_url( 'assets/images/banking-addon.png', myCRED_THIS ),
195
  'requires' => array()
196
  );
@@ -201,8 +201,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
201
  'description' => __( 'The <strong>buy</strong>CRED Add-on allows your users to buy points using PayPal, Skrill (Moneybookers) or NETbilling. <strong>buy</strong>CRED can also let your users buy points for other members.', 'mycred' ),
202
  'addon_url' => 'http://codex.mycred.me/chapter-iii/buycred/',
203
  'version' => '1.5',
204
- 'author' => 'Gabriel S Merovingi',
205
- 'author_url' => 'https://www.merovingi.com',
206
  'screenshot' => plugins_url( 'assets/images/buy-creds-addon.png', myCRED_THIS ),
207
  'requires' => array()
208
  );
@@ -213,8 +213,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
213
  'description' => __( 'The coupons add-on allows you to create coupons that users can use to add points to their accounts.', 'mycred' ),
214
  'addon_url' => 'http://codex.mycred.me/chapter-iii/coupons/',
215
  'version' => '1.4',
216
- 'author' => 'Gabriel S Merovingi',
217
- 'author_url' => 'https://www.merovingi.com',
218
  'screenshot' => plugins_url( 'assets/images/coupons-addon.png', myCRED_THIS ),
219
  'requires' => array()
220
  );
@@ -225,8 +225,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
225
  'description' => __( 'Create email notices for any type of myCRED instance.', 'mycred' ),
226
  'addon_url' => 'http://codex.mycred.me/chapter-iii/email-notice/',
227
  'version' => '1.4',
228
- 'author' => 'Gabriel S Merovingi',
229
- 'author_url' => 'https://www.merovingi.com',
230
  'screenshot' => plugins_url( 'assets/images/email-notifications-addon.png', myCRED_THIS ),
231
  'requires' => array()
232
  );
@@ -237,8 +237,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
237
  'description' => __( 'Let your users pay using their <strong>my</strong>CRED points balance. Supported Carts: WooCommerce, MarketPress and WP E-Commerce. Supported Event Bookings: Event Espresso and Events Manager (free & pro).', 'mycred' ),
238
  'addon_url' => 'http://codex.mycred.me/chapter-iii/gateway/',
239
  'version' => '1.4',
240
- 'author' => 'Gabriel S Merovingi',
241
- 'author_url' => 'https://www.merovingi.com',
242
  'screenshot' => plugins_url( 'assets/images/gateway-addon.png', myCRED_THIS ),
243
  'requires' => array()
244
  );
@@ -249,8 +249,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
249
  'description' => __( 'Create pop-up notifications for when users gain or loose points.', 'mycred' ),
250
  'addon_url' => 'http://codex.mycred.me/chapter-iii/notifications/',
251
  'version' => '1.1.2',
252
- 'author' => 'Gabriel S Merovingi',
253
- 'author_url' => 'https://www.merovingi.com',
254
  'pro_url' => 'https://mycred.me/store/notifications-plus-add-on/',
255
  'screenshot' => plugins_url( 'assets/images/notifications-addon.png', myCRED_THIS ),
256
  'requires' => array()
@@ -262,8 +262,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
262
  'description' => __( 'Create ranks for users reaching a certain number of %_plural% with the option to add logos for each rank.', 'mycred' ),
263
  'addon_url' => 'http://codex.mycred.me/chapter-iii/ranks/',
264
  'version' => '1.6',
265
- 'author' => 'Gabriel S Merovingi',
266
- 'author_url' => 'https://www.merovingi.com',
267
  'screenshot' => plugins_url( 'assets/images/ranks-addon.png', myCRED_THIS ),
268
  'requires' => array()
269
  );
@@ -274,8 +274,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
274
  'description' => __( 'This add-on allows you to sell posts, pages or any public post types on your website. You can either sell the entire content or using our shortcode, sell parts of your content allowing you to offer "teasers".', 'mycred' ),
275
  'addon_url' => 'http://codex.mycred.me/chapter-iii/sell-content/',
276
  'version' => '2.0.1',
277
- 'author' => 'Gabriel S Merovingi',
278
- 'author_url' => 'https://www.merovingi.com',
279
  'screenshot' => plugins_url( 'assets/images/sell-content-addon.png', myCRED_THIS ),
280
  'requires' => array( 'log' )
281
  );
@@ -286,8 +286,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
286
  'description' => __( 'Gives you access to your myCRED Statistics based on your users gains and loses.', 'mycred' ),
287
  'addon_url' => 'http://codex.mycred.me/chapter-iii/statistics/',
288
  'version' => '2.0',
289
- 'author' => 'Gabriel S Merovingi',
290
- 'author_url' => 'https://www.merovingi.com',
291
  'screenshot' => plugins_url( 'assets/images/statistics-addon.png', myCRED_THIS )
292
  );
293
 
@@ -297,8 +297,8 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
297
  'description' => __( 'Allow your users to send or "donate" points to other members by either using the mycred_transfer shortcode or the myCRED Transfer widget.', 'mycred' ),
298
  'addon_url' => 'http://codex.mycred.me/chapter-iii/transfers/',
299
  'version' => '1.6',
300
- 'author' => 'Gabriel S Merovingi',
301
- 'author_url' => 'https://www.merovingi.com',
302
  'pro_url' => 'https://mycred.me/store/transfer-plus/',
303
  'screenshot' => plugins_url( 'assets/images/transfer-addon.png', myCRED_THIS ),
304
  'requires' => array()
177
  'description' => __( 'Give your users badges based on their interaction with your website.', 'mycred' ),
178
  'addon_url' => 'http://codex.mycred.me/chapter-iii/badges/',
179
  'version' => '1.3',
180
+ 'author' => 'myCred',
181
+ 'author_url' => 'https://www.mycred.me',
182
  'screenshot' => plugins_url( 'assets/images/badges-addon.png', myCRED_THIS ),
183
  'requires' => array()
184
  );
189
  'description' => __( 'Setup recurring payouts or offer / charge interest on user account balances.', 'mycred' ),
190
  'addon_url' => 'http://codex.mycred.me/chapter-iii/banking/',
191
  'version' => '2.0',
192
+ 'author' => 'myCred',
193
+ 'author_url' => 'https://www.mycred.me',
194
  'screenshot' => plugins_url( 'assets/images/banking-addon.png', myCRED_THIS ),
195
  'requires' => array()
196
  );
201
  'description' => __( 'The <strong>buy</strong>CRED Add-on allows your users to buy points using PayPal, Skrill (Moneybookers) or NETbilling. <strong>buy</strong>CRED can also let your users buy points for other members.', 'mycred' ),
202
  'addon_url' => 'http://codex.mycred.me/chapter-iii/buycred/',
203
  'version' => '1.5',
204
+ 'author' => 'myCred',
205
+ 'author_url' => 'https://www.mycred.me',
206
  'screenshot' => plugins_url( 'assets/images/buy-creds-addon.png', myCRED_THIS ),
207
  'requires' => array()
208
  );
213
  'description' => __( 'The coupons add-on allows you to create coupons that users can use to add points to their accounts.', 'mycred' ),
214
  'addon_url' => 'http://codex.mycred.me/chapter-iii/coupons/',
215
  'version' => '1.4',
216
+ 'author' => 'myCred',
217
+ 'author_url' => 'https://www.mycred.me',
218
  'screenshot' => plugins_url( 'assets/images/coupons-addon.png', myCRED_THIS ),
219
  'requires' => array()
220
  );
225
  'description' => __( 'Create email notices for any type of myCRED instance.', 'mycred' ),
226
  'addon_url' => 'http://codex.mycred.me/chapter-iii/email-notice/',
227
  'version' => '1.4',
228
+ 'author' => 'myCred',
229
+ 'author_url' => 'https://www.mycred.me',
230
  'screenshot' => plugins_url( 'assets/images/email-notifications-addon.png', myCRED_THIS ),
231
  'requires' => array()
232
  );
237
  'description' => __( 'Let your users pay using their <strong>my</strong>CRED points balance. Supported Carts: WooCommerce, MarketPress and WP E-Commerce. Supported Event Bookings: Event Espresso and Events Manager (free & pro).', 'mycred' ),
238
  'addon_url' => 'http://codex.mycred.me/chapter-iii/gateway/',
239
  'version' => '1.4',
240
+ 'author' => 'myCred',
241
+ 'author_url' => 'https://www.mycred.me',
242
  'screenshot' => plugins_url( 'assets/images/gateway-addon.png', myCRED_THIS ),
243
  'requires' => array()
244
  );
249
  'description' => __( 'Create pop-up notifications for when users gain or loose points.', 'mycred' ),
250
  'addon_url' => 'http://codex.mycred.me/chapter-iii/notifications/',
251
  'version' => '1.1.2',
252
+ 'author' => 'myCred',
253
+ 'author_url' => 'https://www.mycred.me',
254
  'pro_url' => 'https://mycred.me/store/notifications-plus-add-on/',
255
  'screenshot' => plugins_url( 'assets/images/notifications-addon.png', myCRED_THIS ),
256
  'requires' => array()
262
  'description' => __( 'Create ranks for users reaching a certain number of %_plural% with the option to add logos for each rank.', 'mycred' ),
263
  'addon_url' => 'http://codex.mycred.me/chapter-iii/ranks/',
264
  'version' => '1.6',
265
+ 'author' => 'myCred',
266
+ 'author_url' => 'https://www.mycred.me',
267
  'screenshot' => plugins_url( 'assets/images/ranks-addon.png', myCRED_THIS ),
268
  'requires' => array()
269
  );
274
  'description' => __( 'This add-on allows you to sell posts, pages or any public post types on your website. You can either sell the entire content or using our shortcode, sell parts of your content allowing you to offer "teasers".', 'mycred' ),
275
  'addon_url' => 'http://codex.mycred.me/chapter-iii/sell-content/',
276
  'version' => '2.0.1',
277
+ 'author' => 'myCred',
278
+ 'author_url' => 'https://www.mycred.me',
279
  'screenshot' => plugins_url( 'assets/images/sell-content-addon.png', myCRED_THIS ),
280
  'requires' => array( 'log' )
281
  );
286
  'description' => __( 'Gives you access to your myCRED Statistics based on your users gains and loses.', 'mycred' ),
287
  'addon_url' => 'http://codex.mycred.me/chapter-iii/statistics/',
288
  'version' => '2.0',
289
+ 'author' => 'myCred',
290
+ 'author_url' => 'https://www.mycred.me',
291
  'screenshot' => plugins_url( 'assets/images/statistics-addon.png', myCRED_THIS )
292
  );
293
 
297
  'description' => __( 'Allow your users to send or "donate" points to other members by either using the mycred_transfer shortcode or the myCRED Transfer widget.', 'mycred' ),
298
  'addon_url' => 'http://codex.mycred.me/chapter-iii/transfers/',
299
  'version' => '1.6',
300
+ 'author' => 'myCred',
301
+ 'author_url' => 'https://www.mycred.me',
302
  'pro_url' => 'https://mycred.me/store/transfer-plus/',
303
  'screenshot' => plugins_url( 'assets/images/transfer-addon.png', myCRED_THIS ),
304
  'requires' => array()
modules/mycred-module-settings.php CHANGED
@@ -811,7 +811,9 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
811
  </div>
812
  <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"></div>
813
  </div>
814
- <p id="mycred-ctype-warning"><strong><?php _e( 'The meta key must be lowercase and only contain letters or underscores. All other characters will be deleted!', 'mycred' ); ?></strong></p>
 
 
815
  </div>
816
  <?php
817
 
811
  </div>
812
  <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"></div>
813
  </div>
814
+ <p id="mycred-ctype-warning">
815
+ <strong><?php _e( 'Note This meta key must be in lowercase and only contain letters or underscore. All other characters will be deleted! make sure to add some unique prefix to this meta key to avoid any conflicts in database.', 'mycred' ); ?> <a href="https://codex.mycred.me/chapter-i/points/"><?php _e( 'Read More', 'mycred' )?></a></strong>
816
+ </p>
817
  </div>
818
  <?php
819
 
mycred.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: myCRED
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
- * Version: 1.8.7
7
  * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
8
  * Author: myCRED
9
  * Author URI: https://mycred.me
10
  * Author Email: support@mycred.me
11
  * Requires at least: WP 4.8
12
- * Tested up to: WP 5.3
13
  * Text Domain: mycred
14
  * Domain Path: /lang
15
  * License: GPLv2 or later
@@ -19,7 +19,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
19
  final class myCRED_Core {
20
 
21
  // Plugin Version
22
- public $version = '1.8.7';
23
 
24
  // Instnace
25
  protected static $_instance = NULL;
@@ -53,14 +53,14 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
53
  * @since 1.7
54
  * @version 1.0
55
  */
56
- public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '1.8.7' ); }
57
 
58
  /**
59
  * Not allowed
60
  * @since 1.7
61
  * @version 1.0
62
  */
63
- public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '1.8.7' ); }
64
 
65
  /**
66
  * Get
@@ -93,7 +93,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
93
  if ( file_exists( $required_file ) )
94
  require_once $required_file;
95
  else
96
- _doing_it_wrong( 'myCRED_Core->file()', 'Requested file ' . $required_file . ' not found.', '1.7' );
97
  }
98
 
99
  /**
@@ -182,6 +182,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
182
  $this->define( 'myCRED_INCLUDES_DIR', myCRED_ROOT_DIR . 'includes/', false );
183
  $this->define( 'myCRED_LANG_DIR', myCRED_ROOT_DIR . 'lang/', false );
184
  $this->define( 'myCRED_MODULES_DIR', myCRED_ROOT_DIR . 'modules/', false );
 
185
  $this->define( 'myCRED_CLASSES_DIR', myCRED_INCLUDES_DIR . 'classes/', false );
186
  $this->define( 'myCRED_IMPORTERS_DIR', myCRED_INCLUDES_DIR . 'importers/', false );
187
  $this->define( 'myCRED_SHORTCODES_DIR', myCRED_INCLUDES_DIR . 'shortcodes/', false );
@@ -220,6 +221,10 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
220
  // If myCRED has been setup and is ready to begin
221
  if ( mycred_is_installed() ) {
222
 
 
 
 
 
223
  // Modules
224
  $this->file( myCRED_MODULES_DIR . 'mycred-module-addons.php' );
225
  $this->file( myCRED_MODULES_DIR . 'mycred-module-settings.php' );
3
  * Plugin Name: myCRED
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
+ * Version: 1.8.8
7
  * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
8
  * Author: myCRED
9
  * Author URI: https://mycred.me
10
  * Author Email: support@mycred.me
11
  * Requires at least: WP 4.8
12
+ * Tested up to: WP 5.3.2
13
  * Text Domain: mycred
14
  * Domain Path: /lang
15
  * License: GPLv2 or later
19
  final class myCRED_Core {
20
 
21
  // Plugin Version
22
+ public $version = '1.8.8';
23
 
24
  // Instnace
25
  protected static $_instance = NULL;
53
  * @since 1.7
54
  * @version 1.0
55
  */
56
+ public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '1.8.8' ); }
57
 
58
  /**
59
  * Not allowed
60
  * @since 1.7
61
  * @version 1.0
62
  */
63
+ public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '1.8.8' ); }
64
 
65
  /**
66
  * Get
93
  if ( file_exists( $required_file ) )
94
  require_once $required_file;
95
  else
96
+ _doing_it_wrong( 'myCRED_Core->file()', 'Requested file ' . $required_file . ' not found.', '1.8.8' );
97
  }
98
 
99
  /**
182
  $this->define( 'myCRED_INCLUDES_DIR', myCRED_ROOT_DIR . 'includes/', false );
183
  $this->define( 'myCRED_LANG_DIR', myCRED_ROOT_DIR . 'lang/', false );
184
  $this->define( 'myCRED_MODULES_DIR', myCRED_ROOT_DIR . 'modules/', false );
185
+ $this->define( 'myCRED_MEMBERSHIP_DIR', myCRED_ROOT_DIR . 'membership/', false );
186
  $this->define( 'myCRED_CLASSES_DIR', myCRED_INCLUDES_DIR . 'classes/', false );
187
  $this->define( 'myCRED_IMPORTERS_DIR', myCRED_INCLUDES_DIR . 'importers/', false );
188
  $this->define( 'myCRED_SHORTCODES_DIR', myCRED_INCLUDES_DIR . 'shortcodes/', false );
221
  // If myCRED has been setup and is ready to begin
222
  if ( mycred_is_installed() ) {
223
 
224
+ // myCRED Subscription
225
+ $this->file( myCRED_MEMBERSHIP_DIR . 'subscription-functions.php' );
226
+ $this->file( myCRED_MEMBERSHIP_DIR . 'mycred-connect-membership.php' );
227
+
228
  // Modules
229
  $this->file( myCRED_MODULES_DIR . 'mycred-module-addons.php' );
230
  $this->file( myCRED_MODULES_DIR . 'mycred-module-settings.php' );
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mycred,wpexpertsio
3
  Tags: points, badges, rewards, loyalty, gamification, loyalty points, user engagement, user credit
4
  Requires at least: 4.8
5
  Tested up to: 5.3
6
- Stable tag: 1.8.7
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -26,6 +26,20 @@ myCred allows **THREE different ways** through which you can award your users:
26
 
27
  * **Badges -** Boost your users’ participation by rewarding them for their exceptional performance.
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  = Features =
30
 
31
  **- Point Balances:** Each user on your website will have their own point balance, where they’ll be able to view points that were gained/lost.
@@ -242,6 +256,8 @@ Bug fixes release.
242
  = 1.8.7 =
243
  Bug fixes release.
244
 
 
 
245
 
246
  == Other Notes ==
247
 
@@ -263,6 +279,18 @@ Bug fixes release.
263
 
264
  == Changelog ==
265
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  = 1.8.7 =
267
  NEW - Introduce a new action hook mycred_after_badge_assign.
268
  FIX - Placeholder attribute not working in mycred_transfer shortcode.
3
  Tags: points, badges, rewards, loyalty, gamification, loyalty points, user engagement, user credit
4
  Requires at least: 4.8
5
  Tested up to: 5.3
6
+ Stable tag: 1.8.8
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
26
 
27
  * **Badges -** Boost your users’ participation by rewarding them for their exceptional performance.
28
 
29
+ = BECOME A VIP MEMBER OF THE MYCRED MEMBERSHIP CLUB =
30
+
31
+ 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!
32
+
33
+ - Instantly gain access to 50+ myCred add-ons.
34
+ - Premium support & priority updates.
35
+ - One membership license key that works for all add-ons.
36
+ - Connect multiple sites with just one membership license key.
37
+ - Upgrade your package at any time to get more add-ons.
38
+
39
+ [Check the package pricing page for the add-on list](https://mycred.me/membership/)
40
+
41
+ **Important Announcement** You have to update your myCred plugin to version 1.8.8 in order to use the myCred Membership services.
42
+
43
  = Features =
44
 
45
  **- Point Balances:** Each user on your website will have their own point balance, where they’ll be able to view points that were gained/lost.
256
  = 1.8.7 =
257
  Bug fixes release.
258
 
259
+ = 1.8.8 =
260
+ Bug fixes release.
261
 
262
  == Other Notes ==
263
 
279
 
280
  == Changelog ==
281
 
282
+ = 1.8.8 =
283
+ NEW - Introduced myCred membership.
284
+ NEW - Added support in badge for specific link click and gravity form.
285
+ TWEAK - Added notice for meta key to avoid any conflicts.
286
+ FIX - leaderboard "current" attribute was not working.
287
+ FIX - myCred ranks show in BuddyPress profile even the user is excluded from the point type.
288
+ FIX - "number" attribute was not working in stats related shortcodes.
289
+ FIX - Errors in mycred_get_ranks function.
290
+ FIX - Unselected point types also appear in myCred Wallet Widget.
291
+ FIX - Four-digit points value not working in remote API.
292
+ FIX - MYSQL and MariaDB syntax error in their newer versions.
293
+
294
  = 1.8.7 =
295
  NEW - Introduce a new action hook mycred_after_badge_assign.
296
  FIX - Placeholder attribute not working in mycred_transfer shortcode.