myCRED - Version 2.4.6.1

Version Description

Bug fixes.

Download this release

Release Info

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

Code changes from version 2.4.6 to 2.4.6.1

addons/badges/includes/mycred-badge-shortcodes.php CHANGED
@@ -2,8 +2,7 @@
2
  if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
 
4
  if (! function_exists('mycred_render_my_badges') ) :
5
- function mycred_render_my_badges( $atts, $content = '' )
6
- {
7
 
8
  extract(
9
  shortcode_atts(
@@ -18,86 +17,87 @@ if (! function_exists('mycred_render_my_badges') ) :
18
  )
19
  );
20
 
21
- if (! is_user_logged_in() && $user_id == 'current' ) {
22
  return $content;
23
  }
24
 
25
- $all_badges = mycred_get_badge_ids();
26
- $profile_user_id = mycred_get_user_id($user_id);
27
- $users_badges = mycred_get_users_badges( $profile_user_id, true );
28
- $user_id = mycred_get_user_id($user_id);
29
 
30
  ob_start();
31
 
32
  echo '<div class="row" id="mycred-users-badges"><div class="col-xs-12">';
33
 
34
  // Show only badges that we have earned
35
- if ($show == 'earned' ) {
36
 
37
  foreach ( $all_badges as $badge_id ) {
 
38
  echo '<div class="the-badge">';
39
- $page_id = get_page($badge_id);
40
-
41
-
42
- $badge_id = absint( $badge_id );
43
- $has_earned = mycred_get_badge( $badge_id );
44
- $badge = mycred_get_badge( $badge_id );
45
-
46
- $users_badges = mycred_get_users_badges($profile_user_id );
47
- $mycred = mycred();
48
-
49
- if ( array_key_exists( $badge_id, $users_badges ) ) {
50
- $earned = 1;
51
- $earned_level = $users_badges[ $badge_id ];
52
- $badge_image = $badge->get_image( $earned_level );
53
-
54
-
55
- }
56
-
57
 
58
- if($has_earned ) {
59
 
60
-
61
- $badge_title = $has_earned->title;
62
- $badge_img = $has_earned->main_image;
63
- $level_image = $has_earned->level_image;
64
- $show_img = $has_earned->user_has_badge( $profile_user_id );
65
 
 
66
 
67
- if($show_img) {
68
 
69
- echo '<div class="demo-badge-image">' . wp_kses_post( $badge_img ) . '</div>';
70
 
71
- if($title == 'show') {
72
 
73
  echo '<div class="demo-badge-title">' . esc_html( $badge_title ) . ' '.'</div>';
74
 
75
- } else {
 
76
 
77
  echo '<div class="demo-badge-title" style="display:none;">' . esc_html( $badge_title ) . ' '.'</div>';
78
 
79
  }
80
 
81
- if($post_excerpt == 'show') {
82
 
83
  echo '<div class="page-excerpt">' . wp_kses_post( $page_id->post_excerpt ) . ' '.'</div>';
84
 
85
- } else {
 
 
86
  echo '<div class="page-excerpt" style="display:none;">' . wp_kses_post( $page_id->post_excerpt ) . ' '.'</div>';
 
87
  }
88
 
89
- }
90
 
91
- }
92
-
93
- }
94
 
95
  }
96
-
97
  // Show all badges highlighting the ones we earned
98
- elseif ($show == 'all' ) {
99
 
100
- $users_badges = mycred_get_users_badges($user_id);
101
  $all_badges = mycred_get_badge_ids();
102
 
103
  foreach ( $all_badges as $badge_id ) {
@@ -105,20 +105,20 @@ if (! function_exists('mycred_render_my_badges') ) :
105
  echo '<div class="the-badge">';
106
 
107
  // User has not earned badge
108
- if (! array_key_exists($badge_id, $users_badges) ) {
109
 
110
- $badge = mycred_get_badge($badge_id);
111
- $page_id = get_page($badge_id);
112
  $badge->image_width = $width;
113
  $badge->image_height = $height;
114
  $badge_title = $badge->title;
115
  $badge_img = $badge->main_image;
116
 
117
- if ($badge->main_image !== false ) {
118
 
119
  echo '<div class="demo-badge-image">' . wp_kses_post( $badge_img ) . '</div>';
120
 
121
- if($title == 'show') {
122
 
123
  echo '<div class="demo-badge-title">' . esc_html( $badge_title ) . ' '.'</div>';
124
 
@@ -128,47 +128,55 @@ if (! function_exists('mycred_render_my_badges') ) :
128
 
129
  }
130
 
131
- if($post_excerpt == 'show') {
132
 
133
  echo '<div class="page-excerpt">' . wp_kses_post( $page_id->post_excerpt ) . ' '.'</div>';
134
 
135
- } else {
 
 
136
  echo '<div class="page-excerpt" style="display:none;">' . wp_kses_post( $page_id->post_excerpt ) . ' '.'</div>';
 
137
  }
138
 
139
  }
140
 
141
  }
142
-
143
  // User has earned badge
144
  else {
145
 
146
  $level = $users_badges[ $badge_id ];
147
- $badge = mycred_get_badge($badge_id, $level);
148
  $badge->image_width = $width;
149
  $badge->image_height = $height;
150
- $badge_page_id = get_page($badge_id);
151
 
152
- if ($badge->level_image !== false ) {
 
 
153
 
154
- echo '<div class="demo-badge-image">' . wp_kses_post( $badge->get_image($level) ) . '</div>';
155
 
156
- if($title == 'show') {
157
- echo '<div class="demo-badge-title">' . esc_html( $badge->title ) . ' '.'</div>';
 
158
 
159
  }
160
-
161
  else {
162
- echo '<div class="demo-badge-title" style="display:none;">' . esc_html( $badge->title ) . ' '.'</div>';
 
163
 
164
  }
165
 
166
- if($post_excerpt == 'show') {
167
 
168
- echo '<div class="page-excerpt">' . wp_kses_post( $badge_page_id->post_excerpt ) . ' '.'</div>';
169
 
170
- } else {
171
- echo '<div class="page-excerpt" style="display:none;">' . wp_kses_post( $badge_page_id->post_excerpt ) . ' '.'</div>';;
 
 
 
172
  }
173
 
174
  }
@@ -177,12 +185,17 @@ if (! function_exists('mycred_render_my_badges') ) :
177
 
178
  echo '</div>';
179
 
180
- if($title == 'show' || $post_excerpt == 'show') {
 
181
  echo '<hr class="badge-line">';
 
182
  }
183
  else {
 
184
  echo '';
 
185
  }
 
186
  }
187
 
188
  }
2
  if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
 
4
  if (! function_exists('mycred_render_my_badges') ) :
5
+ function mycred_render_my_badges( $atts, $content = '' ) {
 
6
 
7
  extract(
8
  shortcode_atts(
17
  )
18
  );
19
 
20
+ if ( ! is_user_logged_in() && $user_id == 'current' ) {
21
  return $content;
22
  }
23
 
24
+ $all_badges = mycred_get_badge_ids();
25
+ $profile_user_id = mycred_get_user_id( $user_id );
26
+ $users_badges = mycred_get_users_badges( $profile_user_id, true );
27
+ $user_id = mycred_get_user_id( $user_id );
28
 
29
  ob_start();
30
 
31
  echo '<div class="row" id="mycred-users-badges"><div class="col-xs-12">';
32
 
33
  // Show only badges that we have earned
34
+ if ( $show == 'earned' ) {
35
 
36
  foreach ( $all_badges as $badge_id ) {
37
+
38
  echo '<div class="the-badge">';
39
+
40
+ $page_id = get_page($badge_id);
41
+ $badge_id = absint( $badge_id );
42
+ $has_earned = mycred_get_badge( $badge_id );
43
+ $badge = mycred_get_badge( $badge_id );
44
+ $users_badges = mycred_get_users_badges($profile_user_id );
45
+ $mycred = mycred();
46
+
47
+ if ( array_key_exists( $badge_id, $users_badges ) ) {
48
+
49
+ $earned = 1;
50
+ $earned_level = $users_badges[ $badge_id ];
51
+ $badge_image = $badge->get_image( $earned_level );
52
+
53
+ }
 
 
 
54
 
55
+ if( $has_earned ) {
56
 
57
+ $badge_title = $has_earned->title;
58
+ $badge_img = $has_earned->main_image;
59
+ $level_image = $has_earned->level_image;
60
+ $show_img = $has_earned->user_has_badge( $profile_user_id );
 
61
 
62
+ if( $show_img ) {
63
 
64
+ $earned_badge_image = ! empty( $has_earned->level_image ) ? $has_earned->level_image : $has_earned->main_image;
65
 
66
+ echo '<div class="demo-badge-image">' . wp_kses_post( $earned_badge_image ) . '</div>';
67
 
68
+ if( $title == 'show' ) {
69
 
70
  echo '<div class="demo-badge-title">' . esc_html( $badge_title ) . ' '.'</div>';
71
 
72
+ }
73
+ else {
74
 
75
  echo '<div class="demo-badge-title" style="display:none;">' . esc_html( $badge_title ) . ' '.'</div>';
76
 
77
  }
78
 
79
+ if( $post_excerpt == 'show' ) {
80
 
81
  echo '<div class="page-excerpt">' . wp_kses_post( $page_id->post_excerpt ) . ' '.'</div>';
82
 
83
+ }
84
+ else {
85
+
86
  echo '<div class="page-excerpt" style="display:none;">' . wp_kses_post( $page_id->post_excerpt ) . ' '.'</div>';
87
+
88
  }
89
 
90
+ }
91
 
92
+ }
93
+
94
+ }
95
 
96
  }
 
97
  // Show all badges highlighting the ones we earned
98
+ elseif ( $show == 'all' ) {
99
 
100
+ $users_badges = mycred_get_users_badges( $user_id );
101
  $all_badges = mycred_get_badge_ids();
102
 
103
  foreach ( $all_badges as $badge_id ) {
105
  echo '<div class="the-badge">';
106
 
107
  // User has not earned badge
108
+ if ( ! array_key_exists( $badge_id, $users_badges ) ) {
109
 
110
+ $badge = mycred_get_badge( $badge_id );
111
+ $page_id = get_page( $badge_id );
112
  $badge->image_width = $width;
113
  $badge->image_height = $height;
114
  $badge_title = $badge->title;
115
  $badge_img = $badge->main_image;
116
 
117
+ if ( $badge->main_image !== false ) {
118
 
119
  echo '<div class="demo-badge-image">' . wp_kses_post( $badge_img ) . '</div>';
120
 
121
+ if( $title == 'show' ) {
122
 
123
  echo '<div class="demo-badge-title">' . esc_html( $badge_title ) . ' '.'</div>';
124
 
128
 
129
  }
130
 
131
+ if( $post_excerpt == 'show' ) {
132
 
133
  echo '<div class="page-excerpt">' . wp_kses_post( $page_id->post_excerpt ) . ' '.'</div>';
134
 
135
+ }
136
+ else {
137
+
138
  echo '<div class="page-excerpt" style="display:none;">' . wp_kses_post( $page_id->post_excerpt ) . ' '.'</div>';
139
+
140
  }
141
 
142
  }
143
 
144
  }
 
145
  // User has earned badge
146
  else {
147
 
148
  $level = $users_badges[ $badge_id ];
149
+ $badge = mycred_get_badge( $badge_id, $level );
150
  $badge->image_width = $width;
151
  $badge->image_height = $height;
152
+ $badge_page_id = get_page( $badge_id );
153
 
154
+ if ( $badge->level_image !== false ) {
155
+
156
+ var_dump( $level, $badge );
157
 
158
+ echo '<div class="demo-badge-image">' . wp_kses_post( $badge->get_image( $level ) ) . '</div>';
159
 
160
+ if( $title == 'show' ) {
161
+
162
+ echo '<div class="demo-badge-title">' . esc_html( $badge->title ) . ' '.'</div>';
163
 
164
  }
 
165
  else {
166
+
167
+ echo '<div class="demo-badge-title" style="display:none;">' . esc_html( $badge->title ) . ' '.'</div>';
168
 
169
  }
170
 
171
+ if( $post_excerpt == 'show' ) {
172
 
173
+ echo '<div class="page-excerpt">' . wp_kses_post( $badge_page_id->post_excerpt ) . ' '.'</div>';
174
 
175
+ }
176
+ else {
177
+
178
+ echo '<div class="page-excerpt" style="display:none;">' . wp_kses_post( $badge_page_id->post_excerpt ) . ' '.'</div>';;
179
+
180
  }
181
 
182
  }
185
 
186
  echo '</div>';
187
 
188
+ if( $title == 'show' || $post_excerpt == 'show' ) {
189
+
190
  echo '<hr class="badge-line">';
191
+
192
  }
193
  else {
194
+
195
  echo '';
196
+
197
  }
198
+
199
  }
200
 
201
  }
addons/badges/myCRED-addon-badges.php CHANGED
@@ -1136,7 +1136,8 @@ th#badge-users { width: 10%; }
1136
  'data-row' => array(),
1137
  ),
1138
  'option' => array(
1139
- 'value' => array()
 
1140
  ),
1141
  'p' => array(
1142
  'class' => array(),
1136
  'data-row' => array(),
1137
  ),
1138
  'option' => array(
1139
+ 'value' => array(),
1140
+ 'selected' => array()
1141
  ),
1142
  'p' => array(
1143
  'class' => array(),
includes/hooks/external/mycred-hook-woocommerce.php CHANGED
@@ -490,7 +490,7 @@ function mycred_woo_product_unreward( $product_reward ) {
490
  $product_reward->entry,
491
  $product_reward->id,
492
  $product_reward->data,
493
- $product_reward->ctype,
494
  );
495
 
496
  }
490
  $product_reward->entry,
491
  $product_reward->id,
492
  $product_reward->data,
493
+ $product_reward->ctype
494
  );
495
 
496
  }
includes/mycred-functions.php CHANGED
@@ -3765,7 +3765,7 @@ if ( !function_exists( 'mycred_badge_level_req_check' ) ):
3765
  if ( $level_index == 1 )
3766
  $starting_index = 1;
3767
  if ( $level_index > 1 )
3768
- $starting_index = $level_index - 1;
3769
 
3770
  // Based on the base requirements, we first get the users log entry results
3771
 
3765
  if ( $level_index == 1 )
3766
  $starting_index = 1;
3767
  if ( $level_index > 1 )
3768
+ $starting_index = $level_index;
3769
 
3770
  // Based on the base requirements, we first get the users log entry results
3771
 
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.4.6
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.4.6';
24
 
25
  // Instnace
26
  protected static $_instance = NULL;
3
  * Plugin Name: myCred
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
+ * Version: 2.4.6.1
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.4.6.1';
24
 
25
  // Instnace
26
  protected static $_instance = NULL;
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mycred,wpexpertsio
3
  Tags: badges, gamification, loyalty, points, rewards
4
  Requires at least: 4.8
5
  Tested up to: 6.0
6
- Stable tag: 2.4.6
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -316,6 +316,9 @@ You can find a list of [frequently asked questions](https://mycred.me/about/faq/
316
 
317
  == Upgrade Notice ==
318
 
 
 
 
319
  = 2.4.6 =
320
  New features and Bug fixes.
321
 
@@ -400,9 +403,12 @@ The banking module have been replaced by Central deposite module, and interest r
400
  * Portuguese (Brazil) - Guilherme
401
  * Japanese - Mochizuki Hiroshi
402
 
403
-
404
  == Changelog ==
405
 
 
 
 
 
406
  = 2.4.6 =
407
  - **NEW** - Added minimum points reminder email notification for central deposit.
408
  - **NEW** - Added points automatically to the central account after the specified interval. (Schedule Deposit)
3
  Tags: badges, gamification, loyalty, points, rewards
4
  Requires at least: 4.8
5
  Tested up to: 6.0
6
+ Stable tag: 2.4.6.1
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
316
 
317
  == Upgrade Notice ==
318
 
319
+ = 2.4.6.1 =
320
+ Bug fixes.
321
+
322
  = 2.4.6 =
323
  New features and Bug fixes.
324
 
403
  * Portuguese (Brazil) - Guilherme
404
  * Japanese - Mochizuki Hiroshi
405
 
 
406
  == Changelog ==
407
 
408
+ = 2.4.6.1 =
409
+ - **FIX** - Badge level requirements not being saved.
410
+ - **FIX** - Badge level requirements appear twice on the badge single page.
411
+
412
  = 2.4.6 =
413
  - **NEW** - Added minimum points reminder email notification for central deposit.
414
  - **NEW** - Added points automatically to the central account after the specified interval. (Schedule Deposit)