Version Description
New - Added compatibility for multiple currencies in CashCred Paypal addon Fix - Php erros in myCred woocommerce gateway Fix - Points on daily visit hooks not working in some conditions Fix - myCred CashCred multisite issues Improvement - license system
Download this release
Release Info
Developer | wpexpertsio |
Plugin | myCRED |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- addons/cash-creds/abstracts/cashcred-abstract-payment-gateway.php +28 -26
- addons/cash-creds/includes/cashcred-functions.php +103 -10
- addons/cash-creds/includes/cashcred-shortcodes.php +7 -7
- addons/cash-creds/modules/cashcred-module-core.php +13 -13
- addons/cash-creds/modules/cashcred-module-withdrawal.php +22 -21
- addons/gateway/carts/mycred-woocommerce.php +1 -1
- includes/hooks/mycred-hook-site-visits.php +2 -2
- includes/mycred-about.php +1 -1
- membership/mycred-connect-membership.php +1 -1
- membership/subscription-functions.php +99 -4
- mycred.php +45 -6
- readme.txt +17 -10
addons/cash-creds/abstracts/cashcred-abstract-payment-gateway.php
CHANGED
@@ -248,33 +248,35 @@ if ( ! class_exists( 'myCRED_Cash_Payment_Gateway' ) ) :
|
|
248 |
* @version 1.0.2
|
249 |
*/
|
250 |
public function currencies_dropdown( $name = '', $js = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
-
$currencies = array(
|
253 |
-
'USD' => 'US Dollars',
|
254 |
-
'AUD' => 'Australian Dollars',
|
255 |
-
'CAD' => 'Canadian Dollars',
|
256 |
-
'EUR' => 'Euro',
|
257 |
-
'GBP' => 'British Pound Sterling',
|
258 |
-
'JPY' => 'Japanese Yen',
|
259 |
-
'NZD' => 'New Zealand Dollars',
|
260 |
-
'CHF' => 'Swiss Francs',
|
261 |
-
'HKD' => 'Hong Kong Dollars',
|
262 |
-
'SGD' => 'Singapore Dollars',
|
263 |
-
'SEK' => 'Swedish Kronor',
|
264 |
-
'DKK' => 'Danish Kroner',
|
265 |
-
'PLN' => 'Polish Zloty',
|
266 |
-
'NOK' => 'Norwegian Kronor',
|
267 |
-
'HUF' => 'Hungarian Forint',
|
268 |
-
'CZK' => 'Check Koruna',
|
269 |
-
'ILS' => 'Israeli Shekel',
|
270 |
-
'MXN' => 'Mexican Peso',
|
271 |
-
'BRL' => 'Brazilian Real',
|
272 |
-
'MYR' => 'Malaysian Ringgits',
|
273 |
-
'PHP' => 'Philippine Pesos',
|
274 |
-
'RUB' => 'Russian Ruble',
|
275 |
-
'TWD' => 'Taiwan New Dollars',
|
276 |
-
'THB' => 'Thai Baht'
|
277 |
-
);
|
278 |
$currencies = apply_filters( 'mycred_dropdown_currencies', $currencies, $this->id );
|
279 |
$currencies = apply_filters( 'mycred_dropdown_currencies_' . $this->id, $currencies );
|
280 |
|
248 |
* @version 1.0.2
|
249 |
*/
|
250 |
public function currencies_dropdown( $name = '', $js = '' ) {
|
251 |
+
$currencies = [
|
252 |
+
'AUD' => 'Australian dollar',
|
253 |
+
'BRL' => 'Brazilian real',
|
254 |
+
'CAD' => 'Canadian dollar',
|
255 |
+
'CNY' => 'Chinese Renmenbi',
|
256 |
+
'CZK' => 'Czech koruna',
|
257 |
+
'DKK' => 'Danish krone',
|
258 |
+
'EUR' => 'Euro',
|
259 |
+
'HKD' => 'Hong Kong dollar',
|
260 |
+
'HUF' => 'Hungarian forint',
|
261 |
+
'INR' => 'Indian rupee',
|
262 |
+
'ILS' => 'Israeli new shekel',
|
263 |
+
'JPY' => 'Japanese yen',
|
264 |
+
'MYR' => 'Malaysian ringgit',
|
265 |
+
'MXN' => 'Mexican peso',
|
266 |
+
'TWD' => 'New Taiwan dollar',
|
267 |
+
'NZD' => 'New Zealand dollar',
|
268 |
+
'NOK' => 'Norwegian krone',
|
269 |
+
'PHP' => 'Philippine peso',
|
270 |
+
'PLN' => 'Polish złoty',
|
271 |
+
'GBP' => 'Pound sterling',
|
272 |
+
'RUB' => 'Russian ruble',
|
273 |
+
'SGD' => 'Singapore dollar',
|
274 |
+
'SEK' => 'Swedish krona',
|
275 |
+
'CHF' => 'Swiss franc',
|
276 |
+
'THB' => 'Thai baht',
|
277 |
+
'USD' => 'United States dollar'
|
278 |
+
];
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
$currencies = apply_filters( 'mycred_dropdown_currencies', $currencies, $this->id );
|
281 |
$currencies = apply_filters( 'mycred_dropdown_currencies_' . $this->id, $currencies );
|
282 |
|
addons/cash-creds/includes/cashcred-functions.php
CHANGED
@@ -60,10 +60,9 @@ if ( ! function_exists( 'cashcred_get_user_payment_details' ) ) :
|
|
60 |
|
61 |
if ( is_admin() ) {
|
62 |
$post_id = get_the_ID();
|
63 |
-
$user_id =
|
64 |
}
|
65 |
-
|
66 |
-
return mycred_get_user_meta( $user_id, 'cashcred_user_settings', '', true );
|
67 |
|
68 |
}
|
69 |
endif;
|
@@ -274,7 +273,7 @@ endif;
|
|
274 |
*/
|
275 |
if ( ! function_exists( 'cashcred_get_payment_settings' ) ) :
|
276 |
function cashcred_get_payment_settings( $payment_id = NULL ) {
|
277 |
-
|
278 |
// Construct fake pending object ( when no pending payment object exists )
|
279 |
if ( is_array( $payment_id ) ) {
|
280 |
|
@@ -299,11 +298,11 @@ if ( ! function_exists( 'cashcred_get_payment_settings' ) ) :
|
|
299 |
$pending_payment = new StdClass();
|
300 |
$pending_payment->payment_id = absint( $payment_id );
|
301 |
$pending_payment->public_id = get_the_title( $payment_id );
|
302 |
-
$pending_payment->point_type =
|
303 |
-
$pending_payment->points =
|
304 |
-
$pending_payment->cost =
|
305 |
-
$pending_payment->currency =
|
306 |
-
$pending_payment->gateway_id =
|
307 |
$pending_payment->transaction_id = $pending_payment->public_id;
|
308 |
|
309 |
}
|
@@ -466,4 +465,98 @@ if ( ! function_exists( 'mycred_get_cashcred_settings' ) ) :
|
|
466 |
return apply_filters( 'mycred_get_cashcred_settings', $settings );
|
467 |
|
468 |
}
|
469 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
if ( is_admin() ) {
|
62 |
$post_id = get_the_ID();
|
63 |
+
$user_id = check_site_get_post_meta( $post_id, 'from', true );
|
64 |
}
|
65 |
+
return mycred_get_user_meta( $user_id, 'cashcred_user_settings', '', true );
|
|
|
66 |
|
67 |
}
|
68 |
endif;
|
273 |
*/
|
274 |
if ( ! function_exists( 'cashcred_get_payment_settings' ) ) :
|
275 |
function cashcred_get_payment_settings( $payment_id = NULL ) {
|
276 |
+
|
277 |
// Construct fake pending object ( when no pending payment object exists )
|
278 |
if ( is_array( $payment_id ) ) {
|
279 |
|
298 |
$pending_payment = new StdClass();
|
299 |
$pending_payment->payment_id = absint( $payment_id );
|
300 |
$pending_payment->public_id = get_the_title( $payment_id );
|
301 |
+
$pending_payment->point_type = check_site_get_post_meta( $payment_id, 'point_type', true );
|
302 |
+
$pending_payment->points = check_site_get_post_meta( $payment_id, 'points', true );
|
303 |
+
$pending_payment->cost = check_site_get_post_meta( $payment_id, 'cost', true );
|
304 |
+
$pending_payment->currency = check_site_get_post_meta( $payment_id, 'currency', true );
|
305 |
+
$pending_payment->gateway_id = check_site_get_post_meta( $payment_id, 'gateway', true );
|
306 |
$pending_payment->transaction_id = $pending_payment->public_id;
|
307 |
|
308 |
}
|
465 |
return apply_filters( 'mycred_get_cashcred_settings', $settings );
|
466 |
|
467 |
}
|
468 |
+
endif;
|
469 |
+
|
470 |
+
if(!function_exists('check_site_add_post_meta'))
|
471 |
+
{
|
472 |
+
/**
|
473 |
+
* add postmeta by checking multisite and current blog
|
474 |
+
* @param $post_id post id
|
475 |
+
* @param $key meta key
|
476 |
+
* @param bool $single
|
477 |
+
* @return mixed
|
478 |
+
*/
|
479 |
+
function check_site_add_post_meta($post_id, $meta_key, $meta_value, $unique = false)
|
480 |
+
{
|
481 |
+
if(is_multisite() AND !is_main_site() AND mycred_override_settings())
|
482 |
+
{
|
483 |
+
return add_post_meta( $post_id, $meta_key, $meta_value, $unique );
|
484 |
+
}
|
485 |
+
else
|
486 |
+
{
|
487 |
+
return mycred_add_post_meta( $post_id, $meta_key, $meta_value, $unique );
|
488 |
+
}
|
489 |
+
}
|
490 |
+
}
|
491 |
+
|
492 |
+
if(!function_exists('check_site_get_post_meta'))
|
493 |
+
{
|
494 |
+
/**
|
495 |
+
* Returns postmeta by checking multisite and current blog
|
496 |
+
* @param $post_id post id
|
497 |
+
* @param $key meta key
|
498 |
+
* @param bool $single
|
499 |
+
* @return mixed
|
500 |
+
*/
|
501 |
+
function check_site_get_post_meta($post_id, $key, $single = false)
|
502 |
+
{
|
503 |
+
if(is_multisite() AND !is_main_site() AND mycred_override_settings())
|
504 |
+
{
|
505 |
+
return get_post_meta( $post_id, $key, $single );
|
506 |
+
}
|
507 |
+
else
|
508 |
+
{
|
509 |
+
return mycred_get_post_meta( $post_id, $key, $single );
|
510 |
+
}
|
511 |
+
}
|
512 |
+
}
|
513 |
+
|
514 |
+
if(!function_exists('cashcred_get_user_settings'))
|
515 |
+
{
|
516 |
+
/**
|
517 |
+
* cashCred get user's settings
|
518 |
+
*/
|
519 |
+
function cashcred_get_user_settings()
|
520 |
+
{
|
521 |
+
$check = '';
|
522 |
+
$cashcred_user_setting = '';
|
523 |
+
if(is_multisite() AND !is_main_site() AND mycred_override_settings())
|
524 |
+
{
|
525 |
+
$check = true;
|
526 |
+
}
|
527 |
+
else
|
528 |
+
{
|
529 |
+
$check = false;
|
530 |
+
}
|
531 |
+
if($check)
|
532 |
+
{
|
533 |
+
return 'cashcred_user_settings_' . get_current_blog_id();
|
534 |
+
}
|
535 |
+
else
|
536 |
+
{
|
537 |
+
return 'cashcred_user_settings';
|
538 |
+
}
|
539 |
+
}
|
540 |
+
}
|
541 |
+
|
542 |
+
if(!function_exists('check_site_update_post_meta'))
|
543 |
+
{
|
544 |
+
/**
|
545 |
+
*Checks site is multisite or not and update post meta
|
546 |
+
* @param $post_id post id
|
547 |
+
* @param $key meta key
|
548 |
+
* @param $new_value new meta value
|
549 |
+
* @return mixed
|
550 |
+
*/
|
551 |
+
function check_site_update_post_meta( $post_id, $meta_key, $new_value )
|
552 |
+
{
|
553 |
+
if(is_multisite() AND !is_main_site() AND mycred_override_settings())
|
554 |
+
{
|
555 |
+
return update_post_meta( $post_id, $meta_key, $new_value );
|
556 |
+
}
|
557 |
+
else
|
558 |
+
{
|
559 |
+
return mycred_update_post_meta( $post_id, $meta_key, $new_value );
|
560 |
+
}
|
561 |
+
}
|
562 |
+
}
|
addons/cash-creds/includes/cashcred-shortcodes.php
CHANGED
@@ -47,7 +47,7 @@ if ( ! function_exists( 'mycred_render_cashcred' ) ) :
|
|
47 |
$cashcred_withdraw = true;
|
48 |
|
49 |
// Button Label
|
50 |
-
$button_label = $point_types[
|
51 |
|
52 |
ob_start();
|
53 |
|
@@ -122,7 +122,7 @@ if ( ! function_exists( 'mycred_render_cashcred' ) ) :
|
|
122 |
</select>
|
123 |
</div>
|
124 |
<?php } else {?>
|
125 |
-
<input type="hidden" id="cashcred_point_type" name="cashcred_point_type" value="<?php echo esc_attr(
|
126 |
<?php } ?>
|
127 |
|
128 |
<?php if ( count( $gateways ) > 1 ) { ?>
|
@@ -137,11 +137,11 @@ if ( ! function_exists( 'mycred_render_cashcred' ) ) :
|
|
137 |
</select>
|
138 |
</div>
|
139 |
<?php } else { ?>
|
140 |
-
<input type="hidden" id="cashcred_pay_method" name="cashcred_pay_method" value="<?php echo esc_attr(
|
141 |
<?php } ?>
|
142 |
|
143 |
<div class="form-group">
|
144 |
-
<label><?php echo sprintf( __('Withdraw %s value', 'mycred'), $point_types[
|
145 |
<?php
|
146 |
$amount = ! empty( $amount ) ? floatval( $amount ) : 0;
|
147 |
?>
|
@@ -264,12 +264,12 @@ if ( ! function_exists( 'mycred_render_cashcred' ) ) :
|
|
264 |
?>
|
265 |
</select>
|
266 |
<?php else:?>
|
267 |
-
<input type="hidden" name="cashcred_save_settings" id="cashcred_save_settings" value="<?php echo esc_attr(
|
268 |
<?php endif;?>
|
269 |
<?php
|
270 |
wp_nonce_field( 'cashCred-payment-settings', 'cashcred_settings_wpnonce' );
|
271 |
-
|
272 |
-
|
273 |
|
274 |
$MyCred_payment_setting_call = new $active_gateways_value['callback'][0]($key);
|
275 |
$MyCred_payment_setting_call->cashcred_payment_settings($key) ;
|
47 |
$cashcred_withdraw = true;
|
48 |
|
49 |
// Button Label
|
50 |
+
$button_label = $point_types[ current(array_keys($point_types)) ]->template_tags_general( $button );
|
51 |
|
52 |
ob_start();
|
53 |
|
122 |
</select>
|
123 |
</div>
|
124 |
<?php } else {?>
|
125 |
+
<input type="hidden" id="cashcred_point_type" name="cashcred_point_type" value="<?php echo esc_attr( current(array_keys($point_types)) ); ?>" />
|
126 |
<?php } ?>
|
127 |
|
128 |
<?php if ( count( $gateways ) > 1 ) { ?>
|
137 |
</select>
|
138 |
</div>
|
139 |
<?php } else { ?>
|
140 |
+
<input type="hidden" id="cashcred_pay_method" name="cashcred_pay_method" value="<?php echo esc_attr( current(array_keys($gateways)) ); ?>" />
|
141 |
<?php } ?>
|
142 |
|
143 |
<div class="form-group">
|
144 |
+
<label><?php echo sprintf( __('Withdraw %s value', 'mycred'), $point_types[ current(array_keys($point_types)) ]->plural() ); ?></label>
|
145 |
<?php
|
146 |
$amount = ! empty( $amount ) ? floatval( $amount ) : 0;
|
147 |
?>
|
264 |
?>
|
265 |
</select>
|
266 |
<?php else:?>
|
267 |
+
<input type="hidden" name="cashcred_save_settings" id="cashcred_save_settings" value="<?php echo esc_attr( current(array_keys($gateways)) ); ?>" />
|
268 |
<?php endif;?>
|
269 |
<?php
|
270 |
wp_nonce_field( 'cashCred-payment-settings', 'cashcred_settings_wpnonce' );
|
271 |
+
|
272 |
+
foreach ( $gateways as $key => $active_gateways_value ) {
|
273 |
|
274 |
$MyCred_payment_setting_call = new $active_gateways_value['callback'][0]($key);
|
275 |
$MyCred_payment_setting_call->cashcred_payment_settings($key) ;
|
addons/cash-creds/modules/cashcred-module-core.php
CHANGED
@@ -170,7 +170,7 @@ if ( ! class_exists( 'myCRED_cashCRED_Module' ) ) :
|
|
170 |
do_action( "mycred_cashcred_process_{$cashcred_pay_method}", $cashcred_prefs );
|
171 |
|
172 |
$payment_response = $cashcred_instance->gateway->process( $post_id );
|
173 |
-
|
174 |
if( $payment_response['status'] == true ) {
|
175 |
|
176 |
$history_comments = $this->cashcred_update_payment_status( $post_id, $auto );
|
@@ -383,9 +383,7 @@ if ( ! class_exists( 'myCRED_cashCRED_Module' ) ) :
|
|
383 |
|
384 |
$payment_methods[ $type_id ] = $payment_method_data;
|
385 |
}
|
386 |
-
|
387 |
-
update_user_meta( get_current_user_id(), 'cashcred_user_settings', $payment_methods );
|
388 |
-
|
389 |
}
|
390 |
|
391 |
public function process_new_withdraw_request( $gateway_id ){
|
@@ -425,15 +423,17 @@ if ( ! class_exists( 'myCRED_cashCRED_Module' ) ) :
|
|
425 |
if ( $post_id !== NULL && ! is_wp_error( $post_id ) ) {
|
426 |
|
427 |
wp_update_post( array( 'ID' => $post_id, 'post_title' => $post_id ) );
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
|
|
|
|
437 |
|
438 |
if( isset( $mycred_pref_cashcreds['gateway_prefs'][ $cashcred_pay_method ]["allow_auto_withdrawal"] ) &&
|
439 |
$mycred_pref_cashcreds['gateway_prefs'][ $cashcred_pay_method ]["allow_auto_withdrawal"] == "yes" ) {
|
170 |
do_action( "mycred_cashcred_process_{$cashcred_pay_method}", $cashcred_prefs );
|
171 |
|
172 |
$payment_response = $cashcred_instance->gateway->process( $post_id );
|
173 |
+
|
174 |
if( $payment_response['status'] == true ) {
|
175 |
|
176 |
$history_comments = $this->cashcred_update_payment_status( $post_id, $auto );
|
383 |
|
384 |
$payment_methods[ $type_id ] = $payment_method_data;
|
385 |
}
|
386 |
+
mycred_update_user_meta( get_current_user_id(), 'cashcred_user_settings', '', $payment_methods );
|
|
|
|
|
387 |
}
|
388 |
|
389 |
public function process_new_withdraw_request( $gateway_id ){
|
423 |
if ( $post_id !== NULL && ! is_wp_error( $post_id ) ) {
|
424 |
|
425 |
wp_update_post( array( 'ID' => $post_id, 'post_title' => $post_id ) );
|
426 |
+
|
427 |
+
//Will store post meta by checking multisite and current blog, Will store in current blog's table
|
428 |
+
check_site_add_post_meta( $post_id, 'point_type', $point_type, true );
|
429 |
+
check_site_add_post_meta( $post_id, 'gateway', $cashcred_pay_method , true );
|
430 |
+
check_site_add_post_meta( $post_id, 'points', $points, true );
|
431 |
+
check_site_add_post_meta( $post_id, 'cost', $cost, true );
|
432 |
+
check_site_add_post_meta( $post_id, 'currency', $currency, true );
|
433 |
+
check_site_add_post_meta( $post_id, 'from', get_current_user_id(), true );
|
434 |
+
check_site_add_post_meta( $post_id, 'user_ip', $_SERVER['REMOTE_ADDR'], true );
|
435 |
+
check_site_add_post_meta( $post_id, 'status', 'Pending', true );
|
436 |
+
check_site_add_post_meta( $post_id, 'manual', 'Manual', true );
|
437 |
|
438 |
if( isset( $mycred_pref_cashcreds['gateway_prefs'][ $cashcred_pay_method ]["allow_auto_withdrawal"] ) &&
|
439 |
$mycred_pref_cashcreds['gateway_prefs'][ $cashcred_pay_method ]["allow_auto_withdrawal"] == "yes" ) {
|
addons/cash-creds/modules/cashcred-module-withdrawal.php
CHANGED
@@ -302,7 +302,7 @@ if ( ! class_exists( 'cashCRED_Pending_Payments' ) ) :
|
|
302 |
|
303 |
// In case we are using the Master Template feautre on multisites, and this is not the main
|
304 |
// site in the network, bail.
|
305 |
-
if ( mycred_override_settings() && ! mycred_is_main_site() ) return;
|
306 |
|
307 |
add_submenu_page(
|
308 |
MYCRED_SLUG,
|
@@ -376,6 +376,7 @@ if ( ! class_exists( 'cashCRED_Pending_Payments' ) ) :
|
|
376 |
);
|
377 |
|
378 |
}
|
|
|
379 |
|
380 |
/**
|
381 |
* Pending Payment Column Content
|
@@ -385,11 +386,11 @@ if ( ! class_exists( 'cashCRED_Pending_Payments' ) ) :
|
|
385 |
public function adjust_column_content( $column_name, $post_id ) {
|
386 |
|
387 |
global $mycred_modules;
|
388 |
-
|
389 |
switch ( $column_name ) {
|
390 |
case 'User' :
|
391 |
|
392 |
-
$from = (int)
|
|
|
393 |
$user = get_userdata( $from );
|
394 |
|
395 |
if ( isset( $user->display_name ) )
|
@@ -400,8 +401,8 @@ if ( ! class_exists( 'cashCRED_Pending_Payments' ) ) :
|
|
400 |
break;
|
401 |
case 'Points';
|
402 |
|
403 |
-
$type =
|
404 |
-
$points =
|
405 |
$mycred = mycred( $type );
|
406 |
|
407 |
echo $mycred->format_creds( $points );
|
@@ -409,22 +410,22 @@ if ( ! class_exists( 'cashCRED_Pending_Payments' ) ) :
|
|
409 |
break;
|
410 |
case 'cost';
|
411 |
|
412 |
-
$cost =
|
413 |
-
$currency =
|
414 |
echo $cost . ' ' . $currency;
|
415 |
|
416 |
break;
|
417 |
case 'amount';
|
418 |
|
419 |
-
$points =
|
420 |
-
$cost =
|
421 |
-
$currency =
|
422 |
echo $currency .' ' . $points * $cost;
|
423 |
|
424 |
break;
|
425 |
case 'gateway';
|
426 |
|
427 |
-
$gateway =
|
428 |
$installed = $mycred_modules['solo']['cashcred']->get();
|
429 |
|
430 |
if ( isset( $installed[ $gateway ] ) )
|
@@ -435,7 +436,7 @@ if ( ! class_exists( 'cashCRED_Pending_Payments' ) ) :
|
|
435 |
break;
|
436 |
case 'ctype';
|
437 |
|
438 |
-
$type =
|
439 |
|
440 |
if ( isset( $this->point_types[ $type ] ) )
|
441 |
echo $this->point_types[ $type ];
|
@@ -444,7 +445,7 @@ if ( ! class_exists( 'cashCRED_Pending_Payments' ) ) :
|
|
444 |
|
445 |
break;
|
446 |
case 'status';
|
447 |
-
$status =
|
448 |
echo "<div class='cashcred_bages'><span class='cashcred_" . $status . "'>" . $status . "</span></div>";
|
449 |
|
450 |
break;
|
@@ -1100,7 +1101,7 @@ if ( ! class_exists( 'cashCRED_Pending_Payments' ) ) :
|
|
1100 |
$old_status = mycred_get_post_meta( $post_id, 'status', true );
|
1101 |
$new_status = sanitize_text_field( $_POST['status'] );
|
1102 |
|
1103 |
-
$user_settings = mycred_get_user_meta( $_POST['user_id'],
|
1104 |
$updated_user_settings = $_POST['cashcred_user_settings'];
|
1105 |
|
1106 |
$changed_fields = array();
|
@@ -1112,21 +1113,21 @@ if ( ! class_exists( 'cashCRED_Pending_Payments' ) ) :
|
|
1112 |
'cost' => __( 'Cost', 'mycred' ),
|
1113 |
'currency' => __( 'Currency', 'mycred' )
|
1114 |
);
|
1115 |
-
|
1116 |
-
mycred_update_post_meta( $post_id, 'status', $new_status );
|
1117 |
|
1118 |
-
|
1119 |
-
|
|
|
|
|
1120 |
foreach ( $pending_payment as $meta_key => $meta_value ) {
|
1121 |
|
1122 |
$new_value = sanitize_text_field( $meta_value );
|
1123 |
-
$old_value =
|
1124 |
|
1125 |
if ( $new_value != $old_value ) {
|
1126 |
-
|
1127 |
$changed_fields[] = $withdraw_request_messages[ $meta_key ];
|
1128 |
}
|
1129 |
-
|
1130 |
}
|
1131 |
|
1132 |
$changes = join( ", ", $changed_fields );
|
302 |
|
303 |
// In case we are using the Master Template feautre on multisites, and this is not the main
|
304 |
// site in the network, bail.
|
305 |
+
//if ( mycred_override_settings() && ! mycred_is_main_site() ) return;
|
306 |
|
307 |
add_submenu_page(
|
308 |
MYCRED_SLUG,
|
376 |
);
|
377 |
|
378 |
}
|
379 |
+
|
380 |
|
381 |
/**
|
382 |
* Pending Payment Column Content
|
386 |
public function adjust_column_content( $column_name, $post_id ) {
|
387 |
|
388 |
global $mycred_modules;
|
|
|
389 |
switch ( $column_name ) {
|
390 |
case 'User' :
|
391 |
|
392 |
+
$from = (int) check_site_get_post_meta( $post_id, 'from', true );
|
393 |
+
$from = (int) check_site_get_post_meta( $post_id, 'from', true );
|
394 |
$user = get_userdata( $from );
|
395 |
|
396 |
if ( isset( $user->display_name ) )
|
401 |
break;
|
402 |
case 'Points';
|
403 |
|
404 |
+
$type = check_site_get_post_meta( $post_id, 'point_type', true );
|
405 |
+
$points = check_site_get_post_meta( $post_id, 'points', true );
|
406 |
$mycred = mycred( $type );
|
407 |
|
408 |
echo $mycred->format_creds( $points );
|
410 |
break;
|
411 |
case 'cost';
|
412 |
|
413 |
+
$cost = check_site_get_post_meta( $post_id, 'cost', true );
|
414 |
+
$currency = check_site_get_post_meta( $post_id, 'currency', true );
|
415 |
echo $cost . ' ' . $currency;
|
416 |
|
417 |
break;
|
418 |
case 'amount';
|
419 |
|
420 |
+
$points = check_site_get_post_meta( $post_id, 'points', true );
|
421 |
+
$cost = check_site_get_post_meta( $post_id, 'cost', true );
|
422 |
+
$currency = check_site_get_post_meta( $post_id, 'currency', true );
|
423 |
echo $currency .' ' . $points * $cost;
|
424 |
|
425 |
break;
|
426 |
case 'gateway';
|
427 |
|
428 |
+
$gateway = check_site_get_post_meta( $post_id, 'gateway', true );
|
429 |
$installed = $mycred_modules['solo']['cashcred']->get();
|
430 |
|
431 |
if ( isset( $installed[ $gateway ] ) )
|
436 |
break;
|
437 |
case 'ctype';
|
438 |
|
439 |
+
$type = check_site_get_post_meta( $post_id, 'point_type', true );
|
440 |
|
441 |
if ( isset( $this->point_types[ $type ] ) )
|
442 |
echo $this->point_types[ $type ];
|
445 |
|
446 |
break;
|
447 |
case 'status';
|
448 |
+
$status = check_site_get_post_meta( $post_id, 'status', true );
|
449 |
echo "<div class='cashcred_bages'><span class='cashcred_" . $status . "'>" . $status . "</span></div>";
|
450 |
|
451 |
break;
|
1101 |
$old_status = mycred_get_post_meta( $post_id, 'status', true );
|
1102 |
$new_status = sanitize_text_field( $_POST['status'] );
|
1103 |
|
1104 |
+
$user_settings = mycred_get_user_meta( $_POST['user_id'], cashcred_get_user_settings(), '', true );
|
1105 |
$updated_user_settings = $_POST['cashcred_user_settings'];
|
1106 |
|
1107 |
$changed_fields = array();
|
1113 |
'cost' => __( 'Cost', 'mycred' ),
|
1114 |
'currency' => __( 'Currency', 'mycred' )
|
1115 |
);
|
|
|
|
|
1116 |
|
1117 |
+
check_site_update_post_meta( $post_id, 'status', $new_status );
|
1118 |
+
|
1119 |
+
mycred_update_user_meta( $_POST['user_id'], cashcred_get_user_settings(), '', $updated_user_settings );
|
1120 |
+
|
1121 |
foreach ( $pending_payment as $meta_key => $meta_value ) {
|
1122 |
|
1123 |
$new_value = sanitize_text_field( $meta_value );
|
1124 |
+
$old_value = check_site_get_post_meta( $post_id, $meta_key, true );
|
1125 |
|
1126 |
if ( $new_value != $old_value ) {
|
1127 |
+
check_site_update_post_meta( $post_id, $meta_key, $new_value );
|
1128 |
$changed_fields[] = $withdraw_request_messages[ $meta_key ];
|
1129 |
}
|
1130 |
+
|
1131 |
}
|
1132 |
|
1133 |
$changes = join( ", ", $changed_fields );
|
addons/gateway/carts/mycred-woocommerce.php
CHANGED
@@ -552,7 +552,7 @@ if ( ! function_exists( 'mycred_woo_available_gateways' ) ) :
|
|
552 |
|
553 |
// Calculate cost in CREDs
|
554 |
$currency = get_woocommerce_currency();
|
555 |
-
|
556 |
$cost = $woocommerce->cart->total;
|
557 |
if ( ! mycred_point_type_exists( $currency ) && $currency != 'MYC' )
|
558 |
$cost = $mycred->number( ( $woocommerce->cart->total / $gateways['mycred']->get_option( 'exchange_rate' ) ) );
|
552 |
|
553 |
// Calculate cost in CREDs
|
554 |
$currency = get_woocommerce_currency();
|
555 |
+
if(!is_object($woocommerce)) return;
|
556 |
$cost = $woocommerce->cart->total;
|
557 |
if ( ! mycred_point_type_exists( $currency ) && $currency != 'MYC' )
|
558 |
$cost = $mycred->number( ( $woocommerce->cart->total / $gateways['mycred']->get_option( 'exchange_rate' ) ) );
|
includes/hooks/mycred-hook-site-visits.php
CHANGED
@@ -34,7 +34,7 @@ if ( ! class_exists( 'myCRED_Hook_Site_Visits' ) ) :
|
|
34 |
// Make sure user is logged in. Also to prevent unneccery db queries we
|
35 |
// check to make sure the user does not have the cookie.
|
36 |
if ( is_user_logged_in() && ! isset( $_COOKIE['mycred_site_visit'] ) )
|
37 |
-
add_action( '
|
38 |
|
39 |
}
|
40 |
|
@@ -53,7 +53,7 @@ if ( ! class_exists( 'myCRED_Hook_Site_Visits' ) ) :
|
|
53 |
|
54 |
// Set cookie to prevent db queries again today.
|
55 |
$lifespan = (int) ( 24*3600 ) - ( date( 'H', $now ) * 3600 + date( 'i', $now ) * 60 + date( 's', $now ) );
|
56 |
-
if ( ! headers_sent() ) setcookie( 'mycred_site_visit', 1,
|
57 |
|
58 |
// Make sure user is not excluded
|
59 |
if ( $this->core->exclude_user( $user_id ) ) return;
|
34 |
// Make sure user is logged in. Also to prevent unneccery db queries we
|
35 |
// check to make sure the user does not have the cookie.
|
36 |
if ( is_user_logged_in() && ! isset( $_COOKIE['mycred_site_visit'] ) )
|
37 |
+
add_action( 'init', array( $this, 'site_visit' ) );
|
38 |
|
39 |
}
|
40 |
|
53 |
|
54 |
// Set cookie to prevent db queries again today.
|
55 |
$lifespan = (int) ( 24*3600 ) - ( date( 'H', $now ) * 3600 + date( 'i', $now ) * 60 + date( 's', $now ) );
|
56 |
+
if ( ! headers_sent() ) setcookie( 'mycred_site_visit', 1, time() +$lifespan, COOKIEPATH, COOKIE_DOMAIN, true );
|
57 |
|
58 |
// Make sure user is not excluded
|
59 |
if ( $this->core->exclude_user( $user_id ) ) return;
|
includes/mycred-about.php
CHANGED
@@ -153,7 +153,7 @@ function mycred_about_header() {
|
|
153 |
<div class="mycred_about_header">
|
154 |
<div class="wp-badge" id="mycred-badge"></div>
|
155 |
<div class="mycred_about_header-title">
|
156 |
-
<p><?php printf( '%s
|
157 |
</div>
|
158 |
</div>
|
159 |
<?php
|
153 |
<div class="mycred_about_header">
|
154 |
<div class="wp-badge" id="mycred-badge"></div>
|
155 |
<div class="mycred_about_header-title">
|
156 |
+
<p><?php printf( '%s <span>%s</span>', $name, myCRED_VERSION ); ?></span></p>
|
157 |
</div>
|
158 |
</div>
|
159 |
<?php
|
membership/mycred-connect-membership.php
CHANGED
@@ -512,7 +512,7 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
|
|
512 |
|
513 |
public function get_membership_addons() {
|
514 |
|
515 |
-
$membership_details = mycred_get_membership_details();
|
516 |
$addons = array();
|
517 |
|
518 |
if(isset($membership_details['addons']) && !empty($membership_details['addons'])){
|
512 |
|
513 |
public function get_membership_addons() {
|
514 |
|
515 |
+
$membership_details = mycred_get_membership_details(true);
|
516 |
$addons = array();
|
517 |
|
518 |
if(isset($membership_details['addons']) && !empty($membership_details['addons'])){
|
membership/subscription-functions.php
CHANGED
@@ -206,6 +206,13 @@ if( !function_exists('mycred_is_membership_active') ) {
|
|
206 |
|
207 |
$membership_status = wp_cache_get('mycred_membership_status');
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
if( false === $membership_status ) {
|
210 |
|
211 |
$user_license_key = mycred_get_membership_key();
|
@@ -214,10 +221,16 @@ if( !function_exists('mycred_is_membership_active') ) {
|
|
214 |
|
215 |
$url = rtrim( get_bloginfo( 'url' ), '/' );
|
216 |
if( $mycred_version >= 188 && !empty( $user_license_key ) &&
|
217 |
-
mycred_get_membership_details()['plan'][0]['key'] == $user_license_key &&
|
218 |
-
in_array( $url, mycred_get_membership_details()['sites'][0] )
|
219 |
) {
|
220 |
$membership_status = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
222 |
wp_cache_set( 'mycred_membership_status', $membership_status );
|
223 |
}
|
@@ -233,7 +246,36 @@ if( !function_exists('mycred_is_membership_active') ) {
|
|
233 |
* @version 1.1
|
234 |
*/
|
235 |
if( !function_exists('mycred_get_membership_details') ) {
|
236 |
-
function mycred_get_membership_details() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
|
238 |
$membership_details = wp_cache_get('mycred_membership_details');
|
239 |
|
@@ -246,6 +288,26 @@ if( !function_exists('mycred_get_membership_details') ) {
|
|
246 |
|
247 |
$membership_details = json_decode( $data['body'], true );
|
248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
} else {
|
250 |
|
251 |
$membership_details = array (
|
@@ -275,4 +337,37 @@ if( !function_exists('mycred_get_membership_details') ) {
|
|
275 |
return $membership_details;
|
276 |
|
277 |
}
|
278 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
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 |
}
|
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 |
|
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 (
|
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 |
+
}
|
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.0.
|
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.0.
|
24 |
|
25 |
// Instnace
|
26 |
protected static $_instance = NULL;
|
@@ -54,14 +54,14 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
54 |
* @since 1.7
|
55 |
* @version 1.0
|
56 |
*/
|
57 |
-
public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '2.0.
|
58 |
|
59 |
/**
|
60 |
* Not allowed
|
61 |
* @since 1.7
|
62 |
* @version 1.0
|
63 |
*/
|
64 |
-
public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '2.0.
|
65 |
|
66 |
/**
|
67 |
* Get
|
@@ -82,7 +82,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
82 |
if ( ! defined( $name ) )
|
83 |
define( $name, $value );
|
84 |
elseif ( ! $definable && defined( $name ) )
|
85 |
-
_doing_it_wrong( 'myCRED_Core->define()', 'Could not define: ' . $name . ' as it is already defined somewhere else!', '2.0.
|
86 |
}
|
87 |
|
88 |
/**
|
@@ -94,7 +94,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
94 |
if ( file_exists( $required_file ) )
|
95 |
require_once $required_file;
|
96 |
else
|
97 |
-
_doing_it_wrong( 'myCRED_Core->file()', 'Requested file ' . $required_file . ' not found.', '2.0.
|
98 |
}
|
99 |
|
100 |
/**
|
@@ -150,6 +150,8 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
150 |
add_filter( 'plugin_action_links_mycred/mycred.php', array( $this, 'plugin_links' ), 10, 4 );
|
151 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_description_links' ), 10, 2 );
|
152 |
add_action( 'admin_menu', array( $this, 'plugin_about_page' ), 10 );
|
|
|
|
|
153 |
|
154 |
}
|
155 |
|
@@ -1109,6 +1111,43 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
1109 |
|
1110 |
}
|
1111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1112 |
/**
|
1113 |
* Plugin About Menu
|
1114 |
* @since 2.0
|
3 |
* Plugin Name: myCred
|
4 |
* Plugin URI: https://mycred.me
|
5 |
* Description: An adaptive points management system for WordPress powered websites.
|
6 |
+
* Version: 2.0.2
|
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.0.2';
|
24 |
|
25 |
// Instnace
|
26 |
protected static $_instance = NULL;
|
54 |
* @since 1.7
|
55 |
* @version 1.0
|
56 |
*/
|
57 |
+
public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '2.0.2' ); }
|
58 |
|
59 |
/**
|
60 |
* Not allowed
|
61 |
* @since 1.7
|
62 |
* @version 1.0
|
63 |
*/
|
64 |
+
public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '2.0.2' ); }
|
65 |
|
66 |
/**
|
67 |
* Get
|
82 |
if ( ! defined( $name ) )
|
83 |
define( $name, $value );
|
84 |
elseif ( ! $definable && defined( $name ) )
|
85 |
+
_doing_it_wrong( 'myCRED_Core->define()', 'Could not define: ' . $name . ' as it is already defined somewhere else!', '2.0.2' );
|
86 |
}
|
87 |
|
88 |
/**
|
94 |
if ( file_exists( $required_file ) )
|
95 |
require_once $required_file;
|
96 |
else
|
97 |
+
_doing_it_wrong( 'myCRED_Core->file()', 'Requested file ' . $required_file . ' not found.', '2.0.2' );
|
98 |
}
|
99 |
|
100 |
/**
|
150 |
add_filter( 'plugin_action_links_mycred/mycred.php', array( $this, 'plugin_links' ), 10, 4 );
|
151 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_description_links' ), 10, 2 );
|
152 |
add_action( 'admin_menu', array( $this, 'plugin_about_page' ), 10 );
|
153 |
+
add_filter( 'pre_http_request', array( $this, 'handle_license_request' ), 10, 3 );
|
154 |
+
add_filter( 'http_request_args', array( $this, 'license_request_args' ), 10, 2 );
|
155 |
|
156 |
}
|
157 |
|
1111 |
|
1112 |
}
|
1113 |
|
1114 |
+
/**
|
1115 |
+
* Handle Premium Addon License requests
|
1116 |
+
* @since 1.9
|
1117 |
+
* @version 1.0
|
1118 |
+
*/
|
1119 |
+
public function handle_license_request( $default, $parsed_args, $url ) {
|
1120 |
+
|
1121 |
+
if( $url == 'http://mycred.me/api/plugins/' && ! empty( $parsed_args['body']['action'] ) && $parsed_args['body']['action'] == 'info' ) {
|
1122 |
+
|
1123 |
+
$request = unserialize( $parsed_args['body']['request'] );
|
1124 |
+
|
1125 |
+
if( get_transient( 'mycred_license_' . $request['slug'] ) )
|
1126 |
+
return true;
|
1127 |
+
else
|
1128 |
+
set_transient( 'mycred_license_' . $request['slug'], $parsed_args, 24 * HOUR_IN_SECONDS );
|
1129 |
+
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
return $default;
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
/**
|
1136 |
+
* Add argument for handling license request
|
1137 |
+
* @since 1.9
|
1138 |
+
* @version 1.0
|
1139 |
+
*/
|
1140 |
+
public function license_request_args( $parsed_args, $url ) {
|
1141 |
+
|
1142 |
+
if( $url == 'http://mycred.me/api/plugins/' && ! empty( $parsed_args['body']['action'] ) ) {
|
1143 |
+
|
1144 |
+
$parsed_args['body']['optimize_license'] = true;
|
1145 |
+
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
return $parsed_args;
|
1149 |
+
}
|
1150 |
+
|
1151 |
/**
|
1152 |
* Plugin About Menu
|
1153 |
* @since 2.0
|
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: 5.6
|
6 |
-
Stable tag: 2.0.
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -26,7 +26,7 @@ myCred allows **THREE different ways** through which you can award your users:
|
|
26 |
|
27 |
* **Ranks -** Set ranks within your leaderboards and reward your users with significant perks after they reach a certain milestone.
|
28 |
|
29 |
-
* **Badges -** Boost your users
|
30 |
|
31 |
= BECOME A VIP MEMBER OF THE MYCRED MEMBERSHIP CLUB =
|
32 |
|
@@ -96,20 +96,20 @@ Not only will you be able to manually adjust the point balance system at any tim
|
|
96 |
|
97 |
= AWARD OR DEDUCT POINTS AUTOMATICALLY =
|
98 |
|
99 |
-
**myCred** supports an extensive set of WordPress interactions through which you can automatically give/take points from a user. These actions can be as simple as logging in, publishing content, or leaving a comment. These automatic adjustments are managed by a feature called
|
100 |
|
101 |
|
102 |
= DEDICATED LOG =
|
103 |
|
104 |
-
Each time **myCred** adds or deducts points from a user, the adjustment is [logged](https://mycred.me/about/features/#account-history) in a dedicated log, allowing your users to browse their history. This log keeps a record of your user
|
105 |
|
106 |
This log data can be converted into charts to help you visualize the usage and circulation of points on your website.
|
107 |
|
108 |
You can achieve the following features by using a dedicated log for your points system:
|
109 |
|
110 |
* Set a limit to the maximum number of times each hook can give out points to your user.
|
111 |
-
* Badges will use the log
|
112 |
-
* Add-ons such as
|
113 |
* Add-ons use the log to make sure that a user does not gain repetitive points for the same interaction within a given time frame.
|
114 |
|
115 |
= BUILT-IN ADD-ONS =
|
@@ -122,7 +122,7 @@ myCred is much more than just a point management system - The plugin comes with
|
|
122 |
**- Email notifications:** Setup email notifications for status updates.
|
123 |
**- Gateway:** Let users pay with points in your store.
|
124 |
**- Notifications:** Enable popup notifications that display status updates.
|
125 |
-
**- Ranks:** Create ranks based on the user
|
126 |
**- Sell Content:** Sell your content in exchange for points.
|
127 |
**- Statistics:** Get a statistical overview of points in circulation, etc.
|
128 |
**- Transfers:** Allow your users to transfer points to other users.
|
@@ -133,7 +133,7 @@ Power your WordPress website with 50+ add-ons ranging from categories like **Gam
|
|
133 |
|
134 |
myCred supports some of the most popular WordPress plugins like **BuddyPress, WooCommerce, Jetpack, Contact Form 7, Disqus, Gravity Forms,** among countless others.
|
135 |
|
136 |
-
**Simple & organized
|
137 |
|
138 |
|
139 |
= INTEGRATED WITH THE MOST POPULAR LEARNING MANAGEMENT SYSTEMS =
|
@@ -205,7 +205,7 @@ You can find extensive [documentation](http://codex.mycred.me/) on myCred relate
|
|
205 |
|
206 |
= Customizations =
|
207 |
|
208 |
-
myCred has the ability to
|
209 |
|
210 |
|
211 |
= Support =
|
@@ -335,6 +335,13 @@ Bug fixes release.
|
|
335 |
|
336 |
== Changelog ==
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
= 2.0.1 =
|
339 |
FIX - myCred membership license not activating for members
|
340 |
|
@@ -494,7 +501,7 @@ TWEAK - myCred Central Deposit
|
|
494 |
- **FIX** - setCookie function error when adding new hook.
|
495 |
|
496 |
= 1.8.4 =
|
497 |
-
- **NEW** - Introduce a new filter
|
498 |
- **NEW** - Add new action "mycred_pref_hooks" on mycred hooks page
|
499 |
- **TWEAK** - Limits are showing for Approved comments hook in [mycred_hook_table] shortcode.
|
500 |
- **FIX** - Sell content undefined offset in Backend Pages & Posts.
|
3 |
Tags: badges, gamification, loyalty, points, rewards
|
4 |
Requires at least: 4.8
|
5 |
Tested up to: 5.6
|
6 |
+
Stable tag: 2.0.2
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
26 |
|
27 |
* **Ranks -** Set ranks within your leaderboards and reward your users with significant perks after they reach a certain milestone.
|
28 |
|
29 |
+
* **Badges -** Boost your users participation by rewarding them for their exceptional performance.
|
30 |
|
31 |
= BECOME A VIP MEMBER OF THE MYCRED MEMBERSHIP CLUB =
|
32 |
|
96 |
|
97 |
= AWARD OR DEDUCT POINTS AUTOMATICALLY =
|
98 |
|
99 |
+
**myCred** supports an extensive set of WordPress interactions through which you can automatically give/take points from a user. These actions can be as simple as logging in, publishing content, or leaving a comment. These automatic adjustments are managed by a feature called [Hooks](https://mycred.me/about/features/#automatic-points) that can be set up in your admin area.
|
100 |
|
101 |
|
102 |
= DEDICATED LOG =
|
103 |
|
104 |
+
Each time **myCred** adds or deducts points from a user, the adjustment is [logged](https://mycred.me/about/features/#account-history) 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.
|
105 |
|
106 |
This log data can be converted into charts to help you visualize the usage and circulation of points on your website.
|
107 |
|
108 |
You can achieve the following features by using a dedicated log for your points system:
|
109 |
|
110 |
* Set a limit to the maximum number of times each hook can give out points to your user.
|
111 |
+
* Badges will use the log's data to determine which user has earned a badge.
|
112 |
+
* Add-ons such as "Sell Content" use the log to keep track of users who have purchased posts from your website.
|
113 |
* Add-ons use the log to make sure that a user does not gain repetitive points for the same interaction within a given time frame.
|
114 |
|
115 |
= BUILT-IN ADD-ONS =
|
122 |
**- Email notifications:** Setup email notifications for status updates.
|
123 |
**- Gateway:** Let users pay with points in your store.
|
124 |
**- Notifications:** Enable popup notifications that display status updates.
|
125 |
+
**- Ranks:** Create ranks based on the user's point balance.
|
126 |
**- Sell Content:** Sell your content in exchange for points.
|
127 |
**- Statistics:** Get a statistical overview of points in circulation, etc.
|
128 |
**- Transfers:** Allow your users to transfer points to other users.
|
133 |
|
134 |
myCred supports some of the most popular WordPress plugins like **BuddyPress, WooCommerce, Jetpack, Contact Form 7, Disqus, Gravity Forms,** among countless others.
|
135 |
|
136 |
+
**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.
|
137 |
|
138 |
|
139 |
= INTEGRATED WITH THE MOST POPULAR LEARNING MANAGEMENT SYSTEMS =
|
205 |
|
206 |
= Customizations =
|
207 |
|
208 |
+
myCred has the ability to "do-it-all" because we have put in a lot of effort to make sure that the supported plugins are as developer-friendly as possible. If you need to build a custom feature, simply submit a [request for a quote](https://mycred.me/customize/request-quote/) via the myCred website.
|
209 |
|
210 |
|
211 |
= Support =
|
335 |
|
336 |
== Changelog ==
|
337 |
|
338 |
+
= 2.0.2 =
|
339 |
+
New - Added compatibility for multiple currencies in CashCred Paypal addon
|
340 |
+
Fix - Php erros in myCred woocommerce gateway
|
341 |
+
Fix - Points on daily visit hooks not working in some conditions
|
342 |
+
Fix - myCred CashCred multisite issues
|
343 |
+
Improvement - license system
|
344 |
+
|
345 |
= 2.0.1 =
|
346 |
FIX - myCred membership license not activating for members
|
347 |
|
501 |
- **FIX** - setCookie function error when adding new hook.
|
502 |
|
503 |
= 1.8.4 =
|
504 |
+
- **NEW** - Introduce a new filter "mycred_option_id" for manipulating hooks.
|
505 |
- **NEW** - Add new action "mycred_pref_hooks" on mycred hooks page
|
506 |
- **TWEAK** - Limits are showing for Approved comments hook in [mycred_hook_table] shortcode.
|
507 |
- **FIX** - Sell content undefined offset in Backend Pages & Posts.
|