Version Description
Bug fixes.
=
Download this release
Release Info
Developer | designbymerovingi |
Plugin | myCRED |
Version | 1.7.9.4 |
Comparing to | |
See all releases |
Code changes from version 1.7.9.2 to 1.7.9.4
- addons/badges/includes/mycred-badge-object.php +2 -0
- addons/badges/myCRED-addon-badges.php +4 -1
- addons/buy-creds/abstracts/mycred-abstract-payment-gateway.php +2 -8
- addons/buy-creds/gateways/bitpay.php +3 -2
- addons/buy-creds/modules/buycred-module-core.php +6 -2
- addons/ranks/includes/mycred-rank-functions.php +6 -2
- addons/transfer/includes/mycred-transfer-shortcodes.php +2 -2
- includes/classes/class.query-leaderboard.php +2 -2
- includes/classes/class.query-log.php +25 -18
- includes/mycred-about.php +11 -100
- includes/mycred-overview.php +24 -17
- includes/shortcodes/mycred_best_user.php +6 -1
- modules/mycred-module-addons.php +12 -8
- mycred.php +6 -16
- plugins/mycred-hook-jetpack.php +34 -419
- readme.txt +9 -16
addons/badges/includes/mycred-badge-object.php
CHANGED
@@ -64,12 +64,14 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
|
|
64 |
public function get_image( $image = NULL ) {
|
65 |
|
66 |
$image_identification = false;
|
|
|
67 |
|
68 |
if ( $image === 'main' )
|
69 |
$image_identification = get_post_meta( $this->post_id, 'main_image', true );
|
70 |
|
71 |
elseif ( $image !== NULL && is_numeric( $image ) && isset( $this->levels[ $image ]['attachment_id'] ) ) {
|
72 |
|
|
|
73 |
$image_identification = $this->levels[ $image ]['image_url'];
|
74 |
if ( $this->levels[ $image ]['attachment_id'] > 0 )
|
75 |
$image_identification = $this->levels[ $image ]['attachment_id'];
|
64 |
public function get_image( $image = NULL ) {
|
65 |
|
66 |
$image_identification = false;
|
67 |
+
$level = 0;
|
68 |
|
69 |
if ( $image === 'main' )
|
70 |
$image_identification = get_post_meta( $this->post_id, 'main_image', true );
|
71 |
|
72 |
elseif ( $image !== NULL && is_numeric( $image ) && isset( $this->levels[ $image ]['attachment_id'] ) ) {
|
73 |
|
74 |
+
$level = $image;
|
75 |
$image_identification = $this->levels[ $image ]['image_url'];
|
76 |
if ( $this->levels[ $image ]['attachment_id'] > 0 )
|
77 |
$image_identification = $this->levels[ $image ]['attachment_id'];
|
addons/badges/myCRED-addon-badges.php
CHANGED
@@ -1365,7 +1365,7 @@ jQuery(function($) {
|
|
1365 |
/**
|
1366 |
* Save Manual Badges
|
1367 |
* @since 1.0
|
1368 |
-
* @version 1.0
|
1369 |
*/
|
1370 |
public function save_manual_badges( $user_id ) {
|
1371 |
|
@@ -1405,6 +1405,9 @@ jQuery(function($) {
|
|
1405 |
}
|
1406 |
}
|
1407 |
|
|
|
|
|
|
|
1408 |
}
|
1409 |
|
1410 |
}
|
1365 |
/**
|
1366 |
* Save Manual Badges
|
1367 |
* @since 1.0
|
1368 |
+
* @version 1.0.1
|
1369 |
*/
|
1370 |
public function save_manual_badges( $user_id ) {
|
1371 |
|
1405 |
}
|
1406 |
}
|
1407 |
|
1408 |
+
if ( $added > 0 || $removed > 0 || $updated > 0 )
|
1409 |
+
mycred_delete_user_meta( $user_id, 'mycred_badge_ids' );
|
1410 |
+
|
1411 |
}
|
1412 |
|
1413 |
}
|
addons/buy-creds/abstracts/mycred-abstract-payment-gateway.php
CHANGED
@@ -1713,17 +1713,11 @@ if ( ! class_exists( 'myCRED_Payment_Gateway' ) ) :
|
|
1713 |
/**
|
1714 |
* Trash Pending Payment
|
1715 |
* @since 1.5.3
|
1716 |
-
* @version 1.0
|
1717 |
*/
|
1718 |
function trash_pending_payment( $payment_id ) {
|
1719 |
|
1720 |
-
|
1721 |
-
$post = get_post( $payment_id );
|
1722 |
-
else
|
1723 |
-
$post = get_page_by_title( $payment_id, OBJECT, 'buycred_payment' );
|
1724 |
-
|
1725 |
-
if ( isset( $post->ID ) )
|
1726 |
-
wp_trash_post( $post->ID );
|
1727 |
|
1728 |
}
|
1729 |
|
1713 |
/**
|
1714 |
* Trash Pending Payment
|
1715 |
* @since 1.5.3
|
1716 |
+
* @version 1.0.1
|
1717 |
*/
|
1718 |
function trash_pending_payment( $payment_id ) {
|
1719 |
|
1720 |
+
return buycred_trash_pending_payment( $payment_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
1721 |
|
1722 |
}
|
1723 |
|
addons/buy-creds/gateways/bitpay.php
CHANGED
@@ -156,7 +156,7 @@ if ( ! class_exists( 'myCRED_Bitpay' ) ) :
|
|
156 |
/**
|
157 |
* Buy Creds
|
158 |
* @since 1.4
|
159 |
-
* @version 1.2
|
160 |
*/
|
161 |
public function buy() {
|
162 |
|
@@ -200,7 +200,8 @@ if ( ! class_exists( 'myCRED_Bitpay' ) ) :
|
|
200 |
'fullNotifications' => ( $this->prefs['notifications'] ) ? true : false,
|
201 |
'posData' => $this->transaction_id,
|
202 |
'buyerName' => $this->get_buyers_name( $from ),
|
203 |
-
'itemDesc' => $item_name
|
|
|
204 |
) );
|
205 |
|
206 |
// Request Failed
|
156 |
/**
|
157 |
* Buy Creds
|
158 |
* @since 1.4
|
159 |
+
* @version 1.2.1
|
160 |
*/
|
161 |
public function buy() {
|
162 |
|
200 |
'fullNotifications' => ( $this->prefs['notifications'] ) ? true : false,
|
201 |
'posData' => $this->transaction_id,
|
202 |
'buyerName' => $this->get_buyers_name( $from ),
|
203 |
+
'itemDesc' => $item_name,
|
204 |
+
'redirectURL' => $this->get_thankyou()
|
205 |
) );
|
206 |
|
207 |
// Request Failed
|
addons/buy-creds/modules/buycred-module-core.php
CHANGED
@@ -573,6 +573,10 @@ if ( ! class_exists( 'myCRED_buyCRED_Module' ) ) :
|
|
573 |
*/
|
574 |
public function settings_header() {
|
575 |
|
|
|
|
|
|
|
|
|
576 |
}
|
577 |
|
578 |
/**
|
@@ -588,7 +592,7 @@ if ( ! class_exists( 'myCRED_buyCRED_Module' ) ) :
|
|
588 |
$installed = $this->get();
|
589 |
|
590 |
?>
|
591 |
-
<div class="wrap list" id="myCRED-wrap">
|
592 |
<h1><?php printf( __( '%s Payment Gateways', 'mycred' ), '<strong>buy</strong>CRED' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'page' => MYCRED_SLUG . '-settings', 'open-tab' => 'buycred_module' ), admin_url( 'admin.php' ) ) ); ?>" class="page-title-action"><?php _e( 'Settings', 'mycred' ); ?></a></h1>
|
593 |
<?php
|
594 |
|
@@ -597,7 +601,7 @@ if ( ! class_exists( 'myCRED_buyCRED_Module' ) ) :
|
|
597 |
echo '<div class="updated settings-error"><p>' . __( 'Settings Updated', 'mycred' ) . '</p></div>';
|
598 |
|
599 |
?>
|
600 |
-
<form method="post" action="options.php">
|
601 |
|
602 |
<?php settings_fields( $this->settings_name ); ?>
|
603 |
|
573 |
*/
|
574 |
public function settings_header() {
|
575 |
|
576 |
+
wp_enqueue_style( 'mycred-admin' );
|
577 |
+
wp_enqueue_style( 'mycred-bootstrap-grid' );
|
578 |
+
wp_enqueue_style( 'mycred-forms' );
|
579 |
+
|
580 |
}
|
581 |
|
582 |
/**
|
592 |
$installed = $this->get();
|
593 |
|
594 |
?>
|
595 |
+
<div class="wrap list mycred-metabox" id="myCRED-wrap">
|
596 |
<h1><?php printf( __( '%s Payment Gateways', 'mycred' ), '<strong>buy</strong>CRED' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'page' => MYCRED_SLUG . '-settings', 'open-tab' => 'buycred_module' ), admin_url( 'admin.php' ) ) ); ?>" class="page-title-action"><?php _e( 'Settings', 'mycred' ); ?></a></h1>
|
597 |
<?php
|
598 |
|
601 |
echo '<div class="updated settings-error"><p>' . __( 'Settings Updated', 'mycred' ) . '</p></div>';
|
602 |
|
603 |
?>
|
604 |
+
<form method="post" action="options.php" class="form">
|
605 |
|
606 |
<?php settings_fields( $this->settings_name ); ?>
|
607 |
|
addons/ranks/includes/mycred-rank-functions.php
CHANGED
@@ -478,7 +478,7 @@ endif;
|
|
478 |
* appropriate ranks.
|
479 |
* @returns void
|
480 |
* @since 1.3.2
|
481 |
-
* @version 1.5.
|
482 |
*/
|
483 |
if ( ! function_exists( 'mycred_assign_ranks' ) ) :
|
484 |
function mycred_assign_ranks( $point_type = MYCRED_DEFAULT_TYPE_KEY ) {
|
@@ -501,6 +501,10 @@ if ( ! function_exists( 'mycred_assign_ranks' ) ) :
|
|
501 |
|
502 |
$ranks = mycred_get_ranks( 'publish', '-1', 'ASC', $point_type );
|
503 |
|
|
|
|
|
|
|
|
|
504 |
$count = 0;
|
505 |
if ( ! empty( $ranks ) ) {
|
506 |
foreach ( $ranks as $rank ) {
|
@@ -510,7 +514,7 @@ if ( ! function_exists( 'mycred_assign_ranks' ) ) :
|
|
510 |
INNER JOIN {$wpdb->usermeta} balance ON ( ranks.user_id = balance.user_id AND balance.meta_key = %s )
|
511 |
SET ranks.meta_value = %d
|
512 |
WHERE ranks.meta_key = %s
|
513 |
-
AND balance.meta_value BETWEEN {$balance_format} AND {$balance_format};",
|
514 |
|
515 |
}
|
516 |
}
|
478 |
* appropriate ranks.
|
479 |
* @returns void
|
480 |
* @since 1.3.2
|
481 |
+
* @version 1.5.2
|
482 |
*/
|
483 |
if ( ! function_exists( 'mycred_assign_ranks' ) ) :
|
484 |
function mycred_assign_ranks( $point_type = MYCRED_DEFAULT_TYPE_KEY ) {
|
501 |
|
502 |
$ranks = mycred_get_ranks( 'publish', '-1', 'ASC', $point_type );
|
503 |
|
504 |
+
$balance_key = mycred_get_meta_key( $point_type );
|
505 |
+
if ( mycred_rank_based_on_total( $point_type ) )
|
506 |
+
$balance_key = mycred_get_meta_key( $point_type, '_total' );
|
507 |
+
|
508 |
$count = 0;
|
509 |
if ( ! empty( $ranks ) ) {
|
510 |
foreach ( $ranks as $rank ) {
|
514 |
INNER JOIN {$wpdb->usermeta} balance ON ( ranks.user_id = balance.user_id AND balance.meta_key = %s )
|
515 |
SET ranks.meta_value = %d
|
516 |
WHERE ranks.meta_key = %s
|
517 |
+
AND balance.meta_value BETWEEN {$balance_format} AND {$balance_format};", $balance_key, $rank->post_id, mycred_get_meta_key( 'mycred_rank', $end ), $rank->minimum, $rank->maximum ) );
|
518 |
|
519 |
}
|
520 |
}
|
addons/transfer/includes/mycred-transfer-shortcodes.php
CHANGED
@@ -6,7 +6,7 @@ if ( ! defined( 'myCRED_VERSION' ) ) exit;
|
|
6 |
* Renders a transfer form that allows users to send points to other users.
|
7 |
* @see http://mycred.me/functions/mycred_transfer_render/
|
8 |
* @since 0.1
|
9 |
-
* @version 1.7.
|
10 |
*/
|
11 |
if ( ! function_exists( 'mycred_transfer_render' ) ) :
|
12 |
function mycred_transfer_render( $atts, $content = NULL ) {
|
@@ -164,7 +164,7 @@ if ( ! function_exists( 'mycred_transfer_render' ) ) :
|
|
164 |
}
|
165 |
|
166 |
// Recipient Input field
|
167 |
-
$to_input = '<input type="text" name="mycred_new_transfer[recipient_id]" value="" aria-required="true" class="mycred-autofill
|
168 |
|
169 |
// If recipient is set, pre-populate it with the recipients details
|
170 |
if ( $pay_to != '' ) {
|
6 |
* Renders a transfer form that allows users to send points to other users.
|
7 |
* @see http://mycred.me/functions/mycred_transfer_render/
|
8 |
* @since 0.1
|
9 |
+
* @version 1.7.4
|
10 |
*/
|
11 |
if ( ! function_exists( 'mycred_transfer_render' ) ) :
|
12 |
function mycred_transfer_render( $atts, $content = NULL ) {
|
164 |
}
|
165 |
|
166 |
// Recipient Input field
|
167 |
+
$to_input = '<input type="text" name="mycred_new_transfer[recipient_id]" value="" aria-required="true" class="form-control' . ( ( $pref['autofill'] != 'none' ) ? ' mycred-autofill' : '' ) . '" data-form="' . $ref . '" placeholder="' . $placeholder . '" />';
|
168 |
|
169 |
// If recipient is set, pre-populate it with the recipients details
|
170 |
if ( $pay_to != '' ) {
|
includes/classes/class.query-leaderboard.php
CHANGED
@@ -29,7 +29,7 @@ if ( ! class_exists( 'myCRED_Query_Leaderboard' ) ) :
|
|
29 |
* Preps the class for getting a leaderboard based on the
|
30 |
* given arguments. Validates these arguments.
|
31 |
* @since 1.0
|
32 |
-
* @version 1.0
|
33 |
*/
|
34 |
public function __construct( $args = array() ) {
|
35 |
|
@@ -55,7 +55,7 @@ if ( ! class_exists( 'myCRED_Query_Leaderboard' ) ) :
|
|
55 |
|
56 |
$this->limit = 'LIMIT ' . $this->args['number'];
|
57 |
if ( $this->args['offset'] != 0 )
|
58 |
-
$this->limit
|
59 |
|
60 |
}
|
61 |
|
29 |
* Preps the class for getting a leaderboard based on the
|
30 |
* given arguments. Validates these arguments.
|
31 |
* @since 1.0
|
32 |
+
* @version 1.0.1
|
33 |
*/
|
34 |
public function __construct( $args = array() ) {
|
35 |
|
55 |
|
56 |
$this->limit = 'LIMIT ' . $this->args['number'];
|
57 |
if ( $this->args['offset'] != 0 )
|
58 |
+
$this->limit = 'LIMIT ' . $this->args['offset'] . ', ' . $this->args['number'];
|
59 |
|
60 |
}
|
61 |
|
includes/classes/class.query-log.php
CHANGED
@@ -63,10 +63,17 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
63 |
'order' => 'DESC',
|
64 |
'ids' => false, // depreciated as of 1.7.5
|
65 |
'fields' => 'all', // in favor for fields
|
66 |
-
'paged' =>
|
|
|
67 |
);
|
68 |
$this->args = apply_filters( 'mycred_query_log_args', wp_parse_args( $args, $defaults ), $defaults );
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
/**
|
71 |
* Setup Point Format
|
72 |
* Make sure the core property is loaded for the correct point type as this will
|
@@ -958,20 +965,21 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
958 |
/**
|
959 |
* Get Page Number
|
960 |
* @since 1.4
|
961 |
-
* @version 1.0.
|
962 |
*/
|
963 |
public function get_pagenum() {
|
964 |
|
965 |
global $wp;
|
966 |
|
967 |
-
|
968 |
-
|
|
|
969 |
|
970 |
-
elseif ( isset( $_REQUEST[
|
971 |
-
$pagenum = absint( $_REQUEST[
|
972 |
|
973 |
-
elseif ( isset( $_REQUEST[
|
974 |
-
$pagenum = absint( $_REQUEST[
|
975 |
|
976 |
else return 1;
|
977 |
|
@@ -1150,7 +1158,7 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
1150 |
/**
|
1151 |
* Front Pagination
|
1152 |
* @since 1.7
|
1153 |
-
* @version 1.0.
|
1154 |
*/
|
1155 |
public function front_pagination( $pages_to_show = 5 ) {
|
1156 |
|
@@ -1165,6 +1173,7 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
1165 |
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
1166 |
$current_url = remove_query_arg( $removable_query_args, $current_url );
|
1167 |
$current_url = str_replace( '/' . $current . '/', '/', $current_url );
|
|
|
1168 |
|
1169 |
$pages_to_show = absint( $pages_to_show );
|
1170 |
if ( $pages_to_show === 0 ) $pages_to_show = 5;
|
@@ -1185,7 +1194,7 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
1185 |
else {
|
1186 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1187 |
'first-page',
|
1188 |
-
esc_url( remove_query_arg( '
|
1189 |
'«'
|
1190 |
);
|
1191 |
}
|
@@ -1195,7 +1204,7 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
1195 |
else {
|
1196 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1197 |
'prev-page',
|
1198 |
-
esc_url( add_query_arg( '
|
1199 |
'‹'
|
1200 |
);
|
1201 |
}
|
@@ -1212,7 +1221,7 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
1212 |
if ( $i != $current )
|
1213 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1214 |
'mycred-nav',
|
1215 |
-
esc_url( add_query_arg( '
|
1216 |
$i
|
1217 |
);
|
1218 |
|
@@ -1226,7 +1235,7 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
1226 |
else {
|
1227 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1228 |
'next-page' . $disable_last,
|
1229 |
-
esc_url( add_query_arg( '
|
1230 |
'›'
|
1231 |
);
|
1232 |
}
|
@@ -1236,7 +1245,7 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
1236 |
else {
|
1237 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1238 |
'last-page' . $disable_last,
|
1239 |
-
esc_url( add_query_arg( '
|
1240 |
'»'
|
1241 |
);
|
1242 |
}
|
@@ -1248,7 +1257,7 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
1248 |
/**
|
1249 |
* Pagination
|
1250 |
* @since 1.4
|
1251 |
-
* @version 1.1.
|
1252 |
*/
|
1253 |
public function pagination( $location = 'top', $id = '' ) {
|
1254 |
|
@@ -1264,12 +1273,10 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
|
|
1264 |
$current_url = str_replace( '/page/' . $current . '/', '/', $current_url );
|
1265 |
|
1266 |
$current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
|
|
|
1267 |
|
1268 |
if ( $this->have_entries() )
|
1269 |
$output = '<span class="displaying-num">' . sprintf( _n( '1 entry', '%d entries', $this->num_rows, 'mycred' ), $this->num_rows ) . '</span>';
|
1270 |
-
|
1271 |
-
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
1272 |
-
$current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
|
1273 |
|
1274 |
$total_pages_before = '<span class="paging-input">';
|
1275 |
$total_pages_after = '</span>';
|
63 |
'order' => 'DESC',
|
64 |
'ids' => false, // depreciated as of 1.7.5
|
65 |
'fields' => 'all', // in favor for fields
|
66 |
+
'paged' => '',
|
67 |
+
'page_arg' => 'page'
|
68 |
);
|
69 |
$this->args = apply_filters( 'mycred_query_log_args', wp_parse_args( $args, $defaults ), $defaults );
|
70 |
|
71 |
+
// Need to be sure the page_arg argument is set.
|
72 |
+
if ( ! array_key_exists( 'page_arg', $this->args ) ) $this->args['page_arg'] = 'page';
|
73 |
+
|
74 |
+
if ( $this->args['paged'] == '' )
|
75 |
+
$this->args['paged'] = $this->get_pagenum();
|
76 |
+
|
77 |
/**
|
78 |
* Setup Point Format
|
79 |
* Make sure the core property is loaded for the correct point type as this will
|
965 |
/**
|
966 |
* Get Page Number
|
967 |
* @since 1.4
|
968 |
+
* @version 1.0.3
|
969 |
*/
|
970 |
public function get_pagenum() {
|
971 |
|
972 |
global $wp;
|
973 |
|
974 |
+
$page_key = ( isset( $this->args['page_arg'] ) && $this->args['page_arg'] !== NULL && $this->args['page_arg'] != '' ) ? $this->args['page_arg'] : 'page';
|
975 |
+
if ( isset( $wp->query_vars[ $page_key ] ) && $wp->query_vars[ $page_key ] != '' )
|
976 |
+
$pagenum = absint( $wp->query_vars[ $page_key ] );
|
977 |
|
978 |
+
elseif ( isset( $_REQUEST[ $page_key ] ) )
|
979 |
+
$pagenum = absint( $_REQUEST[ $page_key ] );
|
980 |
|
981 |
+
elseif ( isset( $_REQUEST[ $page_key ] ) )
|
982 |
+
$pagenum = absint( $_REQUEST[ $page_key ] );
|
983 |
|
984 |
else return 1;
|
985 |
|
1158 |
/**
|
1159 |
* Front Pagination
|
1160 |
* @since 1.7
|
1161 |
+
* @version 1.0.5
|
1162 |
*/
|
1163 |
public function front_pagination( $pages_to_show = 5 ) {
|
1164 |
|
1173 |
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
1174 |
$current_url = remove_query_arg( $removable_query_args, $current_url );
|
1175 |
$current_url = str_replace( '/' . $current . '/', '/', $current_url );
|
1176 |
+
$current_url = apply_filters( 'mycred_log_front_nav_url', $current_url, $this );
|
1177 |
|
1178 |
$pages_to_show = absint( $pages_to_show );
|
1179 |
if ( $pages_to_show === 0 ) $pages_to_show = 5;
|
1194 |
else {
|
1195 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1196 |
'first-page',
|
1197 |
+
esc_url( remove_query_arg( $this->args['page_arg'], $current_url ) ),
|
1198 |
'«'
|
1199 |
);
|
1200 |
}
|
1204 |
else {
|
1205 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1206 |
'prev-page',
|
1207 |
+
esc_url( add_query_arg( $this->args['page_arg'], max( 1, $current-1 ), $current_url ) ),
|
1208 |
'‹'
|
1209 |
);
|
1210 |
}
|
1221 |
if ( $i != $current )
|
1222 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1223 |
'mycred-nav',
|
1224 |
+
esc_url( add_query_arg( $this->args['page_arg'], $i, $current_url ) ),
|
1225 |
$i
|
1226 |
);
|
1227 |
|
1235 |
else {
|
1236 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1237 |
'next-page' . $disable_last,
|
1238 |
+
esc_url( add_query_arg( $this->args['page_arg'], min( $total_pages, $current+1 ), $current_url ) ),
|
1239 |
'›'
|
1240 |
);
|
1241 |
}
|
1245 |
else {
|
1246 |
$page_links[] = sprintf( '<li><a class="%s" href="%s">%s</a></li>',
|
1247 |
'last-page' . $disable_last,
|
1248 |
+
esc_url( add_query_arg( $this->args['page_arg'], $total_pages, $current_url ) ),
|
1249 |
'»'
|
1250 |
);
|
1251 |
}
|
1257 |
/**
|
1258 |
* Pagination
|
1259 |
* @since 1.4
|
1260 |
+
* @version 1.1.2
|
1261 |
*/
|
1262 |
public function pagination( $location = 'top', $id = '' ) {
|
1263 |
|
1273 |
$current_url = str_replace( '/page/' . $current . '/', '/', $current_url );
|
1274 |
|
1275 |
$current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
|
1276 |
+
$current_url = apply_filters( 'mycred_log_pagination_url', $current_url, $this );
|
1277 |
|
1278 |
if ( $this->have_entries() )
|
1279 |
$output = '<span class="displaying-num">' . sprintf( _n( '1 entry', '%d entries', $this->num_rows, 'mycred' ), $this->num_rows ) . '</span>';
|
|
|
|
|
|
|
1280 |
|
1281 |
$total_pages_before = '<span class="paging-input">';
|
1282 |
$total_pages_after = '</span>';
|
includes/mycred-about.php
CHANGED
@@ -4,26 +4,11 @@ if ( ! defined( 'myCRED_VERSION' ) ) exit;
|
|
4 |
/**
|
5 |
* myCRED About Page Header
|
6 |
* @since 1.3.2
|
7 |
-
* @version 1.
|
8 |
*/
|
9 |
function mycred_about_header() {
|
10 |
|
11 |
-
$
|
12 |
-
if ( isset( $_GET['page'] ) && $_GET['page'] == 'mycred-credit' )
|
13 |
-
$credit = ' nav-tab-active';
|
14 |
-
else
|
15 |
-
$new = ' nav-tab-active';
|
16 |
-
|
17 |
-
$name = mycred_label();
|
18 |
-
$index_php = admin_url( 'index.php' );
|
19 |
-
$about_page = esc_url( add_query_arg( array( 'page' => MYCRED_SLUG . '-about' ), $index_php ) );
|
20 |
-
$credit_page = esc_url( add_query_arg( array( 'page' => MYCRED_SLUG . '-credit' ), $index_php ) );
|
21 |
-
|
22 |
-
$admin_php = admin_url( 'admin.php' );
|
23 |
-
$log_url = esc_url( add_query_arg( array( 'page' => MYCRED_SLUG ), $admin_php ) );
|
24 |
-
$hook_url = esc_url( add_query_arg( array( 'page' => MYCRED_SLUG . '-hooks' ), $admin_php ) );
|
25 |
-
$addons_url = esc_url( add_query_arg( array( 'page' => MYCRED_SLUG . '-addons' ), $admin_php ) );
|
26 |
-
$settings_url = esc_url( add_query_arg( array( 'page' => MYCRED_SLUG . '-settings' ), $admin_php ) );
|
27 |
|
28 |
?>
|
29 |
<style type="text/css">
|
@@ -31,21 +16,12 @@ function mycred_about_header() {
|
|
31 |
</style>
|
32 |
<h1><?php printf( __( 'Welcome to %s %s', 'mycred' ), $name, myCRED_VERSION ); ?></h1>
|
33 |
<div class="about-text"><?php printf( 'An adaptive points management system for WordPress powered websites.', $name ); ?></div>
|
34 |
-
<p
|
35 |
-
<a href="<?php echo $log_url; ?>" class="button">Log</a>
|
36 |
-
<a href="<?php echo $hook_url; ?>" class="button">Hooks</a>
|
37 |
-
<a href="<?php echo $addons_url; ?>" class="button">Add-ons</a>
|
38 |
-
<a href="<?php echo $settings_url; ?>" class="button button-primary">Settings</a>
|
39 |
-
</p>
|
40 |
<div class="wp-badge" id="mycred-badge">Version <?php echo myCRED_VERSION; ?></div>
|
41 |
-
|
42 |
<h2 class="nav-tab-wrapper wp-clearfix">
|
43 |
-
<a class="nav-tab
|
44 |
-
<a class="nav-tab
|
45 |
-
<a class="nav-tab" href="
|
46 |
-
<a class="nav-tab" href="http://codex.mycred.me" target="_blank">Codex</a>
|
47 |
-
<a class="nav-tab" href="http://mycred.me/support/forums/" target="_blank">Support Forum</a>
|
48 |
-
<a class="nav-tab" href="http://mycred.me/store/" target="_blank">Store</a>
|
49 |
</h2>
|
50 |
<?php
|
51 |
|
@@ -82,21 +58,18 @@ function mycred_about_footer() {
|
|
82 |
/**
|
83 |
* About myCRED Page
|
84 |
* @since 1.3.2
|
85 |
-
* @version 1.
|
86 |
*/
|
87 |
function mycred_about_page() {
|
88 |
|
89 |
-
$mycred = mycred();
|
90 |
-
$settings_url = esc_url( add_query_arg( array( 'page' => '-settings' ), admin_url( 'admin.php' ) ) );
|
91 |
-
|
92 |
?>
|
93 |
<div class="wrap about-wrap" id="mycred-about-wrap">
|
94 |
|
95 |
<?php mycred_about_header(); ?>
|
96 |
|
97 |
<div id="mycred-about">
|
|
|
98 |
<div class="feature-section two-col">
|
99 |
-
<h2>Improved Management Tools</h2>
|
100 |
<div class="col">
|
101 |
<img src="<?php echo plugins_url( 'assets/images/mycred-about-balance.png', myCRED_THIS ); ?>" alt="" />
|
102 |
<h3>New Balance & Log Editor</h3>
|
@@ -109,8 +82,8 @@ function mycred_about_page() {
|
|
109 |
</div>
|
110 |
</div>
|
111 |
<hr />
|
|
|
112 |
<div class="feature-section two-col">
|
113 |
-
<h2>Add-on Improvements</h2>
|
114 |
<div class="col">
|
115 |
<h3>Sell Content 2.0</h3>
|
116 |
<p>As of version 1.7, the sell content add-on supports sales using multiple point types! You can furthermore also set content for sale by default based on post type, category or tags.</p>
|
@@ -121,8 +94,8 @@ function mycred_about_page() {
|
|
121 |
</div>
|
122 |
</div>
|
123 |
<hr />
|
|
|
124 |
<div class="feature-section three-col">
|
125 |
-
<h2>New Shortcodes</h2>
|
126 |
<div class="col">
|
127 |
<h3><code>[mycred_show_if]</code></h3>
|
128 |
<p>This shortcode can be used to wrap around content that you want to show only to those who have a certain balance and / or rank.</p>
|
@@ -137,7 +110,7 @@ function mycred_about_page() {
|
|
137 |
</div>
|
138 |
</div>
|
139 |
<div class="feature-section one-col">
|
140 |
-
<p style="text-align: center;"><a href="
|
141 |
</div>
|
142 |
<hr />
|
143 |
</div>
|
@@ -148,65 +121,3 @@ function mycred_about_page() {
|
|
148 |
<?php
|
149 |
|
150 |
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* myCRED Credit Page
|
154 |
-
* @since 1.3.2
|
155 |
-
* @version 1.7
|
156 |
-
*/
|
157 |
-
function mycred_about_credit_page() {
|
158 |
-
|
159 |
-
?>
|
160 |
-
<div class="wrap about-wrap" id="mycred-credit-wrap">
|
161 |
-
|
162 |
-
<?php mycred_about_header(); ?>
|
163 |
-
|
164 |
-
<div id="mycred-about">
|
165 |
-
<div class="feature-section two-col">
|
166 |
-
<h2>Awesome People!</h2>
|
167 |
-
<div class="col">
|
168 |
-
<h3>Bug Finders</h3>
|
169 |
-
<ul>
|
170 |
-
<li><a href="http://mycred.me/community/innergy4every1/">innergy4every1</a></li>
|
171 |
-
<li><a href="http://mycred.me/community/kristoff/">Kristoff</a></li>
|
172 |
-
<li><a href="http://mycred.me/community/colson/">colson</a></li>
|
173 |
-
<li><a href="http://mycred.me/community/Martin/">Martin</a></li>
|
174 |
-
<li><a href="http://mycred.me/community/orousal/">Orousal</a></li>
|
175 |
-
<li><a href="http://mycred.me/community/joseph/">Joseph</a></li>
|
176 |
-
<li>Maria Campbell</li>
|
177 |
-
</ul>
|
178 |
-
</div>
|
179 |
-
<div class="col">
|
180 |
-
<h3>Translators</h3>
|
181 |
-
<ul>
|
182 |
-
<li><a href="http://bp-fr.net/">Dan</a> <em>( French )</em></li>
|
183 |
-
<li>Mani Akhtar <em>( Persian )</em></li>
|
184 |
-
<li><a href="http://robertrowshan.com/">Robert Rowshan</a> <em>( Spanish )</em></li>
|
185 |
-
<li>Skladchik <em>( Russian )</em></li>
|
186 |
-
<li><a href="http://coolwp.com">suifengtec</a> <em>( Chinese )</em></li>
|
187 |
-
<li>Guilherme <em>( Portuguese - Brazil )</em></li>
|
188 |
-
<li>Mochizuki Hiroshi <em>( Japanese )</em></li>
|
189 |
-
<li><a href="http://www.merovingi.com/">Gabriel S Merovingi</a> <em>( Swedish )</em></li>
|
190 |
-
</ul>
|
191 |
-
</div>
|
192 |
-
</div>
|
193 |
-
<hr />
|
194 |
-
<div class="feature-section two-col">
|
195 |
-
<h2>Join the myCRED Community</h2>
|
196 |
-
<div class="col">
|
197 |
-
<h3>Earn Tokens</h3>
|
198 |
-
<p>Helping translating myCRED, report bugs / solutions or helping out in the support forum will earn you myCRED Tokens which you can use in the store as payment. Signup for a <a href="http://mycred.me/community/access/#signup" target="_blank">free account</a> today!</p>
|
199 |
-
</div>
|
200 |
-
<div class="col">
|
201 |
-
<h3>Premium Add-ons</h3>
|
202 |
-
<p>Community members gain access to the <a href="http://mycred.me/store/" target="_blank">myCRED store</a> where you can purchase premium add-ons to further expand myCRED.</p>
|
203 |
-
</div>
|
204 |
-
</div>
|
205 |
-
</div>
|
206 |
-
|
207 |
-
<?php mycred_about_footer(); ?>
|
208 |
-
|
209 |
-
</div>
|
210 |
-
<?php
|
211 |
-
|
212 |
-
}
|
4 |
/**
|
5 |
* myCRED About Page Header
|
6 |
* @since 1.3.2
|
7 |
+
* @version 1.3
|
8 |
*/
|
9 |
function mycred_about_header() {
|
10 |
|
11 |
+
$name = mycred_label();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
?>
|
14 |
<style type="text/css">
|
16 |
</style>
|
17 |
<h1><?php printf( __( 'Welcome to %s %s', 'mycred' ), $name, myCRED_VERSION ); ?></h1>
|
18 |
<div class="about-text"><?php printf( 'An adaptive points management system for WordPress powered websites.', $name ); ?></div>
|
19 |
+
<p><?php printf( __( 'Thank you for using %s. If you have a moment, please leave a %s.', 'mycred' ), $name, sprintf( '<a href="https://wordpress.org/support/plugin/mycred/reviews/?rate=5#new-post" target="_blank">%s</a>', __( 'review', 'mycred' ) ) ); ?></p>
|
|
|
|
|
|
|
|
|
|
|
20 |
<div class="wp-badge" id="mycred-badge">Version <?php echo myCRED_VERSION; ?></div>
|
|
|
21 |
<h2 class="nav-tab-wrapper wp-clearfix">
|
22 |
+
<a class="nav-tab nav-tab-active" href="#">What’s New</a>
|
23 |
+
<a class="nav-tab" href="http://codex.mycred.me" target="_blank">Documentation</a>
|
24 |
+
<a class="nav-tab" href="https://mycred.me/store/" target="_blank">Store</a>
|
|
|
|
|
|
|
25 |
</h2>
|
26 |
<?php
|
27 |
|
58 |
/**
|
59 |
* About myCRED Page
|
60 |
* @since 1.3.2
|
61 |
+
* @version 1.3
|
62 |
*/
|
63 |
function mycred_about_page() {
|
64 |
|
|
|
|
|
|
|
65 |
?>
|
66 |
<div class="wrap about-wrap" id="mycred-about-wrap">
|
67 |
|
68 |
<?php mycred_about_header(); ?>
|
69 |
|
70 |
<div id="mycred-about">
|
71 |
+
<h2>Improved Management Tools</h2>
|
72 |
<div class="feature-section two-col">
|
|
|
73 |
<div class="col">
|
74 |
<img src="<?php echo plugins_url( 'assets/images/mycred-about-balance.png', myCRED_THIS ); ?>" alt="" />
|
75 |
<h3>New Balance & Log Editor</h3>
|
82 |
</div>
|
83 |
</div>
|
84 |
<hr />
|
85 |
+
<h2>Add-on Improvements</h2>
|
86 |
<div class="feature-section two-col">
|
|
|
87 |
<div class="col">
|
88 |
<h3>Sell Content 2.0</h3>
|
89 |
<p>As of version 1.7, the sell content add-on supports sales using multiple point types! You can furthermore also set content for sale by default based on post type, category or tags.</p>
|
94 |
</div>
|
95 |
</div>
|
96 |
<hr />
|
97 |
+
<h2>New Shortcodes</h2>
|
98 |
<div class="feature-section three-col">
|
|
|
99 |
<div class="col">
|
100 |
<h3><code>[mycred_show_if]</code></h3>
|
101 |
<p>This shortcode can be used to wrap around content that you want to show only to those who have a certain balance and / or rank.</p>
|
110 |
</div>
|
111 |
</div>
|
112 |
<div class="feature-section one-col">
|
113 |
+
<p style="text-align: center;"><a href="https://mycred.me/support/changelog/" target="_blank">View All Changes</a></p>
|
114 |
</div>
|
115 |
<hr />
|
116 |
</div>
|
121 |
<?php
|
122 |
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/mycred-overview.php
CHANGED
@@ -5,7 +5,7 @@ if ( ! defined( 'myCRED_VERSION' ) ) exit;
|
|
5 |
* Dashboard Widget: Overview
|
6 |
* @see https://codex.wordpress.org/Example_Dashboard_Widget
|
7 |
* @since 1.3.3
|
8 |
-
* @version 1.3.
|
9 |
*/
|
10 |
if ( ! class_exists( 'myCRED_Dashboard_Widget_Overview' ) ) :
|
11 |
class myCRED_Dashboard_Widget_Overview {
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'myCRED_Dashboard_Widget_Overview' ) ) :
|
|
17 |
*/
|
18 |
public static function init() {
|
19 |
|
20 |
-
if ( ! current_user_can( apply_filters( 'mycred_overview_capability', '
|
21 |
|
22 |
// Add widget
|
23 |
wp_add_dashboard_widget(
|
@@ -35,7 +35,8 @@ if ( ! class_exists( 'myCRED_Dashboard_Widget_Overview' ) ) :
|
|
35 |
|
36 |
global $wpdb;
|
37 |
|
38 |
-
$
|
|
|
39 |
|
40 |
?>
|
41 |
<style type="text/css">
|
@@ -60,33 +61,39 @@ div.overview-module-wrap div.mycred-type .overview .section strong { padding: 0
|
|
60 |
|
61 |
do_action( 'mycred_overview_before', $types );
|
62 |
|
63 |
-
$
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
$
|
|
|
67 |
|
68 |
-
$
|
69 |
-
if ( $type != MYCRED_DEFAULT_TYPE_KEY )
|
70 |
-
$page .= '_' . $type;
|
71 |
|
72 |
-
$
|
73 |
-
|
|
|
|
|
74 |
|
75 |
-
$
|
76 |
-
$
|
77 |
|
78 |
-
$
|
79 |
-
$
|
80 |
|
81 |
?>
|
82 |
<div class="mycred-type clear<?php if ( $counter == 0 ) echo ' first'; ?>">
|
83 |
<div class="module-title"><div class="type-icon"><div class="dashicons dashicons-star-filled"></div></div><?php echo $mycred->plural(); ?><a href="<?php echo $url; ?>" title="<?php _e( 'Total amount in circulation', 'mycred' ); ?>"><?php echo $mycred->format_creds( $total ); ?></a></div>
|
84 |
<div class="overview clear">
|
85 |
<div class="section border" style="width: 50%;">
|
86 |
-
<p><strong style="color:green;"><?php _e( 'Awarded', 'mycred' ); ?>:</strong> <a href="<?php echo esc_url( $
|
87 |
</div>
|
88 |
<div class="section border" style="width: 50%; margin-left: -1px;">
|
89 |
-
<p><strong style="color:red;"><?php _e( 'Deducted', 'mycred' ); ?>:</strong> <a href="<?php echo esc_url( $
|
90 |
</div>
|
91 |
</div>
|
92 |
</div>
|
5 |
* Dashboard Widget: Overview
|
6 |
* @see https://codex.wordpress.org/Example_Dashboard_Widget
|
7 |
* @since 1.3.3
|
8 |
+
* @version 1.3.3
|
9 |
*/
|
10 |
if ( ! class_exists( 'myCRED_Dashboard_Widget_Overview' ) ) :
|
11 |
class myCRED_Dashboard_Widget_Overview {
|
17 |
*/
|
18 |
public static function init() {
|
19 |
|
20 |
+
if ( ! current_user_can( apply_filters( 'mycred_overview_capability', 'edit_theme_options' ) ) ) return;
|
21 |
|
22 |
// Add widget
|
23 |
wp_add_dashboard_widget(
|
35 |
|
36 |
global $wpdb;
|
37 |
|
38 |
+
$counter = 0;
|
39 |
+
$types = mycred_get_types();
|
40 |
|
41 |
?>
|
42 |
<style type="text/css">
|
61 |
|
62 |
do_action( 'mycred_overview_before', $types );
|
63 |
|
64 |
+
foreach ( $types as $point_type => $label ) {
|
65 |
+
|
66 |
+
$mycred = mycred( $point_type );
|
67 |
+
|
68 |
+
$page = MYCRED_SLUG;
|
69 |
+
if ( $point_type != MYCRED_DEFAULT_TYPE_KEY )
|
70 |
+
$page .= '_' . $point_type;
|
71 |
|
72 |
+
$url = admin_url( 'admin.php?page=' . $page );
|
73 |
+
$total = $wpdb->get_var( $wpdb->prepare( "SELECT SUM( meta_value ) FROM {$wpdb->usermeta} WHERE meta_key = %s;", mycred_get_meta_key( $point_type ) ) );
|
74 |
|
75 |
+
if ( $total === NULL ) $total = $mycred->zero();
|
|
|
|
|
76 |
|
77 |
+
$data = $wpdb->get_row( "
|
78 |
+
SELECT SUM( CASE WHEN creds > 0 THEN creds END) as gains,
|
79 |
+
SUM( CASE WHEN creds < 0 THEN creds END) as losses
|
80 |
+
FROM {$mycred->log_table};" );
|
81 |
|
82 |
+
$awarded = ( isset( $data->gains ) ) ? $data->gains : 0;
|
83 |
+
$awarded_url = add_query_arg( array( 'num' => 0, 'compare' => urlencode( '>' ) ), $url );
|
84 |
|
85 |
+
$deducted = ( isset( $data->losses ) ) ? $data->losses : 0;
|
86 |
+
$deducted_url = add_query_arg( array( 'num' => 0, 'compare' => urlencode( '<' ) ), $url );
|
87 |
|
88 |
?>
|
89 |
<div class="mycred-type clear<?php if ( $counter == 0 ) echo ' first'; ?>">
|
90 |
<div class="module-title"><div class="type-icon"><div class="dashicons dashicons-star-filled"></div></div><?php echo $mycred->plural(); ?><a href="<?php echo $url; ?>" title="<?php _e( 'Total amount in circulation', 'mycred' ); ?>"><?php echo $mycred->format_creds( $total ); ?></a></div>
|
91 |
<div class="overview clear">
|
92 |
<div class="section border" style="width: 50%;">
|
93 |
+
<p><strong style="color:green;"><?php _e( 'Awarded', 'mycred' ); ?>:</strong> <a href="<?php echo esc_url( $awarded_url ); ?>"><?php echo $mycred->format_creds( $awarded ); ?></a></p>
|
94 |
</div>
|
95 |
<div class="section border" style="width: 50%; margin-left: -1px;">
|
96 |
+
<p><strong style="color:red;"><?php _e( 'Deducted', 'mycred' ); ?>:</strong> <a href="<?php echo esc_url( $deducted_url ); ?>"><?php echo $mycred->format_creds( $deducted ); ?></a></p>
|
97 |
</div>
|
98 |
</div>
|
99 |
</div>
|
includes/shortcodes/mycred_best_user.php
CHANGED
@@ -6,7 +6,7 @@ if ( ! defined( 'myCRED_VERSION' ) ) exit;
|
|
6 |
* Allows database queries in the history table to determen the
|
7 |
* "best user" based on references, time and point types.
|
8 |
* @since 1.6.7
|
9 |
-
* @version 1.0.
|
10 |
*/
|
11 |
if ( ! function_exists( 'mycred_render_shortcode_best_user' ) ) :
|
12 |
function mycred_render_shortcode_best_user( $attr, $content = '' ) {
|
@@ -95,6 +95,11 @@ if ( ! function_exists( 'mycred_render_shortcode_best_user' ) ) :
|
|
95 |
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
|
|
98 |
$where = 'WHERE ' . implode( ' AND ', $wheres );
|
99 |
$where = $wpdb->prepare( $where, $preps );
|
100 |
|
6 |
* Allows database queries in the history table to determen the
|
7 |
* "best user" based on references, time and point types.
|
8 |
* @since 1.6.7
|
9 |
+
* @version 1.0.5
|
10 |
*/
|
11 |
if ( ! function_exists( 'mycred_render_shortcode_best_user' ) ) :
|
12 |
function mycred_render_shortcode_best_user( $attr, $content = '' ) {
|
95 |
|
96 |
}
|
97 |
|
98 |
+
if ( empty( $wheres ) ) {
|
99 |
+
$wheres[] = 'id != %d';
|
100 |
+
$preps[] = 0;
|
101 |
+
}
|
102 |
+
|
103 |
$where = 'WHERE ' . implode( ' AND ', $wheres );
|
104 |
$where = $wpdb->prepare( $where, $preps );
|
105 |
|
modules/mycred-module-addons.php
CHANGED
@@ -310,7 +310,7 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
|
|
310 |
/**
|
311 |
* Admin Page
|
312 |
* @since 0.1
|
313 |
-
* @version 1.2.
|
314 |
*/
|
315 |
public function admin_page() {
|
316 |
|
@@ -367,14 +367,18 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
|
|
367 |
|
368 |
<a class="more-details" id="<?php echo $aria_action; ?>" href="<?php echo $data['addon_url']; ?>" target="_blank"><?php _e( 'Documentation', 'mycred' ); ?></a>
|
369 |
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
|
376 |
-
<div class="theme-actions">
|
377 |
-
<?php echo $this->activate_deactivate( $key ); ?>
|
378 |
</div>
|
379 |
|
380 |
</div>
|
310 |
/**
|
311 |
* Admin Page
|
312 |
* @since 0.1
|
313 |
+
* @version 1.2.3
|
314 |
*/
|
315 |
public function admin_page() {
|
316 |
|
367 |
|
368 |
<a class="more-details" id="<?php echo $aria_action; ?>" href="<?php echo $data['addon_url']; ?>" target="_blank"><?php _e( 'Documentation', 'mycred' ); ?></a>
|
369 |
|
370 |
+
<div class="theme-id-container">
|
371 |
+
|
372 |
+
<?php if ( $this->is_active( $key ) ) : ?>
|
373 |
+
<h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $this->core->template_tags_general( $data['name'] ); ?></h2>
|
374 |
+
<?php else : ?>
|
375 |
+
<h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $this->core->template_tags_general( $data['name'] ); ?></h2>
|
376 |
+
<?php endif; ?>
|
377 |
+
|
378 |
+
<div class="theme-actions">
|
379 |
+
<?php echo $this->activate_deactivate( $key ); ?>
|
380 |
+
</div>
|
381 |
|
|
|
|
|
382 |
</div>
|
383 |
|
384 |
</div>
|
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: 1.7.9.
|
7 |
* Tags: points, credit, balance, finance, rewards, engagement, woocommerce, bbpress, buddypress
|
8 |
* Author: Gabriel S Merovingi
|
9 |
* Author URI: http://www.merovingi.com
|
@@ -19,7 +19,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
19 |
final class myCRED_Core {
|
20 |
|
21 |
// Plugin Version
|
22 |
-
public $version = '1.7.9.
|
23 |
|
24 |
// Instnace
|
25 |
protected static $_instance = NULL;
|
@@ -808,7 +808,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
808 |
}
|
809 |
|
810 |
// Add about page
|
811 |
-
$pages[]
|
812 |
sprintf( __( 'About %s', 'mycred' ), $name ),
|
813 |
sprintf( __( 'About %s', 'mycred' ), $name ),
|
814 |
'moderate_comments',
|
@@ -816,17 +816,8 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
816 |
'mycred_about_page'
|
817 |
);
|
818 |
|
819 |
-
// Add credits page
|
820 |
-
$pages[] = add_dashboard_page(
|
821 |
-
__( 'Awesome People', 'mycred' ),
|
822 |
-
__( 'Awesome People', 'mycred' ),
|
823 |
-
'moderate_comments',
|
824 |
-
MYCRED_SLUG . '-credit',
|
825 |
-
'mycred_about_credit_page'
|
826 |
-
);
|
827 |
-
|
828 |
// Add styling to our admin screens
|
829 |
-
$pages
|
830 |
foreach ( $pages as $page )
|
831 |
add_action( 'admin_print_styles-' . $page, array( $this, 'fix_admin_page_styles' ) );
|
832 |
|
@@ -965,12 +956,11 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
965 |
/**
|
966 |
* FIX: Remove About and Credit Page
|
967 |
* @since 1.7
|
968 |
-
* @version 1.0
|
969 |
*/
|
970 |
public function fix_remove_about_page() {
|
971 |
|
972 |
remove_submenu_page( 'index.php', MYCRED_SLUG . '-about' );
|
973 |
-
remove_submenu_page( 'index.php', MYCRED_SLUG . '-credit' );
|
974 |
|
975 |
}
|
976 |
|
@@ -1023,7 +1013,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
1023 |
// Usefull links
|
1024 |
$links[] = '<a href="' . admin_url( 'index.php?page=' . MYCRED_SLUG . '-about' ) . '">About</a>';
|
1025 |
$links[] = '<a href="http://codex.mycred.me/" target="_blank">Documentation</a>';
|
1026 |
-
$links[] = '<a href="
|
1027 |
|
1028 |
return $links;
|
1029 |
|
3 |
* Plugin Name: myCRED
|
4 |
* Plugin URI: https://mycred.me
|
5 |
* Description: An adaptive points management system for WordPress powered websites.
|
6 |
+
* Version: 1.7.9.4
|
7 |
* Tags: points, credit, balance, finance, rewards, engagement, woocommerce, bbpress, buddypress
|
8 |
* Author: Gabriel S Merovingi
|
9 |
* Author URI: http://www.merovingi.com
|
19 |
final class myCRED_Core {
|
20 |
|
21 |
// Plugin Version
|
22 |
+
public $version = '1.7.9.4';
|
23 |
|
24 |
// Instnace
|
25 |
protected static $_instance = NULL;
|
808 |
}
|
809 |
|
810 |
// Add about page
|
811 |
+
$pages[] = add_dashboard_page(
|
812 |
sprintf( __( 'About %s', 'mycred' ), $name ),
|
813 |
sprintf( __( 'About %s', 'mycred' ), $name ),
|
814 |
'moderate_comments',
|
816 |
'mycred_about_page'
|
817 |
);
|
818 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
819 |
// Add styling to our admin screens
|
820 |
+
$pages = apply_filters( 'mycred_admin_pages', $pages, $mycred );
|
821 |
foreach ( $pages as $page )
|
822 |
add_action( 'admin_print_styles-' . $page, array( $this, 'fix_admin_page_styles' ) );
|
823 |
|
956 |
/**
|
957 |
* FIX: Remove About and Credit Page
|
958 |
* @since 1.7
|
959 |
+
* @version 1.0.1
|
960 |
*/
|
961 |
public function fix_remove_about_page() {
|
962 |
|
963 |
remove_submenu_page( 'index.php', MYCRED_SLUG . '-about' );
|
|
|
964 |
|
965 |
}
|
966 |
|
1013 |
// Usefull links
|
1014 |
$links[] = '<a href="' . admin_url( 'index.php?page=' . MYCRED_SLUG . '-about' ) . '">About</a>';
|
1015 |
$links[] = '<a href="http://codex.mycred.me/" target="_blank">Documentation</a>';
|
1016 |
+
$links[] = '<a href="https://mycred.me/store/" target="_blank">Store</a>';
|
1017 |
|
1018 |
return $links;
|
1019 |
|
plugins/mycred-hook-jetpack.php
CHANGED
@@ -25,7 +25,7 @@ function mycred_register_jetpack_hook( $installed ) {
|
|
25 |
/**
|
26 |
* Jetpack Hook
|
27 |
* @since 1.0.5
|
28 |
-
* @version 1.
|
29 |
*/
|
30 |
add_action( 'mycred_load_hooks', 'mycred_load_jetpack_hook', 75 );
|
31 |
function mycred_load_jetpack_hook() {
|
@@ -59,468 +59,83 @@ function mycred_load_jetpack_hook() {
|
|
59 |
/**
|
60 |
* Run
|
61 |
* @since 1.0.5
|
62 |
-
* @version 1.
|
63 |
*/
|
64 |
public function run() {
|
65 |
|
66 |
// Site Subscriptions
|
67 |
if ( $this->prefs['subscribe_site']['creds'] != 0 )
|
68 |
-
add_filter( '
|
69 |
|
70 |
// Comment Subscriptions
|
71 |
if ( $this->prefs['subscribe_comment']['creds'] != 0 )
|
72 |
-
add_action( '
|
73 |
-
|
74 |
-
add_action( 'mycred_admin_init', array( $this, 'admin_init' ) );
|
75 |
|
76 |
}
|
77 |
|
78 |
/**
|
79 |
-
*
|
80 |
-
* Check pending emails if they have confirmed their subscription. If it's confirmed
|
81 |
-
* and no previous points have been awarded we do that here. Else if the email is marked
|
82 |
-
* as pending we save it for a later try.
|
83 |
-
*
|
84 |
-
* @since 1.0.5
|
85 |
-
* @version 1.1.1
|
86 |
-
*/
|
87 |
-
public function admin_init() {
|
88 |
-
|
89 |
-
$types = array();
|
90 |
-
|
91 |
-
if ( $this->prefs['subscribe_site']['creds'] != 0 )
|
92 |
-
$types[] = 'site';
|
93 |
-
|
94 |
-
if ( $this->prefs['subscribe_comment']['creds'] != 0 )
|
95 |
-
$types[] = 'comment';
|
96 |
-
|
97 |
-
// Not enabled, bail
|
98 |
-
if ( empty( $types ) ) return;
|
99 |
-
|
100 |
-
foreach ( $types as $type ) {
|
101 |
-
|
102 |
-
// Get list if it exist
|
103 |
-
if ( false === ( $pending = get_option( 'mycred_jetpack_' . $type . '_pendings' ) ) )
|
104 |
-
continue;
|
105 |
-
|
106 |
-
// Make sure list is not empty
|
107 |
-
if ( empty( $pending ) ) {
|
108 |
-
// Clean up before exit
|
109 |
-
delete_option( 'mycred_jetpack_' . $type . '_pendings' );
|
110 |
-
continue;
|
111 |
-
}
|
112 |
-
|
113 |
-
$new = array();
|
114 |
-
foreach ( $pending as $id => $email ) {
|
115 |
-
|
116 |
-
// Validate
|
117 |
-
if ( trim( $email ) == '' || ! is_email( $email ) ) continue;
|
118 |
-
|
119 |
-
// Make sure user exist
|
120 |
-
$user = get_user_by( 'email', $email );
|
121 |
-
if ( $user === false ) continue;
|
122 |
-
|
123 |
-
// Check for exclusion
|
124 |
-
if ( $this->core->exclude_user( $user->ID ) === true ) continue;
|
125 |
-
|
126 |
-
// Make sure this is a unique event
|
127 |
-
if ( $this->core->has_entry( 'site_subscription', 0, $user->ID ) ) continue;
|
128 |
-
|
129 |
-
// Site Subscriptions
|
130 |
-
if ( $type == 'site' ) {
|
131 |
-
|
132 |
-
// Check subscription status
|
133 |
-
$subscription = $this->check_jetpack_subscription( $email );
|
134 |
-
// Active status = award points if not already
|
135 |
-
if ( $subscription == 'active' ) {
|
136 |
-
// Execute
|
137 |
-
$this->core->add_creds(
|
138 |
-
'site_subscription',
|
139 |
-
$user->ID,
|
140 |
-
$this->prefs['subscribe_site']['creds'],
|
141 |
-
$this->prefs['subscribe_site']['log'],
|
142 |
-
0,
|
143 |
-
'',
|
144 |
-
$this->mycred_type
|
145 |
-
);
|
146 |
-
}
|
147 |
-
|
148 |
-
// Pending status = save so we try again later
|
149 |
-
elseif ( $subscription == 'pending' ) {
|
150 |
-
$new[] = $email;
|
151 |
-
continue;
|
152 |
-
}
|
153 |
-
|
154 |
-
}
|
155 |
-
|
156 |
-
// Comment Subscriptions
|
157 |
-
else {
|
158 |
-
|
159 |
-
$comment = get_comment( $id );
|
160 |
-
if ( empty( $comment ) ) continue;
|
161 |
-
|
162 |
-
// If no user id exist, check and see if the authors email is used by someone
|
163 |
-
if ( $comment->user_id == 0 ) {
|
164 |
-
$user = get_user_by( 'email', $email );
|
165 |
-
if ( $user === false ) continue;
|
166 |
-
}
|
167 |
-
|
168 |
-
// Make sure the user still exist
|
169 |
-
else {
|
170 |
-
$user = get_user_by( 'id', $comment->user_id );
|
171 |
-
if ( $user === false ) continue;
|
172 |
-
}
|
173 |
-
|
174 |
-
// Check for exclusion
|
175 |
-
if ( $this->core->exclude_user( $user->ID ) === true ) continue;
|
176 |
-
|
177 |
-
// Start with making sure this is a unique event
|
178 |
-
if ( $this->core->has_entry( 'comment_subscription', $id, $user->ID ) ) continue;
|
179 |
-
|
180 |
-
$post_ids = array();
|
181 |
-
|
182 |
-
if ( isset( $_REQUEST['subscribe_comments'] ) )
|
183 |
-
$post_ids[] = $comment->comment_post_ID;
|
184 |
-
|
185 |
-
// Attempt to subscribe again to get results
|
186 |
-
$subscription = $this->check_jetpack_subscription( $email, array( $comment->comment_post_ID ) );
|
187 |
-
|
188 |
-
// Subscription is active
|
189 |
-
if ( $subscription == 'active' ) {
|
190 |
-
// Execute
|
191 |
-
$this->core->add_creds(
|
192 |
-
'comment_subscription',
|
193 |
-
$user->ID,
|
194 |
-
$this->prefs['subscribe_comment']['creds'],
|
195 |
-
$this->prefs['subscribe_comment']['log'],
|
196 |
-
$id,
|
197 |
-
array( 'ref_type' => 'comment' ),
|
198 |
-
$this->mycred_type
|
199 |
-
);
|
200 |
-
}
|
201 |
-
// Subscription pending
|
202 |
-
elseif ( $subscription == 'pending' ) {
|
203 |
-
$new[ $id ] = $email;
|
204 |
-
}
|
205 |
-
|
206 |
-
}
|
207 |
-
|
208 |
-
}
|
209 |
-
|
210 |
-
// If we still have pending emails save for later
|
211 |
-
if ( ! empty( $new ) )
|
212 |
-
update_option( 'mycred_jetpack_' . $type . '_pendings', $new );
|
213 |
-
|
214 |
-
// Else delete
|
215 |
-
else
|
216 |
-
delete_option( 'mycred_jetpack_' . $type . '_pendings' );
|
217 |
-
|
218 |
-
}
|
219 |
-
|
220 |
-
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Submit Redirect
|
224 |
-
* Checks if Jetpack signup has been executed by parsing the redirect URL.
|
225 |
* @since 1.0.5
|
226 |
* @version 1.0
|
227 |
*/
|
228 |
-
public function
|
229 |
|
230 |
-
|
231 |
-
if ( ! isset( $_REQUEST['jetpack_subscriptions_widget'] ) || ! isset( $_REQUEST['email'] ) || empty( $_REQUEST['email'] ) )
|
232 |
-
return $location;
|
233 |
|
234 |
-
|
235 |
-
if ( ! isset( $_GET['subscribe'] ) || $_GET['subscribe'] != 'success' )
|
236 |
-
return $location;
|
237 |
-
|
238 |
-
// Make sure user exist
|
239 |
-
$user = get_user_by( 'email', $_REQUEST['email'] );
|
240 |
-
if ( $user === false )
|
241 |
-
return $location;
|
242 |
|
243 |
// Check for exclusion
|
244 |
-
if ( $this->core->exclude_user( $
|
245 |
-
return $location;
|
246 |
|
247 |
-
//
|
248 |
-
if ( $this->core->has_entry( 'site_subscription',
|
249 |
-
return $location;
|
250 |
|
251 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
-
|
254 |
|
255 |
}
|
256 |
|
257 |
/**
|
258 |
-
* Comment
|
259 |
-
* Manage the request to subscribe to comments and/or to the blog
|
260 |
-
* Based on Jetpack Subscriptions
|
261 |
-
* @see jetpack/modules/subscriptions.php
|
262 |
* @since 1.0.5
|
263 |
-
* @version 1.
|
264 |
*/
|
265 |
-
public function
|
266 |
-
|
267 |
-
if ( 'spam' === $approved ) return;
|
268 |
|
269 |
-
if ( !
|
270 |
-
return;
|
271 |
|
272 |
-
$
|
273 |
-
|
274 |
-
// If no user id exist, check and see if the authors email is used by someone
|
275 |
-
if ( $comment->user_id == 0 ) {
|
276 |
-
$user = get_user_by( 'email', $comment->comment_author_email );
|
277 |
-
if ( $user === false ) return;
|
278 |
-
}
|
279 |
-
|
280 |
-
// Make sure the user still exist
|
281 |
-
else {
|
282 |
-
$user = get_user_by( 'id', $comment->user_id );
|
283 |
-
if ( $user === false ) return;
|
284 |
-
}
|
285 |
|
286 |
// Check for exclusion
|
287 |
-
if ( $this->core->exclude_user( $
|
288 |
|
289 |
-
//
|
290 |
-
|
291 |
|
292 |
-
|
293 |
-
|
294 |
-
$this->comment_subscribe( $comment->comment_author_email, $comment->comment_post_ID, $user->ID, $comment_id );
|
295 |
-
|
296 |
-
// Handle site subscription
|
297 |
-
if ( isset( $_REQUEST['subscribe_blog'] ) )
|
298 |
-
$this->site_subscribe( $comment->comment_author_email, $user->ID );
|
299 |
-
|
300 |
-
}
|
301 |
|
302 |
-
/**
|
303 |
-
* Comment Subscribe
|
304 |
-
* Awards points for active subscriptions or adds email and comment id to the pending array.
|
305 |
-
* Note! This methods should only be called once the primary checks have been made, including making sure
|
306 |
-
* the user exist, is not excluded and that this is a unique event!
|
307 |
-
* @since 1.0.5
|
308 |
-
* @version 1.1
|
309 |
-
*/
|
310 |
-
protected function comment_subscribe( $email = '', $post_ids = '', $user_id = 0, $comment_id = 0 ) {
|
311 |
-
|
312 |
-
// Attempt to subscribe again to get results
|
313 |
-
$subscription = $this->check_jetpack_subscription( $email, $post_ids );
|
314 |
-
|
315 |
-
// Subscription is active
|
316 |
-
if ( $subscription == 'active' ) {
|
317 |
-
|
318 |
-
// Execute
|
319 |
$this->core->add_creds(
|
320 |
'comment_subscription',
|
321 |
$user_id,
|
322 |
$this->prefs['subscribe_comment']['creds'],
|
323 |
$this->prefs['subscribe_comment']['log'],
|
324 |
-
$
|
325 |
-
array( 'ref_type' => '
|
326 |
-
$this->mycred_type
|
327 |
-
);
|
328 |
-
|
329 |
-
// Let others share our success
|
330 |
-
do_action( 'mycred_jetpack_comment', $user_id, $comment_id );
|
331 |
-
|
332 |
-
}
|
333 |
-
|
334 |
-
// Subscription pending
|
335 |
-
elseif ( $subscription == 'pending' ) {
|
336 |
-
// Add email to pending list if not in it already
|
337 |
-
if ( ! $this->is_pending( $email, $comment_id ) )
|
338 |
-
$this->add_to_pending( $email, $comment_id );
|
339 |
-
}
|
340 |
-
|
341 |
-
}
|
342 |
-
|
343 |
-
/**
|
344 |
-
* Site Subscription
|
345 |
-
* Awards points for active site subscriptions or adds email to the pending array.
|
346 |
-
* Note! This methods should only be called once the primary checks have been made, including making sure
|
347 |
-
* the user exist, is not excluded and that this is a unique event!
|
348 |
-
* @since 1.0.5
|
349 |
-
* @version 1.1
|
350 |
-
*/
|
351 |
-
protected function site_subscribe( $email = '', $user_id = 0 ) {
|
352 |
-
|
353 |
-
// Attempt to add this email again to check it's status
|
354 |
-
$subscription = $this->check_jetpack_subscription( $email );
|
355 |
-
|
356 |
-
// Subscription is active
|
357 |
-
if ( $subscription == 'active' ) {
|
358 |
-
|
359 |
-
// Execute
|
360 |
-
$this->core->add_creds(
|
361 |
-
'site_subscription',
|
362 |
-
$user_id,
|
363 |
-
$this->prefs['subscribe_site']['creds'],
|
364 |
-
$this->prefs['subscribe_site']['log'],
|
365 |
-
0,
|
366 |
-
'',
|
367 |
$this->mycred_type
|
368 |
);
|
369 |
|
370 |
-
|
371 |
-
do_action( 'mycred_jetpack_site', $user_id, $GLOBALS['blog_id'] );
|
372 |
-
|
373 |
-
}
|
374 |
-
|
375 |
-
// Subscription pending
|
376 |
-
elseif ( $subscription == 'pending' ) {
|
377 |
-
// Add email to pending list if not in it already
|
378 |
-
if ( ! $this->is_pending( $email ) )
|
379 |
-
$this->add_to_pending( $email );
|
380 |
-
}
|
381 |
-
|
382 |
-
}
|
383 |
-
|
384 |
-
/**
|
385 |
-
* Check Jetpack Subscription
|
386 |
-
* @since 1.0.5
|
387 |
-
* @version 1.0
|
388 |
-
*/
|
389 |
-
protected function check_jetpack_subscription( $email = NULL, $post_ids = NULL ) {
|
390 |
-
|
391 |
-
if ( $email === NULL ) return 'missing';
|
392 |
-
|
393 |
-
if ( ! class_exists( 'Jetpack' ) && defined( 'JETPACK__PLUGIN_DIR' ) )
|
394 |
-
require_once( JETPACK__PLUGIN_DIR . 'jetpack.php' );
|
395 |
-
|
396 |
-
if ( ! class_exists( 'Jetpack_Subscriptions' ) && defined( 'JETPACK__PLUGIN_DIR' ) )
|
397 |
-
require_once( JETPACK__PLUGIN_DIR . 'modules/subscriptions.php' );
|
398 |
-
|
399 |
-
if ( $post_ids === NULL )
|
400 |
-
$subscribe = Jetpack_Subscriptions::subscribe( $email, 0, false );
|
401 |
-
else
|
402 |
-
$subscribe = Jetpack_Subscriptions::subscribe( $email, $post_ids, false );
|
403 |
-
|
404 |
-
if ( is_wp_error( $subscribe ) ) {
|
405 |
-
$error = $subscribe->get_error_code();
|
406 |
-
}
|
407 |
-
else {
|
408 |
-
$error = false;
|
409 |
-
foreach ( $subscribe as $response ) {
|
410 |
-
if ( is_wp_error( $response ) ) {
|
411 |
-
$error = $response->get_error_code();
|
412 |
-
break;
|
413 |
-
}
|
414 |
-
}
|
415 |
-
}
|
416 |
-
|
417 |
-
if ( $error ) {
|
418 |
-
switch ( $error ) {
|
419 |
-
case 'invalid_email':
|
420 |
-
$return = 'invalid';
|
421 |
-
break;
|
422 |
-
case 'active':
|
423 |
-
$return = 'active';
|
424 |
-
break;
|
425 |
-
case 'pending':
|
426 |
-
$return = 'pending';
|
427 |
-
break;
|
428 |
-
default:
|
429 |
-
$return = '';
|
430 |
-
break;
|
431 |
-
}
|
432 |
-
}
|
433 |
-
|
434 |
-
else {
|
435 |
-
if ( is_array( $subscribe ) && $subscribe[0] === true )
|
436 |
-
$error = true;
|
437 |
-
$return = 'pending';
|
438 |
-
}
|
439 |
-
|
440 |
-
if ( $error )
|
441 |
-
return $return;
|
442 |
-
|
443 |
-
return 'new';
|
444 |
-
|
445 |
-
}
|
446 |
-
|
447 |
-
/**
|
448 |
-
* Is Pending
|
449 |
-
* Checks the given email if it's in the pending array.
|
450 |
-
* @param $email (string) required email to check
|
451 |
-
* @param $section (string|int) either 'site' for site subscriptions or comment id, defaults to site
|
452 |
-
* @returns (bool) true or false
|
453 |
-
* @since 1.0.5
|
454 |
-
* @version 1.0
|
455 |
-
*/
|
456 |
-
protected function is_pending( $email = NULL, $section = 'site' ) {
|
457 |
-
|
458 |
-
if ( $email === NULL || trim( $email ) === '' ) return;
|
459 |
-
|
460 |
-
if ( $section == 'site' )
|
461 |
-
$name = $section;
|
462 |
-
else
|
463 |
-
$name = 'comment';
|
464 |
-
|
465 |
-
// If pending list does not exist, create it and add our email
|
466 |
-
if ( false === ( $pending = get_option( 'mycred_jetpack_' . $name . '_pendings' ) ) ) {
|
467 |
-
if ( $name == 'site' )
|
468 |
-
$pending = array( $email );
|
469 |
-
else
|
470 |
-
$pending = array( $section => $email );
|
471 |
-
|
472 |
-
update_option( 'mycred_jetpack_' . $name . '_pendings', $pending );
|
473 |
-
}
|
474 |
-
|
475 |
-
// Site check
|
476 |
-
if ( $section == 'site' && in_array( $email, $pending ) )
|
477 |
-
return true;
|
478 |
-
|
479 |
-
// Comment check
|
480 |
-
elseif ( array_key_exists( $section, $pending ) && $pending[ $section ] == $email )
|
481 |
-
return true;
|
482 |
-
|
483 |
-
return false;
|
484 |
-
|
485 |
-
}
|
486 |
-
|
487 |
-
/**
|
488 |
-
* Add to Pending
|
489 |
-
* Adds a given email to the pending array.
|
490 |
-
* @param $email (string) required email to check
|
491 |
-
* @param $section (string|int) either 'site' for site subscriptions or comment id, defaults to site
|
492 |
-
* @since 1.0.5
|
493 |
-
* @version 1.0
|
494 |
-
*/
|
495 |
-
protected function add_to_pending( $email = NULL, $section = 'site' ) {
|
496 |
-
|
497 |
-
if ( $email === NULL || trim( $email ) === '' ) return;
|
498 |
-
|
499 |
-
if ( $section == 'site' )
|
500 |
-
$name = $section;
|
501 |
-
else
|
502 |
-
$name = 'comment';
|
503 |
-
|
504 |
-
// If pending list does not exist, create it and add our email
|
505 |
-
if ( false === ( $pending = get_option( 'mycred_jetpack_' . $name . '_pendings' ) ) ) {
|
506 |
-
if ( $name == 'site' )
|
507 |
-
$pending = array( $email );
|
508 |
-
else
|
509 |
-
$pending = array( $section => $email );
|
510 |
-
|
511 |
-
update_option( 'mycred_jetpack_' . $name . '_pendings', $pending );
|
512 |
-
}
|
513 |
-
|
514 |
-
// Site pending list
|
515 |
-
if ( $section == 'site' && ! in_array( $email, $pending ) ) {
|
516 |
-
$pending[] = $email;
|
517 |
-
update_option( 'mycred_jetpack_' . $name . '_pendings', $pending );
|
518 |
-
}
|
519 |
|
520 |
-
// Comment pending list
|
521 |
-
elseif ( ! array_key_exists( $section, $pending ) ) {
|
522 |
-
$pending[ $section ] = $email;
|
523 |
-
update_option( 'mycred_jetpack_' . $name . '_pendings', $pending );
|
524 |
}
|
525 |
|
526 |
}
|
25 |
/**
|
26 |
* Jetpack Hook
|
27 |
* @since 1.0.5
|
28 |
+
* @version 1.2
|
29 |
*/
|
30 |
add_action( 'mycred_load_hooks', 'mycred_load_jetpack_hook', 75 );
|
31 |
function mycred_load_jetpack_hook() {
|
59 |
/**
|
60 |
* Run
|
61 |
* @since 1.0.5
|
62 |
+
* @version 1.1
|
63 |
*/
|
64 |
public function run() {
|
65 |
|
66 |
// Site Subscriptions
|
67 |
if ( $this->prefs['subscribe_site']['creds'] != 0 )
|
68 |
+
add_filter( 'jetpack_subscriptions_form_submission', array( $this, 'subscriptions_submit' ) );
|
69 |
|
70 |
// Comment Subscriptions
|
71 |
if ( $this->prefs['subscribe_comment']['creds'] != 0 )
|
72 |
+
add_action( 'jetpack_subscriptions_comment_form_submission', array( $this, 'comment_submit' ), 99, 2 );
|
|
|
|
|
73 |
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
+
* Site Subscriptions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
* @since 1.0.5
|
79 |
* @version 1.0
|
80 |
*/
|
81 |
+
public function subscriptions_submit( $result = '' ) {
|
82 |
|
83 |
+
if ( ! is_user_logged_in() || $result !== 'success' ) return;
|
|
|
|
|
84 |
|
85 |
+
$user_id = get_current_user_id();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
// Check for exclusion
|
88 |
+
if ( $this->core->exclude_user( $user_id ) === true ) return;
|
|
|
89 |
|
90 |
+
// Ensure we only get points once
|
91 |
+
if ( $this->core->has_entry( 'site_subscription', 0, $user_id ) ) return;
|
|
|
92 |
|
93 |
+
$this->core->add_creds(
|
94 |
+
'site_subscription',
|
95 |
+
$user_id,
|
96 |
+
$this->prefs['subscribe_site']['creds'],
|
97 |
+
$this->prefs['subscribe_site']['log'],
|
98 |
+
0,
|
99 |
+
'',
|
100 |
+
$this->mycred_type
|
101 |
+
);
|
102 |
|
103 |
+
do_action( 'mycred_jetpack_site', $user_id );
|
104 |
|
105 |
}
|
106 |
|
107 |
/**
|
108 |
+
* Comment Subscription
|
|
|
|
|
|
|
109 |
* @since 1.0.5
|
110 |
+
* @version 1.1
|
111 |
*/
|
112 |
+
public function comment_submit( $result, $post_ids ) {
|
|
|
|
|
113 |
|
114 |
+
if ( ! is_user_logged_in() || $result !== 'success' || empty( $post_ids ) ) return;
|
|
|
115 |
|
116 |
+
$user_id = get_current_user_id();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
// Check for exclusion
|
119 |
+
if ( $this->core->exclude_user( $user_id ) === true ) return;
|
120 |
|
121 |
+
// Award each post
|
122 |
+
foreach ( $post_ids as $post_id ) {
|
123 |
|
124 |
+
// We can only get points once per post ID
|
125 |
+
if ( $this->core->has_entry( 'comment_subscription', $post_id, $user_id ) ) continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
$this->core->add_creds(
|
128 |
'comment_subscription',
|
129 |
$user_id,
|
130 |
$this->prefs['subscribe_comment']['creds'],
|
131 |
$this->prefs['subscribe_comment']['log'],
|
132 |
+
$post_id,
|
133 |
+
array( 'ref_type' => 'post' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
$this->mycred_type
|
135 |
);
|
136 |
|
137 |
+
do_action( 'mycred_jetpack_comment', $user_id, $post_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
}
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== myCRED ===
|
2 |
Contributors: designbymerovingi
|
3 |
-
Tags: point,
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.7.9.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -16,12 +16,12 @@ An adaptive and powerful points management system for WordPress powered websites
|
|
16 |
|
17 |
|
18 |
myCRED is an adaptive points management system that lets you build a broad range of point related applications for your WordPress powered website.
|
19 |
-
Store reward systems, community leaderboards, online banking or monetizing your websites content,
|
20 |
|
21 |
|
22 |
= Points =
|
23 |
|
24 |
-
Each user on your WordPress websites gets their own point balance which you can manually [adjust](https://mycred.me/about/features/#points-management) at any time.
|
25 |
|
26 |
|
27 |
= Log =
|
@@ -96,7 +96,7 @@ You can find a list of [frequently asked questions](https://mycred.me/about/faq/
|
|
96 |
|
97 |
== Upgrade Notice ==
|
98 |
|
99 |
-
= 1.7.9.
|
100 |
Bug fixes.
|
101 |
|
102 |
|
@@ -121,16 +121,9 @@ Bug fixes.
|
|
121 |
|
122 |
== Changelog ==
|
123 |
|
124 |
-
= 1.7.9.
|
125 |
-
|
126 |
-
|
127 |
-
FIX - JavaScript error when using non english locals in the badge editor.
|
128 |
-
FIX - Content set for sale using "Manual Mode" will not render the enabled type buttons correctly (when using multiple types).
|
129 |
-
FIX - The placeholder names for new badges show an incorrect count where 1 is repeated twice.
|
130 |
-
FIX - Added comp. with latest version of WooCommerce 3.1.2
|
131 |
-
FIX - Built-in View Video hook was calling for a non existing function.
|
132 |
-
TWEAK - Adjusted the setup form containers id as it seems to collide with styling of third-party plugins in the wp-admin area.
|
133 |
-
TWEAK - Added mycred_module_is_active filter to allow overrides of module loads e.g. add-ons, banking or hooks.
|
134 |
|
135 |
= Previous Versions =
|
136 |
https://mycred.me/support/changelog/
|
1 |
=== myCRED ===
|
2 |
Contributors: designbymerovingi
|
3 |
+
Tags: point, credit, loyalty program, engagement, reward
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 4.9
|
6 |
+
Stable tag: 1.7.9.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
16 |
|
17 |
|
18 |
myCRED is an adaptive points management system that lets you build a broad range of point related applications for your WordPress powered website.
|
19 |
+
Store reward systems, community leaderboards, online banking or monetizing your websites content, are a few examples of the ways myCRED is used.
|
20 |
|
21 |
|
22 |
= Points =
|
23 |
|
24 |
+
Each user on your WordPress websites gets their own point balance which you can manually [adjust](https://mycred.me/about/features/#points-management) at any time. You can use just one point balance or setup multiple types of balances. How these balances are accessed, used or shows is entirely up to you.
|
25 |
|
26 |
|
27 |
= Log =
|
96 |
|
97 |
== Upgrade Notice ==
|
98 |
|
99 |
+
= 1.7.9.4 =
|
100 |
Bug fixes.
|
101 |
|
102 |
|
121 |
|
122 |
== Changelog ==
|
123 |
|
124 |
+
= 1.7.9.4 =
|
125 |
+
|
126 |
+
Tested with WordPress 4.9 beta3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
= Previous Versions =
|
129 |
https://mycred.me/support/changelog/
|