myCRED - Version 2.3.1-beta.1

Version Description

= 2.3.1 = Improve license system.

= 2.3 = New features and Bug fixes.

= 2.2 = New features and Bug fixes.

= 2.1.1 = New features and Bug fixes.

= 2.1 = New features and Bug fixes.

= 2.0 = 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.

Download this release

Release Info

Developer wpexpertsio
Plugin Icon 128x128 myCRED
Version 2.3.1-beta.1
Comparing to
See all releases

Code changes from version 2.3 to 2.3.1-beta.1

includes/classes/class.mycred-license.php ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
+
4
+ /**
5
+ * myCRED_License class
6
+ * Used for the addons license and update.
7
+ * @since 2.3
8
+ * @version 1.0
9
+ */
10
+ if ( ! class_exists( 'myCRED_License' ) ) :
11
+ class myCRED_License {
12
+
13
+ // Plugin Version
14
+ private $version;
15
+
16
+ // Plugin Slug
17
+ private $slug;
18
+
19
+ private $base;
20
+
21
+ private $license;
22
+
23
+ private $license_key_name;
24
+
25
+ private $cache_key_name;
26
+
27
+ private $api_base_url;
28
+
29
+ /**
30
+ * Construct
31
+ */
32
+ public function __construct( $data ) {
33
+
34
+ $this->version = $data['version'];
35
+ $this->slug = $data['slug'];
36
+ $this->base = $data['base'];
37
+ $this->filename = plugin_basename( $this->base );
38
+ $this->license_key_name = 'mycred_membership_key';
39
+ $this->transient_key = 'mcl_' . md5( $this->slug );
40
+ $this->api_endpoint = 'https://license.mycred.me/wp-json/license/get-plugins';
41
+
42
+ $this->init();
43
+
44
+ }
45
+
46
+ public function get_plugin_detail( $force = false ) {
47
+
48
+ $plugin_info = get_site_transient( $this->transient_key );
49
+
50
+ if ( false === $plugin_info || $force ) {
51
+
52
+ $plugins_info_remote = $this->get_api_data();
53
+
54
+ foreach ( $plugins_info_remote as $plugin ) {
55
+
56
+ if ( ! empty( $plugin->package ) ) {
57
+
58
+ $plugin->package = add_query_arg(
59
+ array(
60
+ 'license_key' => $this->get_license_key(),
61
+ 'site' => site_url(),
62
+ 'api-key' => md5( get_bloginfo( 'url' ) ),
63
+ 'slug' => $plugin->slug
64
+ ),
65
+ $plugin->package
66
+ );
67
+
68
+ }
69
+
70
+ $transient_key = 'mcl_' . md5( $plugin->slug );
71
+ set_site_transient( $transient_key, $plugin, 5 * HOUR_IN_SECONDS );
72
+
73
+ if ( $plugin->slug == $this->slug )
74
+ $plugin_info = $plugin;
75
+
76
+ }
77
+
78
+ }
79
+
80
+ return $plugin_info;
81
+
82
+ }
83
+
84
+ public function init() {
85
+
86
+ add_filter( 'mycred_license_addons', array( $this, 'register_addon_for_license' ) );
87
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 80 );
88
+ add_filter( 'plugins_api', array( $this, 'plugin_api_call' ), 80, 3 );
89
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_view_info' ), 80, 3 );
90
+
91
+ }
92
+
93
+ public function register_addon_for_license( $addons ) {
94
+
95
+ array_push( $addons, $this->slug );
96
+
97
+ return $addons;
98
+
99
+ }
100
+
101
+ public function check_update( $data ) {
102
+
103
+ $plugin_info = $this->get_plugin_detail();
104
+
105
+ if ( ! empty( $plugin_info ) && ! empty( $plugin_info->new_version ) ) {
106
+
107
+ if ( version_compare( $this->version, $plugin_info->new_version, '<' ) ) {
108
+ $data->response[ $this->filename ] = $plugin_info;
109
+ } else {
110
+ $data->no_update[ $this->filename ] = $plugin_info;
111
+ }
112
+
113
+ }
114
+
115
+ $data->last_checked = time();
116
+ $data->checked[ $this->filename ] = $this->version;
117
+
118
+ return $data;
119
+
120
+ }
121
+
122
+ public function plugin_api_call( $result, $action, $args ) {
123
+
124
+ if ( empty( $args->slug ) || $args->slug != $this->slug )
125
+ return $result;
126
+
127
+ $data = $this->get_plugin_detail();
128
+
129
+ if ( isset( $data->banners ) )
130
+ $data->banners = (array) $data->banners;
131
+
132
+ if ( isset( $data->sections ) ) {
133
+
134
+ if ( ! empty( $data->sections->description ) )
135
+ $data->sections->description = html_entity_decode( $data->sections->description );
136
+
137
+ if ( ! empty( $data->sections->change_log ) )
138
+ $data->sections->change_log = html_entity_decode( $data->sections->change_log );
139
+
140
+ if ( ! empty( $data->sections->installation ) )
141
+ $data->sections->installation = html_entity_decode( $data->sections->installation );
142
+
143
+ $data->sections = (array) $data->sections;
144
+
145
+ }
146
+
147
+ return $data;
148
+
149
+ }
150
+
151
+ public function plugin_view_info( $plugin_meta, $file, $plugin_data ) {
152
+
153
+ if ( $file != plugin_basename( $this->base ) ) return $plugin_meta;
154
+
155
+ $plugin_info = $this->get_plugin_detail();
156
+
157
+ if ( ! empty( $plugin_info ) && ! empty( $plugin_info->new_version ) ) {
158
+
159
+ if ( version_compare( $this->version, $plugin_info->new_version, '<' ) ) {
160
+ $data->response[ $this->filename ] = $plugin_info;
161
+ } else {
162
+ $data->no_update[ $this->filename ] = $plugin_info;
163
+ }
164
+
165
+ }
166
+
167
+ if ( empty( $plugin_info->package ) && empty( $plugin_info->expiry ) ) {
168
+
169
+ $message = 'License not found for this addon.';
170
+
171
+ if ( ! empty( $plugin_info->message ) ) {
172
+ $message = $plugin_info->message;
173
+ }
174
+
175
+ $plugin_meta[] = '<a href="http://mycred.me/about/terms/#product-licenses" style="color:red;" target="_blank"><strong>' . $message . '</strong></a>';
176
+
177
+ }
178
+ else {
179
+
180
+ $plugin_meta[] = '<strong style="color:green;">Your License Expires in ' . $this->calculate_license_expiry( $plugin_info->expiry ) . '</strong>';
181
+
182
+ }
183
+
184
+
185
+ return $plugin_meta;
186
+
187
+ }
188
+
189
+ public function get_mycred_addons() {
190
+
191
+ return apply_filters( 'mycred_license_addons', array() );
192
+
193
+ }
194
+
195
+ public function get_license_key() {
196
+
197
+ return get_option( $this->license_key_name );
198
+
199
+ }
200
+
201
+ public function get_api_data() {
202
+
203
+ $cache_key = 'mycred_license_remote_data';
204
+ $plugins_data = wp_cache_get( $cache_key );
205
+
206
+ if ( false === $plugins_data ) {
207
+
208
+ $plugins_data = new stdClass();
209
+ $license_key = $this->get_license_key();
210
+ $addons = $this->get_mycred_addons();
211
+ $request_args = array(
212
+ 'body' => array(
213
+ 'license_key' => $license_key,
214
+ 'site' => site_url(),
215
+ 'api-key' => md5( get_bloginfo( 'url' ) ),
216
+ 'addons' => $addons
217
+ ),
218
+ 'timeout' => 12
219
+ );
220
+
221
+ // Start checking for an update
222
+ $response = wp_remote_post( $this->api_endpoint, $request_args );
223
+
224
+ if ( ! is_wp_error( $response ) ) {
225
+
226
+ $response_data = json_decode( $response['body'] );
227
+
228
+ if ( ! empty( $response_data->status ) && $response_data->status == 'success' ) {
229
+
230
+ $plugins_data = $response_data->data;
231
+
232
+ }
233
+
234
+ }
235
+
236
+ }
237
+
238
+ wp_cache_set( $cache_key, $plugins_data );
239
+ return $plugins_data;
240
+
241
+ }
242
+
243
+ public function calculate_license_expiry( $expire_date ) {
244
+
245
+ $interval = date_create('now')->diff( date_create( $expire_date ) );
246
+
247
+ $label_y = $interval->y > 1 ? "{$interval->y} years " : ( $interval->y == 1 ? "{$interval->y} year " : '' );
248
+ $label_m = $interval->m > 1 ? "{$interval->m} months " : ( $interval->m == 1 ? "{$interval->m} month " : '' );
249
+ $label_d = $interval->d > 1 ? "{$interval->d} days " : ( $interval->d == 1 ? "{$interval->d} day " : '' );
250
+
251
+ return "{$label_y}{$label_m}{$label_d}";
252
+
253
+ }
254
+
255
+
256
+ }
257
+ endif;
includes/mycred-addons-upgrader.php ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
+
4
+
5
+ if ( ! class_exists( 'myCRED_Addons_Upgrader' ) ) :
6
+ Class myCRED_Addons_Upgrader {
7
+
8
+ /**
9
+ * Construct
10
+ */
11
+ public function __construct() {
12
+
13
+ add_action( 'admin_menu', array( $this, 'mycred_upgrader_menu' ) );
14
+ add_action( 'admin_notices', array( $this, 'mycred_update_notice') );
15
+ add_action( 'admin_init', array( $this, 'admin_init') );
16
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'update_transient' ), 99 );
17
+ add_filter( 'update_bulk_plugins_complete_actions', array( $this, 'update_actions' ), 99, 2 );
18
+
19
+ }
20
+
21
+ /**
22
+ * Register upgrader menu
23
+ */
24
+ public function mycred_upgrader_menu() {
25
+
26
+ add_submenu_page(
27
+ 'options.php',
28
+ 'Update',
29
+ 'Update',
30
+ 'manage_options',
31
+ 'mycred-update',
32
+ array( $this, 'mycred_addons_update' )
33
+ );
34
+
35
+ }
36
+
37
+ public function mycred_update_notice() {
38
+
39
+ $is_upgrade_done = get_option( 'mycred_addons_upgrade' );
40
+
41
+ if ( false === $is_upgrade_done ) :?>
42
+ <div class="notice notice-warning is-dismissible">
43
+ <h2 style="margin-bottom: 8px;">myCred Addons Update Required</h2>
44
+ <p style="margin-bottom: 8px;">We have launched myCred version 2.3.1. For your addons to run smoothly, you need to update your myCred addons now! We have also upgraded our license management system to make sure your addons work perfectly after the required update. <br /><a href="https://mycred.me/blog/why-do-you-need-to-update-your-mycred-addons/" target="_blank">Why am I seeing this notice?</a></p>
45
+ <a href="<?php echo admin_url('options.php?page=mycred-update'); ?>" class="button button-primary button-large">Update Addons Now</a>
46
+ <a class="button button-large" href="<?php echo add_query_arg( 'mycred_addons_upgrader', 'mycred-addons-updated', home_url( $_SERVER['REQUEST_URI'] ) ) ?>">I have already updated</a>
47
+ <br>
48
+ <br>
49
+ </div>
50
+ <?php endif;
51
+ }
52
+
53
+ public function admin_init() {
54
+
55
+ global $pagenow;
56
+ if ( $pagenow == 'options.php' && isset( $_GET['page'] ) && $_GET['page'] == 'mycred-update' ) {
57
+ remove_all_actions( 'admin_notices' );
58
+ }
59
+
60
+ if ( isset( $_GET['mycred_addons_upgrader'] ) && $_GET['mycred_addons_upgrader'] == 'mycred-addons-updated' ) {
61
+
62
+ update_option( 'mycred_addons_upgrade', 'done' );
63
+ wp_redirect( remove_query_arg( 'mycred_addons_upgrader', home_url( $_SERVER['REQUEST_URI'] ) ) );
64
+
65
+ }
66
+
67
+ }
68
+
69
+ public function update_transient( $data ) {
70
+
71
+ if ( empty( $data->checked ) ) return $data;
72
+
73
+ if ( isset( $_GET['mautype'] ) && isset( $_GET['plugins'] ) ) {
74
+
75
+ $addons = explode( ',', $_GET['plugins'] );
76
+
77
+ if ( ! empty( $addons ) && is_array( $addons ) ) {
78
+
79
+ $all_installed_plugins = get_plugins();
80
+ $mycred_installed_addons = $this->get_installed_mycred_addons( $all_installed_plugins );
81
+ $mycred_addons_detail = (array) $this->get_addons_detail( $mycred_installed_addons );
82
+
83
+ foreach ( $addons as $key => $addon ) {
84
+
85
+ $addon_slug = explode( '/', $addon );
86
+
87
+ if ( ! empty( $addon_slug[0] ) && ! empty( $mycred_addons_detail[ $addon_slug[0] ] ) ) {
88
+
89
+ $data->response[ $addon ] = $mycred_addons_detail[ $addon_slug[0] ];
90
+
91
+ if ( ! empty( $data->response[ $addon ]->package ) ) {
92
+
93
+ $data->response[ $addon ]->package = add_query_arg(
94
+ array(
95
+ 'site' => site_url(),
96
+ 'api-key' => md5( get_bloginfo( 'url' ) ),
97
+ 'slug' => $data->response[ $addon ]->slug
98
+ ),
99
+ $data->response[ $addon ]->package
100
+ );
101
+
102
+ $data->no_update[ $addon ] = $data->response[ $addon ];
103
+
104
+ }
105
+
106
+ }
107
+
108
+ }
109
+
110
+ }
111
+
112
+ }
113
+
114
+ return $data;
115
+ }
116
+
117
+ public function update_actions( $update_actions, $plugin_info ) {
118
+
119
+ if ( isset( $_GET['mautype'] ) && $_GET['mautype'] == true ) {
120
+
121
+ $update_actions['plugins_page'] = sprintf(
122
+ '<a href="%s" target="_parent">%s</a>',
123
+ self_admin_url( 'options.php?page=mycred-update' ),
124
+ __( 'Go to myCred Addons Update page' )
125
+ );
126
+
127
+ $update_actions['updates_page'] = sprintf(
128
+ '<a href="%s" target="_parent">%s</a>',
129
+ self_admin_url( 'plugins.php' ),
130
+ __( 'Go to Plugins page' )
131
+ );
132
+
133
+ }
134
+
135
+ update_option( 'mycred_addons_upgrade', 'done' );
136
+
137
+ return $update_actions;
138
+
139
+ }
140
+
141
+
142
+ public function mycred_addons_update() {
143
+
144
+ $all_installed_plugins = get_plugins();
145
+ $mycred_installed_addons = $this->get_installed_mycred_addons( $all_installed_plugins );
146
+ $mycred_addons_detail = (array) $this->get_addons_detail( $mycred_installed_addons );
147
+
148
+ if ( isset( $_POST['mycred_addons_update'] ) ) {
149
+
150
+ delete_site_transient('update_plugins');
151
+
152
+ $title = __( 'myCred Addons Update' );
153
+
154
+ wp_enqueue_script( 'updates' );
155
+ $url = self_admin_url( 'update.php?action=update-selected&amp;mautype=true&amp;plugins=' . urlencode( implode( ',', $_POST['mycred_addons_update'] ) ) );
156
+ $url = wp_nonce_url( $url, 'bulk-update-plugins' );
157
+
158
+ ?>
159
+ <div class="wrap">
160
+ <h1><?php echo esc_html( $title ); ?></h1>
161
+ <div class="notice notice-warning">
162
+ <h2 id="mycred-addons-update-msg-title">Please wait for a while! <span class="is-active spinner" style="margin:-6px 10px 0;float: none;"></span></h2>
163
+ <p>After updating addons, you are required to get a new license key from myCred.me (Dashboard).</p>
164
+ <p><span style="color:#d63638;font-weight: bold;">Note:</span> If you're facing issues while updating your addons, you can manually update them from <a href="https://mycred.me/redirect-to-membership/" target="_blank">myCred.me (Dashboard).</a><br /><a href="https://mycred.me/blog/why-do-you-need-to-update-your-mycred-addons/" target="_blank">Why am I seeing this notice?</a></p>
165
+ <a href="https://mycred.me/redirect-to-membership/" target="_blank" class="button button-primary button-large">Get your Updated License Key</a>
166
+ <br>
167
+ <br>
168
+ </div>
169
+ <iframe id="mycred-addons-update-frame" src="<?php echo $url; ?>" style="width: 100%; height:100%; min-height:850px;"></iframe>
170
+ </div>
171
+ <script type="text/javascript">
172
+
173
+ jQuery('#mycred-addons-update-frame').on('load', function(){
174
+ jQuery('#mycred-addons-update-msg-title').hide();
175
+ });
176
+
177
+ </script>
178
+ <?php
179
+ }
180
+ else { ?>
181
+ <div class="wrap">
182
+ <h1>myCred Addons Update</h1>
183
+ <form method="post" name="upgrade-plugins" class="upgrade">
184
+ <p>
185
+ <input id="upgrade-plugins" class="button" type="submit" value="Update Plugins" name="upgrade">
186
+ </p>
187
+ <table class="widefat updates-table" id="update-plugins-table">
188
+ <thead>
189
+ <tr>
190
+ <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all"></td>
191
+ <td class="manage-column"><label for="plugins-select-all">Select All</label></td>
192
+ </tr>
193
+ </thead>
194
+ <tbody class="plugins">
195
+ <?php
196
+
197
+ $count = 0;
198
+
199
+ foreach ( $mycred_installed_addons as $key => $value ) :
200
+
201
+ $addon_slug = explode( '/', $value );
202
+
203
+ if ( ! isset( $mycred_addons_detail[ $addon_slug[0] ] ) ) continue;
204
+
205
+ $addon = $mycred_addons_detail[ $addon_slug[0] ];
206
+
207
+ if ( version_compare( $all_installed_plugins[ $value ]['Version'], $addon->new_version, '>=' ) ) continue;
208
+
209
+ $count++;
210
+
211
+ ?>
212
+ <tr>
213
+ <td class="check-column">
214
+ <input type="checkbox" name="mycred_addons_update[]" id="checkbox_<?php echo $addon_slug[0]; ?>" value="<?php echo $value; ?>">
215
+ <label for="checkbox_<?php echo $addon_slug[0]; ?>" class="screen-reader-text">Select myCred</label>
216
+ </td>
217
+ <td class="plugin-title">
218
+ <p>
219
+ <img src="https://mycred.me/wp-content/uploads/2013/02/mycred-token-icon-100x100.png" alt="">
220
+ <strong><?php echo $addon->name; ?></strong> You have version <?php echo $all_installed_plugins[ $value ]['Version']; ?> installed. Update to <?php echo $addon->new_version ?>.
221
+ <br>Compatibility with WordPress <?php echo $addon->tested ?>: 100% (according to its author)<br>Improved license system.
222
+ </p>
223
+ </td>
224
+ </tr>
225
+ <?php endforeach; ?>
226
+ <?php if ( $count == 0 ): ?>
227
+ <tr>
228
+ <td colspan="2">Empty</td>
229
+ </tr>
230
+ <?php endif ?>
231
+ </tbody>
232
+ <tfoot>
233
+ <tr>
234
+ <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2"></td>
235
+ <td class="manage-column"><label for="plugins-select-all-2">Select All</label></td>
236
+ </tr>
237
+ </tfoot>
238
+ </table>
239
+ <p>
240
+ <input id="upgrade-plugins-2" class="button" type="submit" value="Update Plugins" name="upgrade">
241
+ </p>
242
+ </form>
243
+ </div>
244
+ <?php
245
+ }
246
+
247
+ }
248
+
249
+ public function get_installed_mycred_addons( $installed_plugins ) {
250
+
251
+ $mycred_addons = array(
252
+ 'mycred-2co/mycred-2co.php',
253
+ 'mycred-coinbase/mycred-coinbase.php',
254
+ 'mycred-coinpayment/mycred-coinpayment.php',
255
+ 'mycred-compropago/mycred-compropago.php',
256
+ 'mycred-payfast/mycred-payfast.php',
257
+ 'mycred-paymentwall/mycred-paymentwall.php',
258
+ 'mycred-payza/mycred-payza.php',
259
+ 'mycred-robokassa/mycred-robokassa.php',
260
+ 'mycred-stripe/mycred-stripe.php',
261
+ 'mycred-wepay/mycred-wepay.php',
262
+ 'mycred-cashcred-paypal/mycred-cashcred-paypal.php',
263
+ 'mycred-cashcred-stripe/mycred-cashcred-stripe.php',
264
+ 'mycred-anniversary-pro/mycred-anniversary-pro.php',
265
+ 'mycred-birthday-plus/myCred-birthday-plus.php',
266
+ 'mycred-bp-charges/mycred-bp-charges.php',
267
+ 'mycred-cashcred-paystack/mycred-cashcred-paystack.php',
268
+ 'mycred-coupons-plus/mycred-coupons-plus.php',
269
+ 'mycred-daily-login-rewards/mycred-daily-login-rewards.php',
270
+ 'mycred-dokan/mycred-dokan.php',
271
+ 'mycred-email-digest/mycred-email-digest.php',
272
+ 'mycred-expiration-addon/mycred-expiration-addon.php',
273
+ 'mycred-beaver-builder/mycred-beaver-builder.php',
274
+ 'mycred-userpro/mycred-userpro.php',
275
+ 'mycred-usersultra/mycred-usersultra.php',
276
+ 'mycred-vc/mycred-vc.php',
277
+ 'mycred-gateway-edd/mycred-gateway-edd.php',
278
+ 'mycred-gateway-jigoshop/mycred-gateway-jigoshop.php',
279
+ 'mycred-gateway-fundraising/mycred-gateway-fundraising.php',
280
+ 'mycred-level-cred/mycred-level-cred.php',
281
+ 'mycred-notice-plus/mycred-notice-plus.php',
282
+ 'mycred-pacman/mycred-pacman.php',
283
+ 'mycred-paystack/mycred-paystack.php',
284
+ 'mycred-points-cap/mycred-points-cap.php',
285
+ 'mycred-progress-bar/mycred-progress-bar.php',
286
+ 'mycred-progress-map/mycred-progress-map.php',
287
+ 'mycred-reset-points/mycred-reset-points.php',
288
+ 'mycred-rest/mycred-rest.php',
289
+ 'mycred-sms-payments/mycred-sms-payments.php',
290
+ 'mycred-social-proof/mycred-social-proof.php',
291
+ 'mycred-social-shares/mycred-social-shares.php',
292
+ 'mycred-transfer-plus/mycred-transfer-plus.php',
293
+ 'mycred-videos/mycred-videos.php',
294
+ 'mycred-jwplayer/mycred-jwplayer.php',
295
+ 'mycred-wc-vendor/mycred-wc-vendors-addon.php',
296
+ 'mycred-wheel-of-fortune/mycred-wheel-of-fortune.php',
297
+ 'mycred-woocommerce-plus/mycred-woocommerce-plus.php',
298
+ 'mycred-zapier/mycred-zapier.php'
299
+ );
300
+
301
+ return array_intersect( $mycred_addons, array_keys( $installed_plugins ) );
302
+
303
+ }
304
+
305
+ public function get_addons_detail( $installed_addons ) {
306
+
307
+ $transient_key = md5( implode( ",", $installed_addons ) );
308
+ $plugins_data = get_site_transient( $transient_key );
309
+
310
+ if ( false === $plugins_data ) {
311
+
312
+ $addons = array();
313
+
314
+ foreach ( $installed_addons as $key => $addon ) {
315
+
316
+ $addon_file = explode( '/', $addon );
317
+
318
+ if ( ! empty( $addon_file[0] ) ) array_push( $addons, $addon_file[0] );
319
+
320
+ }
321
+
322
+ $plugins_data = new stdClass();
323
+ $request_args = array(
324
+ 'body' => array(
325
+ 'site' => site_url(),
326
+ 'api-key' => md5( get_bloginfo( 'url' ) ),
327
+ 'addons' => $addons
328
+ ),
329
+ 'timeout' => 12
330
+ );
331
+
332
+ // Start checking for an update
333
+ $response = wp_remote_post( 'https://license.mycred.me/wp-json/license/get-new-plugins', $request_args );
334
+
335
+ if ( ! is_wp_error( $response ) ) {
336
+
337
+ $response_data = json_decode( $response['body'] );
338
+
339
+ if ( ! empty( $response_data->status ) && $response_data->status == 'success' ) {
340
+
341
+ $plugins_data = $response_data->data;
342
+ set_site_transient( $transient_key, $plugins_data, 5 * HOUR_IN_SECONDS );
343
+
344
+ }
345
+
346
+ }
347
+
348
+ }
349
+
350
+ return $plugins_data;
351
+
352
+ }
353
+
354
+ }
355
+ endif;
356
+
357
+ new myCRED_Addons_Upgrader();
membership/mycred-connect-membership.php CHANGED
@@ -18,16 +18,16 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
18
  * Construct
19
  */
20
  public function __construct() {
21
- add_action( 'admin_menu', array( $this, 'mycred_membership_menu' ) );
22
- add_action( 'admin_menu', array( $this, 'mycred_treasures' ) );
23
- add_action( 'admin_menu', array( $this, 'mycred_support' ) );
24
- add_action( 'admin_init', array( $this, 'add_styles' ) );
25
- add_action( 'mycred_admin_init', array( $this, 'membership_addon_actions' ) );
26
 
27
- add_filter( 'admin_footer_text', array( $this,'mycred_admin_footer_text') );
 
 
 
 
 
28
  }
29
 
30
- function add_styles() {
31
 
32
  wp_register_style('admin-subscription-css', plugins_url( 'assets/css/admin-subscription.css', myCRED_THIS ), array(), '1.2', 'all');
33
 
@@ -44,27 +44,30 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
44
  }
45
 
46
  wp_enqueue_style('admin-subscription-css');
 
47
  }
48
 
49
- function mycred_admin_footer_text($footer_text) {
 
50
  global $typenow;
51
 
52
  if( isset($_GET['page']) && $_GET['page'] == 'mycred-support' ) {
53
 
54
- $mycred_footer_text = sprintf( __( 'Thank you for being a <a href="%1$s" target="_blank">myCred </a>user! Please give your <a href="%2$s" target="_blank">%3$s</a> rating on WordPress.org', 'mycred' ),
55
- 'https://mycred.me',
56
- 'https://wordpress.org/support/plugin/mycred/reviews/?rate=5#new-post',
57
- '&#9733;&#9733;&#9733;&#9733;&#9733;'
58
- );
59
 
60
  return str_replace( '</span>', '', $footer_text ) . ' | ' . $mycred_footer_text . '</span>';
61
 
62
  }
63
  else {
64
 
65
- return $footer_text;
 
 
66
 
67
- }
68
  }
69
 
70
  /**
@@ -72,8 +75,8 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
72
  */
73
  public function mycred_membership_menu() {
74
  mycred_add_main_submenu(
75
- 'Membership',
76
- 'Membership',
77
  'manage_options',
78
  'mycred-membership',
79
  array( $this, 'mycred_membership_callback' )
@@ -135,6 +138,10 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
135
 
136
  <h2>Customization:</h2>
137
  <p>If you need to build a custom feature, simply <a href="https://objectsws.atlassian.net/servicedesk/customer/portal/11/create/92">submit a request</a> on our myCred website.</p>
 
 
 
 
138
 
139
  </div>
140
 
@@ -251,39 +258,36 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
251
  $membership_key = '';
252
  ?>
253
  <div class="wrap">
254
- <h1><?php _e( 'myCred Membership Club', 'mycred' ); ?></h1>
255
  <div class="mmc_welcome">
256
  <div class="mmc_welcome_content">
257
- <div class="mmc_title"><?php _e( 'Welcome to myCred Membership Club', 'mycred' ); ?></div>
258
  <form action="#" method="post">
259
  <?php
260
- if(mycred_is_membership_active()) {
261
  echo '<span class="dashicons dashicons-yes-alt membership-license-activated"></span>';
262
- } else if(!mycred_is_membership_active() && !empty(mycred_get_membership_key())){
 
263
  // if membership is not active in current site and the membership key is entered
264
  echo '<span class="dashicons dashicons-dismiss membership-license-inactive"></span>';
265
  }
266
 
267
 
268
- ?>
269
 
270
- <input type="text" name="mmc_lincense_key" class="mmc_lincense_key" placeholder="<?php _e( 'Add Your Membership License', 'mycred' ); ?>" value="<?php echo $membership_key?>">
271
  <input type="submit" class="mmc_save_license button-primary" value="Save"/>
272
- <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>
 
 
 
 
 
273
  </form>
274
  </div>
275
 
276
  </div>
277
 
278
- <?php
279
- if(mycred_is_membership_active()){
280
- $this->mycred_display_membership_addons();
281
- }
282
- else{
283
- $this->mycred_display_membership_table();
284
- }
285
-
286
- ?>
287
  </div>
288
  <?php
289
  }
@@ -297,628 +301,26 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
297
 
298
  $license_key = sanitize_text_field( $_POST['mmc_lincense_key'] );
299
  if( isset( $license_key ) ) {
300
- update_option( 'mycred_membership_key', $license_key );
301
- }
302
- }
303
-
304
- public function mycred_display_membership_table(){
305
-
306
-
307
- $membership_plans = $this->membership_get_plans();
308
-
309
- if(!empty($membership_plans) && ! isset( $addons['code'])){
310
- ?>
311
- <script>
312
- jQuery(document).ready(function () {
313
- jQuery("span.slider_btn.round").click(function(){
314
- jQuery(".show_one_year").toggleClass("active_pkg");
315
- jQuery(".show_three_year").toggleClass("active_pkg");
316
- });
317
-
318
- jQuery("span.slider_btn.round").click(function(){
319
- jQuery(".three_year").toggleClass("show_cont");
320
- jQuery(".one_year").toggleClass("hide");
321
- jQuery(".three_year").toggleClass("hide");
322
- jQuery(".one_year").toggleClass("hide_cont");
323
- jQuery(".one_year").toggleClass("show_cont");
324
- });
325
-
326
- jQuery(".show_three_year").click(function(){
327
- jQuery(".switch_btn input").prop("checked", true);
328
- jQuery(".show_one_year").removeClass("active_pkg");
329
- jQuery(".show_three_year").addClass("active_pkg");
330
- jQuery("div.three_year").addClass("show_cont");
331
- jQuery("span.three_year").addClass("show_cont");
332
- jQuery(".one_year").addClass("hide");
333
- jQuery(".three_year").removeClass("hide");
334
- jQuery("div.one_year").addClass("hide_cont");
335
- });
336
- jQuery(".show_one_year").click(function(){
337
- jQuery(".switch_btn input").prop("checked", false);
338
- jQuery(".show_one_year").addClass("active_pkg");
339
- jQuery(".show_three_year").removeClass("active_pkg");
340
-
341
- jQuery("div.three_year").removeClass("show_cont");
342
- jQuery("span.three_year").removeClass("show_cont");
343
- jQuery(".one_year").removeClass("hide");
344
- jQuery(".three_year").addClass("hide");
345
- jQuery("div.one_year").removeClass("hide_cont");
346
-
347
- });
348
- });
349
- </script>
350
- <div class="mmc_table row">
351
- <div class="col-lg-12">
352
- <div id="tabs_package_1">
353
- <div class="radio_btns_pkg">
354
- <a href="javascript:void(0);" class="show_one_year active_pkg">One Year Package</a>
355
- <label class="switch_btn">
356
- <input type="checkbox">
357
- <span class="slider_btn round"></span>
358
- </label>
359
- <a href="javascript:void(0);" class="show_three_year">Three Years Package <sup>With Discount</sup></a>
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">
368
- <p class="mmc_table_pricing_worth one_year">Worth $10000+</p>
369
- <p class="mmc_table_pricing_current one_year"><span class="mmc_table_pricing_dollar_sign">$</span><?php echo $membership_plans[52250]['price']; ?></p>
370
- <p class="mmc_table_pricing_worth three_year">Worth $30000+</p>
371
- <p class="mmc_table_pricing_current three_year"><span class="mmc_table_pricing_dollar_sign">$</span><?php echo $membership_plans[54091]['price']; ?></p>
372
- </div>
373
- <div class="mmc_table_plan_details">
374
- <p class="mmc_table_plan_sites">unlimited sites</p>
375
- <p class="mmc_table_plan_billed one_year">billed yearly until cancelled</p>
376
- <p class="mmc_table_plan_billed three_year">billed 3 years until cancelled</p>
377
- </div>
378
- <div class="mmc_table_addon_details">
379
- <ul>
380
- <li>All Enhancement addons</li>
381
- <li>All integrations</li>
382
- <li>Store Gateway addons</li>
383
- <li>Gamification Addons</li>
384
- </ul>
385
- </div>
386
- <div class="mmc_table_get_started">
387
- <a href="https://www.mycred.me/cart/?add-to-cart=52249&variation_id=52250" target="_blank" class="one_year"> <?php _e( 'Get Started', 'mycred' ); ?></a>
388
- <a href="https://www.mycred.me/cart/?add-to-cart=52249&variation_id=54091" target="_blank" class="three_year"> <?php _e( 'Get Started', 'mycred' ); ?></a>
389
- </div>
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">
397
- <p class="mmc_table_pricing_worth one_year">Worth $5000+</p>
398
- <p class="mmc_table_pricing_current one_year"><span class="mmc_table_pricing_dollar_sign">$</span><?php echo $membership_plans[52251]['price']; ?></p>
399
- <p class="mmc_table_pricing_worth three_year">Worth $15000+</p>
400
- <p class="mmc_table_pricing_current three_year"><span class="mmc_table_pricing_dollar_sign">$</span><?php echo $membership_plans[54089]['price']; ?></p>
401
- </div>
402
- <div class="mmc_table_plan_details">
403
- <p class="mmc_table_plan_sites">upto 5 sites</p>
404
- <p class="mmc_table_plan_billed one_year">billed yearly until cancelled</p>
405
- <p class="mmc_table_plan_billed three_year">billed 3 years until cancelled</p>
406
- </div>
407
- <div class="mmc_table_addon_details">
408
- <ul>
409
- <li>All Enhancement addons</li>
410
- <li>All integrations</li>
411
- <li>Store Gateway addons</li>
412
- <li>Gamification Addons</li>
413
- </ul>
414
- </div>
415
- <div class="mmc_table_get_started">
416
- <a href="https://www.mycred.me/cart/?add-to-cart=52249&variation_id=52251" target="_blank" class="one_year"> <?php _e( 'Get Started', 'mycred' ); ?></a>
417
- <a href="https://www.mycred.me/cart/?add-to-cart=52249&variation_id=54089" target="_blank" class="three_year"> <?php _e( 'Get Started', 'mycred' ); ?></a>
418
- </div>
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
-
426
- <div class="mmc_table_pricing">
427
- <p class="mmc_table_pricing_worth one_year">Worth $2000+</p>
428
- <p class="mmc_table_pricing_current one_year"><span class="mmc_table_pricing_dollar_sign">$</span><?php echo $membership_plans[52496]['price']; ?></p>
429
- <p class="mmc_table_pricing_worth three_year">Worth $6000+</p>
430
- <p class="mmc_table_pricing_current three_year"><span class="mmc_table_pricing_dollar_sign">$</span><?php echo $membership_plans[54090]['price']; ?></p>
431
- </div>
432
- <div class="mmc_table_plan_details">
433
- <p class="mmc_table_plan_sites">3 sites</p>
434
- <p class="mmc_table_plan_billed one_year">billed yearly until cancelled</p>
435
- <p class="mmc_table_plan_billed three_year">billed 3 years until cancelled</p>
436
- </div>
437
- <div class="mmc_table_addon_details">
438
- <ul>
439
- <li>All Enhancement addons</li>
440
- <li>All integrations</li>
441
- <li>Store Gateway addons</li>
442
- <li>Gamification Addons</li>
443
- </ul>
444
- </div>
445
- <div class="mmc_table_get_started">
446
- <a href="https://www.mycred.me/cart/?add-to-cart=52249&variation_id=52496" class="one_year" target="_blank"> <?php _e( 'Get Started', 'mycred' ); ?></a>
447
- <a href="https://www.mycred.me/cart/?add-to-cart=52249&variation_id=54090" class="three_year" target="_blank"> <?php _e( 'Get Started', 'mycred' ); ?></a>
448
- </div>
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">
456
- <p class="mmc_table_pricing_worth one_year">Worth $500+</p>
457
- <p class="mmc_table_pricing_current one_year"><span class="mmc_table_pricing_dollar_sign">$</span><?php echo $membership_plans[52495]['price']; ?></p>
458
- <p class="mmc_table_pricing_worth three_year">Worth $1500+</p>
459
- <p class="mmc_table_pricing_current three_year"><span class="mmc_table_pricing_dollar_sign">$</span><?php echo $membership_plans[54088]['price']; ?></p>
460
- </div>
461
- <div class="mmc_table_plan_details">
462
- <p class="mmc_table_plan_sites">1 site</p>
463
- <p class="mmc_table_plan_billed one_year">billed yearly until cancelled</p>
464
- <p class="mmc_table_plan_billed three_year">billed 3 years until cancelled</p>
465
- </div>
466
- <div class="mmc_table_addon_details">
467
- <ul>
468
- <li>Basic enhancement addons</li>
469
- <li>Basic Integrations</li>
470
- <li>-</li>
471
- <li>-</li>
472
- </ul>
473
- </div>
474
- <div class="mmc_table_get_started">
475
- <a href="https://www.mycred.me/cart/?add-to-cart=52249&variation_id=52495" target="_blank" class="one_year"> <?php _e( 'Get Started', 'mycred' ); ?></a>
476
- <a href="https://www.mycred.me/cart/?add-to-cart=52249&variation_id=54088" target="_blank" class="three_year"> <?php _e( 'Get Started', 'mycred' ); ?></a>
477
- </div>
478
- </div>
479
- <div class="col-lg-1 col-md-1 hidden-sm hidden-xs"></div>
480
- </div>
481
- </div>
482
- <?php
483
- }
484
- }
485
-
486
- public function mycred_display_membership_addons(){
487
-
488
- $addons = $this->get_membership_addons();
489
- ?>
490
- <style type="text/css">
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
-
497
-
498
-
499
- .theme.active:hover {
500
- background: #f0f0f1 !important;
501
- color: #3c434a !important;
502
- }
503
-
504
-
505
- #myCRED-wrap > h1 { margin-bottom: 15px; }
506
- .theme-browser .theme:focus, .theme-browser .theme:hover { cursor: default !important; }
507
- .theme-browser .theme:hover .more-details { opacity: 1; }
508
- .theme-browser .theme:hover a.more-details, .theme-browser .theme:hover a.more-details:hover { text-decoration: none; }
509
- .mycred-addons-switch {
510
- position: relative;
511
- display: inline-block;
512
- width: 60px;
513
- height: 34px;
514
- }
515
-
516
- /* Hide default HTML checkbox */
517
- .mycred-addons-switch input {
518
- opacity: 0;
519
- width: 0;
520
- height: 0;
521
- }
522
-
523
- /* The slider */
524
- .slider {
525
- position: absolute;
526
- cursor: pointer;
527
- top: 0;
528
- left: 0;
529
- right: 0;
530
- bottom: 0;
531
- background-color: #ccc;
532
- -webkit-transition: .4s;
533
- transition: .4s;
534
- }
535
-
536
- .slider:before {
537
- position: absolute;
538
- content: "";
539
- height: 26px;
540
- width: 26px;
541
- left: 4px;
542
- bottom: 4px;
543
- background-color: white;
544
- -webkit-transition: .4s;
545
- transition: .4s;
546
- }
547
-
548
- input:checked + .slider {
549
- background-color: lightgreen;
550
- }
551
-
552
- input:focus + .slider {
553
- box-shadow: 0 0 1px lightgreen;
554
- }
555
-
556
- input:checked + .slider:before {
557
- -webkit-transform: translateX(26px);
558
- -ms-transform: translateX(26px);
559
- transform: translateX(26px);
560
- }
561
-
562
- /* Rounded sliders */
563
- .slider.round {
564
- border-radius: 34px;
565
- }
566
-
567
- .slider.round:before {
568
- border-radius: 50%;
569
- }
570
-
571
- .myCRED-addon-heading {
572
- float: left;
573
- }
574
-
575
- .mycred-addon-switch {
576
- float: right;
577
- }
578
-
579
- p.mycred-activate {
580
- float: left;
581
- margin: 7px 7px 0px 0px;
582
- }
583
- .clear{
584
- clear: both;
585
- }
586
- .mycred-addon-outer {
587
- padding: 10px 0;
588
- }
589
-
590
-
591
-
592
-
593
- </style>
594
- <div class="theme-browser mmc-addons" >
595
- <?php
596
-
597
- // Messages
598
- if ( isset( $_GET['success'] ) ) {
599
-
600
- if ( $_GET['success'] == 1 ){
601
-
602
- if( $_GET['addon_action'] == 'activate' ){
603
-
604
- echo '<div id="message" class="updated"><p>' . __( 'Add-on Activated', 'mycred' ) . '</p></div>';
605
-
606
- } else if ( $_GET['addon_action'] == 'deactivate' ){
607
-
608
- echo '<div id="message" class="updated"><p>' . __( 'Add-on Deactivated', 'mycred' ) . '</p></div>';
609
-
610
- } else if ( $_GET['addon_action'] == 'install' ){
611
 
612
- echo '<div id="message" class="updated"><p>' . __( 'Add-on Installed', 'mycred' ) . '</p></div>';
613
-
614
- }
615
-
616
- }
617
-
618
-
619
- elseif ( $_GET['success'] == 0 ){
620
- echo '<div id="message" class="error"><p>' . __( 'Could Not Perform Desired Action', 'mycred' ) . '</p></div>';
621
- }
622
-
623
-
624
- }
625
-
626
- ?>
627
- <div class="themes">
628
- <?php
629
-
630
- // Loop though addons
631
- if ( ! empty( $addons ) && ! isset( $addons['code']) ) {
632
-
633
- foreach ( $addons as $addon ) {
634
-
635
- $screenshot = '';
636
- if(isset($addon['addon_image']) && !empty($addon['addon_image'])){
637
- $screenshot = $addon['addon_image'];
638
- }
639
-
640
- $addon_url = '';
641
- if(isset($addon['addon_image']) && !empty($addon['addon_url'])){
642
- $addon_url = $addon['addon_url'];
643
- }
644
-
645
- $aria_action = esc_attr( $addon['slug'] . '-action' );
646
- $aria_name = esc_attr( $addon['slug'] . '-name' );
647
-
648
- ?>
649
- <div class="theme<?php if ( $this->is_addon_active( $addon['folder'] ) ) echo ' active'; else echo ' inactive'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>">
650
-
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 : ?>
660
-
661
- <div class="theme-screenshot blank"></div>
662
-
663
- <?php endif; ?>
664
-
665
- <a class="more-details" id="<?php echo $aria_action; ?>" href="<?php echo $addon_url; ?>" target="_blank"><?php _e( 'Documentation', 'mycred' ); ?></a>
666
-
667
- <div class="theme-id-container">
668
-
669
- <?php if ( $this->is_addon_active( $addon['folder'] ) ) : ?>
670
-
671
- <h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $addon['name']; ?></h2>
672
-
673
- <?php else : ?>
674
-
675
- <h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $addon['name']; ?></h2>
676
-
677
- <?php endif; ?>
678
-
679
- <div class="theme-actions">
680
-
681
- <?php echo $this->activate_deactivate_install( $addon['folder'] ); ?>
682
-
683
- </div>
684
-
685
- </div>
686
-
687
- </div>
688
- <?php
689
-
690
- }
691
-
692
- }
693
-
694
- ?>
695
- <br class="clear">
696
- </div>
697
- </div>
698
- <?php
699
- }
700
-
701
- public function get_membership_addons() {
702
-
703
- $membership_details = mycred_get_membership_details(true);
704
- $addons = array();
705
 
706
- if(isset($membership_details['addons']) && !empty($membership_details['addons'])){
707
- $addons = $membership_details['addons'];
708
  }
709
 
710
- return $addons;
711
-
712
  }
713
-
714
- public function is_addon_active($addon_folder_name) {
715
-
716
- $active_plugins = get_option('active_plugins');
717
-
718
- foreach($active_plugins as $active_plugin){
719
- $arr = explode("/", $active_plugin, 2);
720
-
721
- if($addon_folder_name == $arr[0]){
722
- return true;
723
- }
724
- }
725
- return false;
726
- }
727
-
728
- public function is_addon_installed($addon_folder_name) {
729
- $installed_plugins = get_plugins();
730
-
731
- foreach($installed_plugins as $folder_name => $installed_plugin){
732
- $arr = explode("/", $folder_name, 2);
733
-
734
- if($addon_folder_name == $arr[0]){
735
- return true;
736
- }
737
- }
738
- return false;
739
- }
740
-
741
- public function is_addon_network_active($addon_folder_name){
742
 
743
- $network_active_plugins = get_site_option('active_sitewide_plugins'); // Network activated plugins
744
-
745
- foreach($network_active_plugins as $network_active_plugin => $timestamp){
746
- $arr = explode("/", $network_active_plugin, 2);
747
-
748
- if($addon_folder_name == $arr[0]){
749
- return true;
750
- }
751
- }
752
- return false;
753
- }
754
-
755
- public function activate_deactivate_install( $addon_folder = NULL ) {
756
-
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 )){
764
-
765
- $link_url = "";
766
- $link_text = __( 'Network Active', 'mycred' );
767
- $network_active = true;
768
-
769
- } else if ( $this->is_addon_active( $addon_folder ) ) {
770
-
771
- $link_url = $this->get_membership_addon_action_url( $addon_folder, 'deactivate' );
772
- $link_text = __( 'Deactivate', 'mycred' );
773
-
774
- } else if($this->is_addon_installed( $addon_folder )){
775
-
776
- $link_url = $this->get_membership_addon_action_url( $addon_folder, 'activate' );
777
- $link_text = __( 'Activate', 'mycred' );
778
-
779
- }
780
-
781
- return '<a href="' . esc_url_raw( $link_url ) . '" title="' . esc_attr( $link_text ) . '" class="button button-primary mycred-action ' . esc_attr( $addon_folder ) . ' ' . ($network_active ? 'mycred-addon-network-active' : '') . '">' . esc_html( $link_text ) . '</a>';
782
-
783
- }
784
-
785
-
786
- function get_membership_addon_action_url( $addon_folder = NULL, $action = false ) {
787
-
788
- if ( $addon_folder === NULL || $action === false ) return '#';
789
-
790
- $args = array(
791
- 'page' => MYCRED_SLUG . '-membership',
792
- 'addon_folder' => $addon_folder,
793
- 'addon_action' => $action,
794
- '_token' => wp_create_nonce( 'mycred-membership-addon-action' )
795
- );
796
-
797
- return esc_url( add_query_arg( $args, admin_url( 'admin.php' ) ) );
798
-
799
- }
800
-
801
-
802
- public function membership_addon_actions() {
803
 
804
- //&& $this->core->user_is_point_admin()
805
- // Important - Here we need to add a check, if the plugin on which action is being performed really belongs to mycred membership (because user can modify plugin folder name from URL)
806
- // also need to test for multisite as well
807
-
808
- if ( isset( $_GET['addon_action'] ) && isset( $_GET['addon_folder'] ) && isset( $_GET['_token'] ) && wp_verify_nonce( $_GET['_token'], 'mycred-membership-addon-action' ) ) {
809
-
810
- $addon_folder = sanitize_text_field( $_GET['addon_folder'] );
811
- $action = sanitize_text_field( $_GET['addon_action'] );
812
-
813
- $result = 0; // 0 = fail, 1 = success
814
- // Activation
815
- if ( $action == 'activate' ) {
816
- $installed_plugins = get_plugins();
817
-
818
- foreach( $installed_plugins as $folder_name => $installed_plugin ){
819
- $arr = explode("/", $folder_name, 2);
820
-
821
- if($addon_folder == $arr[0]){
822
- $success = activate_plugin( $folder_name );
823
- if ( $success === NULL ) {
824
- $result = 1;
825
- }
826
- }
827
- }
828
-
829
- } else if ( $action == 'deactivate' ) {
830
-
831
- $active_plugins = get_option('active_plugins');
832
-
833
- foreach($active_plugins as $active_plugin){
834
- $arr = explode("/", $active_plugin, 2);
835
-
836
- if($addon_folder == $arr[0]){
837
- deactivate_plugins( $active_plugin );
838
- $result = 1;
839
- }
840
- }
841
-
842
- } else if ( $action == 'install' ) {
843
-
844
- // first check if plugin is already installed
845
- if (! $this->is_addon_installed( $addon_folder )){ // plugin is not installed
846
- $result = 0;
847
- if($this->membership_download_addon($addon_folder)){
848
- if($this->membership_unzip_addon($addon_folder)){
849
- $result = 1;
850
- }
851
- }
852
- }
853
 
854
- }
855
-
856
- $url = add_query_arg( array( 'page' => MYCRED_SLUG . '-membership', 'success' => $result, 'addon_action' => $action ), admin_url( 'admin.php' ) );
857
-
858
- wp_safe_redirect( $url );
859
- exit;
860
-
861
- }
862
-
863
- }
864
-
865
- public function membership_download_addon($addon_folder = ''){
866
-
867
- if(!empty($addon_folder)){
868
-
869
- $url = 'https://mycred.me/download-plugin/?memid='.mycred_get_my_id().'&addonfolder='.$addon_folder;
870
-
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
- }
886
-
887
- return false;
888
- }
889
-
890
- public function membership_unzip_addon($addon_folder = ''){
891
-
892
- if(!empty($addon_folder)) {
893
- $addon_zip_file = ABSPATH.'wp-content/plugins/'.$addon_folder.'.zip';
894
- $plugins_directory = ABSPATH.'wp-content/plugins/';
895
-
896
- WP_Filesystem();
897
- $unzipfile = unzip_file( $addon_zip_file, $plugins_directory);
898
-
899
- if ( $unzipfile ) {
900
- unlink($addon_zip_file);
901
- return true;
902
- }
903
-
904
- }
905
-
906
- return false;
907
- }
908
-
909
- public function membership_get_plans(){
910
-
911
- $url = 'https://mycred.me/wp-json/membership/v1/membership/pricing';
912
- $data = wp_remote_get( $url );
913
- $membership_plans = array();
914
-
915
- if ( is_array( $data ) && ! is_wp_error( $data ) ) {
916
-
917
- $membership_plans = json_decode( $data['body'], true );
918
 
919
  }
920
 
921
- return $membership_plans;
922
  }
923
 
924
  }
18
  * Construct
19
  */
20
  public function __construct() {
 
 
 
 
 
21
 
22
+ add_action( 'admin_menu', array( $this, 'mycred_membership_menu' ) );
23
+ add_action( 'admin_menu', array( $this, 'mycred_treasures' ) );
24
+ add_action( 'admin_menu', array( $this, 'mycred_support' ) );
25
+ add_action( 'admin_init', array( $this, 'add_styles' ) );
26
+ add_filter( 'admin_footer_text', array( $this, 'mycred_admin_footer_text') );
27
+
28
  }
29
 
30
+ public function add_styles() {
31
 
32
  wp_register_style('admin-subscription-css', plugins_url( 'assets/css/admin-subscription.css', myCRED_THIS ), array(), '1.2', 'all');
33
 
44
  }
45
 
46
  wp_enqueue_style('admin-subscription-css');
47
+
48
  }
49
 
50
+ public function mycred_admin_footer_text( $footer_text ) {
51
+
52
  global $typenow;
53
 
54
  if( isset($_GET['page']) && $_GET['page'] == 'mycred-support' ) {
55
 
56
+ $mycred_footer_text = sprintf( __( 'Thank you for being a <a href="%1$s" target="_blank">myCred </a>user! Please give your <a href="%2$s" target="_blank">%3$s</a> rating on WordPress.org', 'mycred' ),
57
+ 'https://mycred.me',
58
+ 'https://wordpress.org/support/plugin/mycred/reviews/?rate=5#new-post',
59
+ '&#9733;&#9733;&#9733;&#9733;&#9733;'
60
+ );
61
 
62
  return str_replace( '</span>', '', $footer_text ) . ' | ' . $mycred_footer_text . '</span>';
63
 
64
  }
65
  else {
66
 
67
+ return $footer_text;
68
+
69
+ }
70
 
 
71
  }
72
 
73
  /**
75
  */
76
  public function mycred_membership_menu() {
77
  mycred_add_main_submenu(
78
+ 'License',
79
+ 'License',
80
  'manage_options',
81
  'mycred-membership',
82
  array( $this, 'mycred_membership_callback' )
138
 
139
  <h2>Customization:</h2>
140
  <p>If you need to build a custom feature, simply <a href="https://objectsws.atlassian.net/servicedesk/customer/portal/11/create/92">submit a request</a> on our myCred website.</p>
141
+ <hr>
142
+
143
+ <h2>myCred Add-ons Update:</h2>
144
+ <p>For our users' convenience and their site optimization, we made a unified license system for individual and membership users. <a href="<?php echo admin_url('options.php?page=mycred-update'); ?>">Click here to update your add-ons</a></p>
145
 
146
  </div>
147
 
258
  $membership_key = '';
259
  ?>
260
  <div class="wrap">
 
261
  <div class="mmc_welcome">
262
  <div class="mmc_welcome_content">
263
+ <div class="mmc_title"><?php _e( 'Welcome to myCred Premium Club', 'mycred' ); ?></div>
264
  <form action="#" method="post">
265
  <?php
266
+ if(mycred_is_valid_license_key( $membership_key )) {
267
  echo '<span class="dashicons dashicons-yes-alt membership-license-activated"></span>';
268
+ }
269
+ else {
270
  // if membership is not active in current site and the membership key is entered
271
  echo '<span class="dashicons dashicons-dismiss membership-license-inactive"></span>';
272
  }
273
 
274
 
275
+ ?>
276
 
277
+ <input type="text" name="mmc_lincense_key" class="mmc_lincense_key" placeholder="<?php _e( 'Add Your License key', 'mycred' ); ?>" value="<?php echo $membership_key?>">
278
  <input type="submit" class="mmc_save_license button-primary" value="Save"/>
279
+ <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 License Key','mycred') ?></a>
280
+ </div>
281
+ <div class="mmc_license_link">
282
+
283
+
284
+ </div>
285
  </form>
286
  </div>
287
 
288
  </div>
289
 
290
+
 
 
 
 
 
 
 
 
291
  </div>
292
  <?php
293
  }
301
 
302
  $license_key = sanitize_text_field( $_POST['mmc_lincense_key'] );
303
  if( isset( $license_key ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
 
305
+ update_option( 'mycred_membership_key', $license_key );
306
+ mycred_is_valid_license_key( $license_key, true );
307
+ $this->removeLicenseTransients();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
 
 
 
309
  }
310
 
 
 
311
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
 
313
+ public function removeLicenseTransients() {
314
+
315
+ $addons = apply_filters( 'mycred_license_addons', array() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
 
317
+ foreach ( $addons as $addon ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
 
319
+ $transient_key = 'mcl_' . md5( $addon );
320
+ delete_site_transient( $transient_key );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
 
322
  }
323
 
 
324
  }
325
 
326
  }
membership/subscription-functions.php CHANGED
@@ -6,368 +6,55 @@
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.2
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( 'yes' == get_transient( 'mycred_is_membership_active' ) && !isset($_GET['mycred-refresh-license'])) {
210
- // if transient is set return its value, unless user clicks on refresh license
211
-
212
- return true;
213
-
214
- }
215
-
216
- if( false === $membership_status ) {
217
-
218
- $user_license_key = mycred_get_membership_key();
219
-
220
- $mycred_version = str_pad( (int) str_replace( '.', '', myCRED_VERSION ), 3, '0' );
221
-
222
- $url = rtrim( get_bloginfo( 'url' ), '/' );
223
- if( $mycred_version >= 188 && !empty( $user_license_key ) &&
224
- mycred_get_membership_details(true)['plan'][0]['key'] == $user_license_key &&
225
- in_array( $url, mycred_get_membership_details(true)['sites'][0] )
226
- ) {
227
- $membership_status = true;
228
-
229
- set_transient( 'mycred_is_membership_active', 'yes' , DAY_IN_SECONDS*7 );
230
- // setting transient so membership request is not sent to mycred server for next 2 days
231
- } else {
232
-
233
- set_transient( 'mycred_is_membership_active', 'no' , DAY_IN_SECONDS*7 );
234
- }
235
- wp_cache_set( 'mycred_membership_status', $membership_status );
236
- }
237
-
238
- return $membership_status;
239
- }
240
- }
241
-
242
- /**
243
- * Get membership details
244
- *
245
- * @since 1.0
246
- * @version 1.1
247
- */
248
- if( !function_exists('mycred_get_membership_details') ) {
249
- function mycred_get_membership_details($force = false) {
250
 
251
- $membership_details = array();
252
- if (true === $force) {
253
- $membership_details = mycred_send_req_for_membership_details();
254
- } else {
255
 
256
- $saved_membership_details = get_option('mycred_membership_details');
257
 
258
- if (empty($saved_membership_details)) {
259
- $membership_details = mycred_send_req_for_membership_details();
260
- } else {
261
- $membership_details = $saved_membership_details;
262
- }
263
-
264
- }
265
-
266
- return $membership_details;
267
-
268
- }
269
- }
270
 
271
- /**
272
- * Send Request for membership details
273
- *
274
- * @since 1.0
275
- * @version 1.1
276
- */
277
- if( !function_exists('mycred_send_req_for_membership_details') ) {
278
- function mycred_send_req_for_membership_details() {
279
 
280
- $membership_details = wp_cache_get('mycred_membership_details');
 
281
 
282
- if( false === $membership_details ) {
283
 
284
- $url = 'https://mycred.me/wp-json/membership/v1/member/'.mycred_get_my_id().'?time='.time();
285
- $data = wp_remote_get( $url );
286
 
287
- if( is_array( $data ) && ! is_wp_error( $data ) && ! empty( $data['response']['code'] ) && $data['response']['code'] == 200 ) {
288
-
289
- $membership_details = json_decode( $data['body'], true );
290
-
291
- $membership_details_to_save = array();
292
- if(isset($membership_details['addons']) && !empty($membership_details['addons'])) {
293
-
294
- foreach($membership_details['addons'] as $key => $value) {
295
- $membership_details_to_save['addons'][$key]['name'] = $value['name'];
296
- $membership_details_to_save['addons'][$key]['slug'] = $value['slug'];
297
- $membership_details_to_save['addons'][$key]['folder'] = $value['folder'];
298
- }
299
 
300
- }
301
-
302
- if(isset($membership_details['order']) && !empty($membership_details['order'])) {
303
 
304
- foreach($membership_details['order'] as $key => $value) {
305
- $membership_details_to_save['order'][$key]['expire'] = $value['expire'];
306
- }
307
-
308
  }
309
- update_option( 'mycred_membership_details', $membership_details_to_save );
310
-
311
- } else {
312
 
313
- $membership_details = array (
314
- "addons" => array(),
315
- "sites" => array(),
316
- "plan" => array(
317
- array (
318
- "ID" => "",
319
- "title" => "",
320
- "key" => "",
321
- )
322
- ),
323
- "order" => array (
324
- array (
325
- "order_id" => NULL,
326
- "purchase" => 0,
327
- "expire" => 0,
328
- )
329
- )
330
- );
331
-
332
  }
333
 
334
- wp_cache_set( 'mycred_membership_details', $membership_details );
335
  }
336
-
337
- return $membership_details;
338
-
339
- }
340
- }
341
-
342
-
343
- /**
344
- * Add check for License link to all mycred addons
345
- *
346
- * @since 1.0
347
- * @version 1.1
348
- */
349
-
350
- if( !function_exists('mycred_refresh_license') ) {
351
- function mycred_refresh_license($plugin_meta, $slug, $file, $plugin_data ) {
352
-
353
- $plugin_meta[] = '<a href="'.admin_url( 'plugins.php?mycred-refresh-license='.$slug).'">'.__('Refresh License', 'mycred').'</a>';
354
 
355
- return $plugin_meta;
356
 
357
  }
358
-
359
- add_filter( 'mycred_plugin_info', 'mycred_refresh_license', 80, 4 );
360
- }
361
-
362
- if( !function_exists('mycred_send_refresh_license_req') ) {
363
- function mycred_send_refresh_license_req() {
364
-
365
- if (isset($_GET['mycred-refresh-license'])) {
366
- mycred_get_membership_details(true);
367
-
368
- }
369
-
370
- }
371
-
372
- add_filter( 'pre_current_active_plugins', 'mycred_send_refresh_license_req');
373
- }
6
 
7
  if ( ! defined( 'myCRED_VERSION' ) ) exit;
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  /**
10
  * Get membership end date
11
  *
12
  * @since 1.0
13
  * @version 1.0
14
  */
15
+ if( ! function_exists('mycred_is_valid_license_key') ) :
16
+ function mycred_is_valid_license_key( $key, $force = false ) {
17
 
18
+ if( empty( $key ) ) return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ $is_valid = get_site_transient( 'mycred_is_valid_license_key' );
 
 
 
21
 
22
+ if ( false === $is_valid || $force ) {
23
 
24
+ $is_valid = 'no';
25
+ $api_endpoint = 'https://license.mycred.me/wp-json/license/is-valid-license-key';
 
 
 
 
 
 
 
 
 
 
26
 
27
+ $request_args = array(
28
+ 'body' => array(
29
+ 'license_key' => $key,
30
+ 'site' => site_url(),
31
+ 'api-key' => md5( get_bloginfo( 'url' ) )
32
+ ),
33
+ 'timeout' => 12
34
+ );
35
 
36
+ // Start checking for an update
37
+ $response = wp_remote_post( $api_endpoint, $request_args );
38
 
39
+ if ( ! is_wp_error( $response ) ) {
40
 
41
+ $response_data = json_decode( $response['body'] );
 
42
 
43
+ if (
44
+ ! empty( $response_data->status ) &&
45
+ $response_data->status == 'success'
46
+ ) {
 
 
 
 
 
 
 
 
47
 
48
+ $is_valid = $response_data->data;
 
 
49
 
 
 
 
 
50
  }
 
 
 
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
53
 
54
+ set_site_transient( 'mycred_is_valid_license_key', $is_valid, DAY_IN_SECONDS * 9999 );
55
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
+ return ( $is_valid == 'yes' );
58
 
59
  }
60
+ endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 2.3
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.8.1
13
  * Text Domain: mycred
14
  * Domain Path: /lang
15
  * License: GPLv2 or later
@@ -20,7 +20,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
20
  final class myCRED_Core {
21
 
22
  // Plugin Version
23
- public $version = '2.3';
24
 
25
  // Instnace
26
  protected static $_instance = NULL;
@@ -133,8 +133,6 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
133
  // Plugin Related
134
  add_filter( 'plugin_action_links_mycred/mycred.php', array( $this, 'plugin_links' ), 10, 4 );
135
  add_filter( 'plugin_row_meta', array( $this, 'plugin_description_links' ), 10, 2 );
136
- add_filter( 'pre_http_request', array( $this, 'handle_license_request' ), 10, 3 );
137
- add_filter( 'http_request_args', array( $this, 'license_request_args' ), 10, 2 );
138
 
139
  }
140
 
@@ -267,6 +265,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
267
  $this->file( myCRED_MEMBERSHIP_DIR . 'subscription-functions.php' );
268
  $this->file( myCRED_MEMBERSHIP_DIR . 'mycred-connect-membership.php' );
269
  $this->file( myCRED_INCLUDES_DIR . 'mycred-main-menu.php' );
 
270
 
271
  // Modules
272
  $this->file( myCRED_MODULES_DIR . 'mycred-module-addons.php' );
@@ -282,6 +281,9 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
282
  //Uninstall Settings
283
  $this->file( myCRED_INCLUDES_DIR . 'mycred-uninstall.php' );
284
 
 
 
 
285
  if ( is_multisite() ) {
286
 
287
  $this->file( myCRED_MODULES_DIR . 'mycred-module-network.php' );
@@ -1128,43 +1130,6 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
1128
 
1129
  }
1130
 
1131
- /**
1132
- * Handle Premium Addon License requests
1133
- * @since 1.9
1134
- * @version 1.0
1135
- */
1136
- public function handle_license_request( $default, $parsed_args, $url ) {
1137
-
1138
- if( $url == 'http://mycred.me/api/plugins/' && ! empty( $parsed_args['body']['action'] ) && $parsed_args['body']['action'] == 'info' ) {
1139
-
1140
- $request = unserialize( $parsed_args['body']['request'] );
1141
-
1142
- if( get_transient( 'mycred_license_' . $request['slug'] ) )
1143
- return true;
1144
- else
1145
- set_transient( 'mycred_license_' . $request['slug'], $parsed_args, 24 * HOUR_IN_SECONDS );
1146
-
1147
- }
1148
-
1149
- return $default;
1150
- }
1151
-
1152
- /**
1153
- * Add argument for handling license request
1154
- * @since 1.9
1155
- * @version 1.0
1156
- */
1157
- public function license_request_args( $parsed_args, $url ) {
1158
-
1159
- if( $url == 'http://mycred.me/api/plugins/' && ! empty( $parsed_args['body']['action'] ) ) {
1160
-
1161
- $parsed_args['body']['optimize_license'] = true;
1162
-
1163
- }
1164
-
1165
- return $parsed_args;
1166
- }
1167
-
1168
  }
1169
  endif;
1170
 
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.1
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.8.2
13
  * Text Domain: mycred
14
  * Domain Path: /lang
15
  * License: GPLv2 or later
20
  final class myCRED_Core {
21
 
22
  // Plugin Version
23
+ public $version = '2.3.1';
24
 
25
  // Instnace
26
  protected static $_instance = NULL;
133
  // Plugin Related
134
  add_filter( 'plugin_action_links_mycred/mycred.php', array( $this, 'plugin_links' ), 10, 4 );
135
  add_filter( 'plugin_row_meta', array( $this, 'plugin_description_links' ), 10, 2 );
 
 
136
 
137
  }
138
 
265
  $this->file( myCRED_MEMBERSHIP_DIR . 'subscription-functions.php' );
266
  $this->file( myCRED_MEMBERSHIP_DIR . 'mycred-connect-membership.php' );
267
  $this->file( myCRED_INCLUDES_DIR . 'mycred-main-menu.php' );
268
+ $this->file( myCRED_INCLUDES_DIR . 'mycred-addons-upgrader.php' );
269
 
270
  // Modules
271
  $this->file( myCRED_MODULES_DIR . 'mycred-module-addons.php' );
281
  //Uninstall Settings
282
  $this->file( myCRED_INCLUDES_DIR . 'mycred-uninstall.php' );
283
 
284
+ //License
285
+ $this->file( myCRED_CLASSES_DIR . 'class.mycred-license.php' );
286
+
287
  if ( is_multisite() ) {
288
 
289
  $this->file( myCRED_MODULES_DIR . 'mycred-module-network.php' );
1130
 
1131
  }
1132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1133
  }
1134
  endif;
1135
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mycred,wpexpertsio
3
  Tags: badges, gamification, loyalty, points, rewards
4
  Requires at least: 4.8
5
- Tested up to: 5.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
@@ -36,7 +36,7 @@ myCred allows **THREE different ways** through which you can award your users:
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
 
@@ -65,12 +65,12 @@ Join the myCred membership club today and take advantage of premium services tha
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.
@@ -84,44 +84,44 @@ Empower your WordPress website users by rewarding them points – each user
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
 
@@ -137,10 +137,10 @@ You can achieve the following features by using a dedicated log for your points
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.
@@ -166,7 +166,7 @@ Power your WordPress website with 50+ add-ons ranging from categories like **Gam
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 =
@@ -281,6 +281,9 @@ You can find a list of [frequently asked questions](https://mycred.me/about/faq/
281
 
282
  == Upgrade Notice ==
283
 
 
 
 
284
  = 2.3 =
285
  New features and Bug fixes.
286
 
@@ -317,6 +320,9 @@ The banking module have been replaced by Central deposite module, and interest r
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.
@@ -343,7 +349,8 @@ The banking module have been replaced by Central deposite module, and interest r
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
 
2
  Contributors: mycred,wpexpertsio
3
  Tags: badges, gamification, loyalty, points, rewards
4
  Requires at least: 4.8
5
+ Tested up to: 5.8.2
6
+ Stable tag: 2.3.1-beta.1
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
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
 
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.
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
 
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.
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 =
281
 
282
  == Upgrade Notice ==
283
 
284
+ = 2.3.1 =
285
+ Improve license system.
286
+
287
  = 2.3 =
288
  New features and Bug fixes.
289
 
320
 
321
  == Changelog ==
322
 
323
+ = 2.3.1 =
324
+ - **TWAEK** - Improve license system.
325
+
326
  = 2.3 =
327
  - **NEW** - Introduced a "Bulk Assign" tool for awarding/revoking points, badges, and ranks.
328
  - **NEW** - Introduced a new feature "Exclude by user role" admin can exclude any user role from the specific point type.
349
  - **FIX** - Backend logs are not being exported whether the export raw/formatted log option is set.
350
  - **FIX** - Incorrect achieved badge level image in [mycred_badges] shortcode.
351
  - **FIX** - In the Ranks list page All/Published/Trash links not working properly.
352
+ - **FIX** - Unable to revoke badge from the User profile page.
353
+ - **FIX** - Added some security validations in the transfer form.
354
  - **FIX** - MYSQL 8 syntax error in the leaderboard shortcode.
355
  - **FIX** - Added compatibility with BuddyPress version 8.0
356