myCRED - Version 1.0.9.1

Version Description

  • Fixed Bug #17 - Shortcodes inside mycred_sell_this does not render.
  • Fixed Bug #18 - Pending posts that gets published by admin are not awarded points.
  • Fixed Bug #19 - mycred_subtract function not working properly.
  • Fixed Bug #20 - If user id deleted the log returns empty string.
  • Fixed Bug #21 - If user is removed the ranking is not updated leaving to missing users.
Download this release

Release Info

Developer designbymerovingi
Plugin Icon 128x128 myCRED
Version 1.0.9.1
Comparing to
See all releases

Code changes from version 1.0.9 to 1.0.9.1

addons/buy-creds/gateways/paypal-standard.php CHANGED
@@ -238,7 +238,7 @@ if ( !class_exists( 'myCRED_PayPal_Standard' ) ) {
238
  */
239
  public function buy() {
240
  if ( !isset( $this->prefs['account'] ) || empty( $this->prefs['account'] ) )
241
- wp_die( __( 'Please setup this gateway before attempting to make a purchaase!', 'mycred' ) );
242
 
243
  $home = get_bloginfo( 'url' );
244
  $token = $this->create_token();
238
  */
239
  public function buy() {
240
  if ( !isset( $this->prefs['account'] ) || empty( $this->prefs['account'] ) )
241
+ wp_die( __( 'Please setup this gateway before attempting to make a purchase!', 'mycred' ) );
242
 
243
  $home = get_bloginfo( 'url' );
244
  $token = $this->create_token();
addons/buy-creds/gateways/skrill.php CHANGED
@@ -223,7 +223,7 @@ if ( !class_exists( 'myCRED_Skrill' ) ) {
223
  */
224
  public function buy() {
225
  if ( !isset( $this->prefs['account'] ) || empty( $this->prefs['account'] ) )
226
- wp_die( __( 'Please setup this gateway before attempting to make a purchaase!', 'mycred' ) );
227
 
228
  $amount = $_REQUEST['amount'];
229
  $home = get_bloginfo( 'url' );
@@ -401,7 +401,7 @@ if ( !class_exists( 'myCRED_Skrill' ) ) {
401
  <li>
402
  <h3><?php _e( 'Important!', 'mycred' ); ?></h3>
403
  <p><span class="description"><strong>1. </strong><?php echo $this->core->template_tags_general( __( 'By default all Skrill Merchant account accept payments via Bank Transfers. When a user selects this option, no %_plural% are awarded! You will need to manually award these once the bank transfer is completed.', 'mycred' ) ); ?></span></p>
404
- <p><span class="description"><strong>2. </strong><?php _e( 'By default purchases made using Skrill will result in users having to signup for a Skrill account (if they do not have one already). You can contact <a href="mailto:">Skrill Merchant Services</a> and request to disable this feature.', 'mycred' ); ?></span></p>
405
  </li>
406
  </ol>
407
  <?php
223
  */
224
  public function buy() {
225
  if ( !isset( $this->prefs['account'] ) || empty( $this->prefs['account'] ) )
226
+ wp_die( __( 'Please setup this gateway before attempting to make a purchase!', 'mycred' ) );
227
 
228
  $amount = $_REQUEST['amount'];
229
  $home = get_bloginfo( 'url' );
401
  <li>
402
  <h3><?php _e( 'Important!', 'mycred' ); ?></h3>
403
  <p><span class="description"><strong>1. </strong><?php echo $this->core->template_tags_general( __( 'By default all Skrill Merchant account accept payments via Bank Transfers. When a user selects this option, no %_plural% are awarded! You will need to manually award these once the bank transfer is completed.', 'mycred' ) ); ?></span></p>
404
+ <p><span class="description"><strong>2. </strong><?php _e( 'By default purchases made using Skrill will result in users having to signup for a Skrill account (if they do not have one already). You can contact Skrill Merchant Services and request to disable this feature.', 'mycred' ); ?></span></p>
405
  </li>
406
  </ol>
407
  <?php
addons/buy-creds/myCRED-addon-buy-creds.php CHANGED
@@ -737,11 +737,11 @@ if ( !class_exists( 'myCRED_Buy_CREDs' ) ) {
737
  if ( $screen_id == 'mycred_page_myCRED_page_settings' ) {
738
  $screen->add_help_tab( array(
739
  'id' => 'mycred-buy-creds',
740
- 'title' => __( 'Buy Creds', 'mycred' ),
741
  'content' => '
742
  <p>' . $this->core->template_tags_general( __( 'This add-on lets your users buy %_plural% using a payment gateway.', 'mycred' ) ) . '</p>
743
  <p><strong>' . __( 'Supported Gateways', 'mycred' ) . '</strong></p>
744
- <p>' . __( 'myCRED supports purchases though: PayPal Payments Standard, Skrill (Moneybookers) and NETbilling. Let us know if you want to add other payment gateways.', 'mycred' ) . '</p>
745
  <p><strong>' . __( 'Usage', 'mycred' ) . '</strong></p>
746
  <p>' . __( 'Purchases can be made using one of the following shortcodes:', 'mycred' ) . '</p>
747
  <ul>
737
  if ( $screen_id == 'mycred_page_myCRED_page_settings' ) {
738
  $screen->add_help_tab( array(
739
  'id' => 'mycred-buy-creds',
740
+ 'title' => $this->core->template_tags_general( __( 'Buy %plural%', 'mycred' ) ),
741
  'content' => '
742
  <p>' . $this->core->template_tags_general( __( 'This add-on lets your users buy %_plural% using a payment gateway.', 'mycred' ) ) . '</p>
743
  <p><strong>' . __( 'Supported Gateways', 'mycred' ) . '</strong></p>
744
+ <p>' . __( 'myCRED supports purchases through: PayPal Payments Standard, Skrill (Moneybookers) and NETbilling. Let us know if you want to add other payment gateways.', 'mycred' ) . '</p>
745
  <p><strong>' . __( 'Usage', 'mycred' ) . '</strong></p>
746
  <p>' . __( 'Purchases can be made using one of the following shortcodes:', 'mycred' ) . '</p>
747
  <ul>
addons/sell-content/myCRED-addon-sell-content.php CHANGED
@@ -601,7 +601,7 @@ if ( !class_exists( 'myCRED_Sell_Content' ) ) {
601
  $content = $wrapper . $content;
602
  }
603
 
604
- return $content;
605
  }
606
 
607
  /**
@@ -677,7 +677,7 @@ if ( !class_exists( 'myCRED_Sell_Content' ) ) {
677
  if ( mycred_is_admin() )
678
  $content = '<div class="mycred-mark-title">' . __( 'The following content is set for sale:', 'mycred' ) . '</div><div class="mycred-mark-content">' . $content . '</div>';
679
 
680
- return $content;
681
  }
682
 
683
  /**
601
  $content = $wrapper . $content;
602
  }
603
 
604
+ return do_shortcode( $content );
605
  }
606
 
607
  /**
677
  if ( mycred_is_admin() )
678
  $content = '<div class="mycred-mark-title">' . __( 'The following content is set for sale:', 'mycred' ) . '</div><div class="mycred-mark-content">' . $content . '</div>';
679
 
680
+ return do_shortcode( $content );
681
  }
682
 
683
  /**
addons/transfer/myCRED-addon-transfer.php CHANGED
@@ -489,7 +489,7 @@ if ( !class_exists( 'myCRED_Widget_Transfer' ) ) {
489
  // Basic details about our widget
490
  $widget_ops = array(
491
  'classname' => 'widget-my-cred-transfer',
492
- 'description' => __( 'Allow cred transfers between users.', 'mycred' )
493
  );
494
  $this->WP_Widget( 'mycred_widget_transfer', __( 'myCRED Transfer', 'mycred' ), $widget_ops );
495
  $this->alt_option_name = 'mycred_widget_transfer';
489
  // Basic details about our widget
490
  $widget_ops = array(
491
  'classname' => 'widget-my-cred-transfer',
492
+ 'description' => __( 'Allow transfers between users.', 'mycred' )
493
  );
494
  $this->WP_Widget( 'mycred_widget_transfer', __( 'myCRED Transfer', 'mycred' ), $widget_ops );
495
  $this->alt_option_name = 'mycred_widget_transfer';
includes/mycred-functions.php CHANGED
@@ -945,7 +945,7 @@ if ( !function_exists( 'mycred_subtract' ) ) {
945
  function mycred_subtract( $ref = '', $user_id = '', $amount = '', $entry = '', $ref_id = '', $data = '', $type = '' )
946
  {
947
  if ( empty( $ref ) || empty( $user_id ) || empty( $amount ) ) return false;
948
- if ( $amount > 0 ) $amount = '-' . $amount;
949
  return mycred_add( $ref, $user_id, $amount, $entry, $ref_id, $data, $type );
950
  }
951
  }
945
  function mycred_subtract( $ref = '', $user_id = '', $amount = '', $entry = '', $ref_id = '', $data = '', $type = '' )
946
  {
947
  if ( empty( $ref ) || empty( $user_id ) || empty( $amount ) ) return false;
948
+ if ( (int) $amount > 0 ) $amount = 0-$amount;
949
  return mycred_add( $ref, $user_id, $amount, $entry, $ref_id, $data, $type );
950
  }
951
  }
includes/mycred-rankings.php CHANGED
@@ -47,8 +47,8 @@ if ( !class_exists( 'myCRED_Rankings' ) ) {
47
  * @since 0.1
48
  * @version 1.0
49
  */
50
- protected function _transients( $reload = false ) {
51
- if ( $this->core->frequency['rate'] == 'always' ) return;
52
 
53
  // Get history
54
  $history = get_option( 'mycred_transients' );
@@ -283,4 +283,16 @@ if ( !function_exists( 'mycred_render_leaderboard' ) ) {
283
  return $rankings->core->template_tags_general( $attr['no-results'] );
284
  }
285
  }
 
 
 
 
 
 
 
 
 
 
 
 
286
  ?>
47
  * @since 0.1
48
  * @version 1.0
49
  */
50
+ public function _transients( $reload = false ) {
51
+ if ( $this->core->frequency['rate'] == 'always' && $reload === false ) return;
52
 
53
  // Get history
54
  $history = get_option( 'mycred_transients' );
283
  return $rankings->core->template_tags_general( $attr['no-results'] );
284
  }
285
  }
286
+
287
+ /**
288
+ * Force Leaderboard Update
289
+ * @since 1.0.9.1
290
+ * @version 1.0
291
+ */
292
+ add_action( 'delete_user', 'mycred_adjust_ranking_delete_user' );
293
+ function mycred_adjust_ranking_delete_user( $user_id )
294
+ {
295
+ $rankings = mycred_rankings();
296
+ $rankings->_transients( true );
297
+ }
298
  ?>
modules/mycred-module-hooks.php CHANGED
@@ -500,10 +500,8 @@ if ( !class_exists( 'myCRED_Hook_Publishing_Content' ) ) {
500
  if ( empty( $this->prefs[$post_type]['creds'] ) || $this->prefs[$post_type]['creds'] == 0 ) return;
501
 
502
  // We want to fire when content get published or when it gets privatly published
503
- if (
504
- ( $old_status == 'auto-draft' && $new_status == 'publish' && array_key_exists( $post_type, $this->prefs ) ) ||
505
- ( $old_status == 'draft' && $new_status == 'publish' && array_key_exists( $post_type, $this->prefs ) ) ||
506
- ( $old_status == 'private' && $new_status == 'publish' && array_key_exists( $post_type, $this->prefs ) ) ) {
507
 
508
  // Make sure this is unique
509
  if ( $this->has_entry( 'publishing_content', $post_id, $user_id ) ) return;
@@ -1231,7 +1229,7 @@ if ( !class_exists( 'myCRED_Hook_BadgeOS' ) && class_exists( 'BadgeOS' ) ) {
1231
  /**
1232
  * Save Achievement Data
1233
  * @since 1.0.8
1234
- * @version 1.0
1235
  */
1236
  public function save_achivement_data( $post_id ) {
1237
  // Post Type
@@ -1262,7 +1260,7 @@ if ( !class_exists( 'myCRED_Hook_BadgeOS' ) && class_exists( 'BadgeOS' ) ) {
1262
  $data['log'] = strip_tags( $this->prefs[$post_type]['log'] );
1263
 
1264
  // If deduction is enabled save log template
1265
- if ( $this->prefs[$post->post_type]['deduct'] == 1 ) {
1266
  if ( !empty( $_POST['mycred_values']['deduct_log'] ) && $_POST['mycred_values']['deduct_log'] != $this->prefs[$post_type]['deduct_log'] )
1267
  $data['deduct_log'] = strip_tags( $_POST['mycred_values']['deduct_log'] );
1268
  else
@@ -1309,7 +1307,7 @@ if ( !class_exists( 'myCRED_Hook_BadgeOS' ) && class_exists( 'BadgeOS' ) ) {
1309
  * Revoke Achievement
1310
  * Run by BadgeOS when a users achievement is revoed.
1311
  * @since 1.0.8
1312
- * @version 1.0
1313
  */
1314
  public function revoke_achievement( $user_id, $achievement_id ) {
1315
  $post_type = get_post_type( $achievement_id );
@@ -1330,7 +1328,7 @@ if ( !class_exists( 'myCRED_Hook_BadgeOS' ) && class_exists( 'BadgeOS' ) ) {
1330
  $post_type_object->labels->name,
1331
  $user_id,
1332
  0-$achievement_data['creds'],
1333
- $achievement_data['log'],
1334
  $post_type,
1335
  array( 'ref_type' => 'post' )
1336
  );
500
  if ( empty( $this->prefs[$post_type]['creds'] ) || $this->prefs[$post_type]['creds'] == 0 ) return;
501
 
502
  // We want to fire when content get published or when it gets privatly published
503
+ $status = apply_filters( 'mycred_publish_hook_old', array( 'new', 'auto-draft', 'draft', 'private', 'pending' ) );
504
+ if ( in_array( $old_status, $status ) && $new_status == 'publish' && array_key_exists( $post_type, $this->prefs ) ) {
 
 
505
 
506
  // Make sure this is unique
507
  if ( $this->has_entry( 'publishing_content', $post_id, $user_id ) ) return;
1229
  /**
1230
  * Save Achievement Data
1231
  * @since 1.0.8
1232
+ * @version 1.1
1233
  */
1234
  public function save_achivement_data( $post_id ) {
1235
  // Post Type
1260
  $data['log'] = strip_tags( $this->prefs[$post_type]['log'] );
1261
 
1262
  // If deduction is enabled save log template
1263
+ if ( $this->prefs[$post_type]['deduct'] == 1 ) {
1264
  if ( !empty( $_POST['mycred_values']['deduct_log'] ) && $_POST['mycred_values']['deduct_log'] != $this->prefs[$post_type]['deduct_log'] )
1265
  $data['deduct_log'] = strip_tags( $_POST['mycred_values']['deduct_log'] );
1266
  else
1307
  * Revoke Achievement
1308
  * Run by BadgeOS when a users achievement is revoed.
1309
  * @since 1.0.8
1310
+ * @version 1.1
1311
  */
1312
  public function revoke_achievement( $user_id, $achievement_id ) {
1313
  $post_type = get_post_type( $achievement_id );
1328
  $post_type_object->labels->name,
1329
  $user_id,
1330
  0-$achievement_data['creds'],
1331
+ $achievement_data['deduct_log'],
1332
  $post_type,
1333
  array( 'ref_type' => 'post' )
1334
  );
modules/mycred-module-log.php CHANGED
@@ -785,7 +785,7 @@ if ( !class_exists( 'myCRED_Query_Log' ) ) {
785
  * Generated a single entry row depending on the columns used / requested.
786
  *
787
  * @since 0.1
788
- * @version 1.0
789
  */
790
  public function get_the_entry( $log_entry ) {
791
  $date = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
@@ -797,7 +797,12 @@ if ( !class_exists( 'myCRED_Query_Log' ) ) {
797
  // Username Column
798
  case 'column-username':
799
  $user = get_userdata( $log_entry->user_id );
800
- $content = '<span>' . $user->display_name . '</span>';
 
 
 
 
 
801
  unset( $user );
802
  break;
803
  // Date & Time Column
785
  * Generated a single entry row depending on the columns used / requested.
786
  *
787
  * @since 0.1
788
+ * @version 1.1
789
  */
790
  public function get_the_entry( $log_entry ) {
791
  $date = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
797
  // Username Column
798
  case 'column-username':
799
  $user = get_userdata( $log_entry->user_id );
800
+
801
+ if ( $user === false )
802
+ $content = '<span>' . __( 'User Missing', 'mycred' ) . ' (ID: ' . $log_entry->user_id . ')</span>';
803
+ else
804
+ $content = '<span>' . $user->display_name . '</span>';
805
+
806
  unset( $user );
807
  break;
808
  // Date & Time Column
mycred.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: myCRED
4
  Plugin URI: http://mycred.me
5
  Description: <strong>my</strong>CRED is an adaptive points management system for WordPress powered websites, giving you full control on how points are gained, used, traded, managed, logged or presented.
6
- Version: 1.0.9
7
  Tags: points, tokens, credit, management, reward, charge
8
  Author: Gabriel S Merovingi
9
  Author URI: http://www.merovingi.com
@@ -13,7 +13,7 @@ Tested up to: WP 3.5.1
13
  License: GPLv2 or later
14
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
15
  */
16
- define( 'myCRED_VERSION', '1.0.9' );
17
  define( 'myCRED_SLUG', 'mycred' );
18
 
19
  define( 'myCRED_THIS', __FILE__ );
3
  Plugin Name: myCRED
4
  Plugin URI: http://mycred.me
5
  Description: <strong>my</strong>CRED is an adaptive points management system for WordPress powered websites, giving you full control on how points are gained, used, traded, managed, logged or presented.
6
+ Version: 1.0.9.1
7
  Tags: points, tokens, credit, management, reward, charge
8
  Author: Gabriel S Merovingi
9
  Author URI: http://www.merovingi.com
13
  License: GPLv2 or later
14
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
15
  */
16
+ define( 'myCRED_VERSION', '1.0.9.1' );
17
  define( 'myCRED_SLUG', 'mycred' );
18
 
19
  define( 'myCRED_THIS', __FILE__ );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: http://mycred.me/donate/
4
  Tags:points, tokens, credit, management, reward, charge, community, BuddyPress, Jetpack
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
- Stable tag: 1.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -122,6 +122,13 @@ Yes but if one of them is bought, all is shown. The mycred_sell_this shortcode w
122
 
123
  == Changelog ==
124
 
 
 
 
 
 
 
 
125
  = 1.0.9 =
126
  * Adjusted plugin URLs in files that were missed previously.
127
  * Fixed Bug #16 - PHP Notice when using the `mycred_history` shortcode.
4
  Tags:points, tokens, credit, management, reward, charge, community, BuddyPress, Jetpack
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
+ Stable tag: 1.0.9.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
122
 
123
  == Changelog ==
124
 
125
+ = 1.0.9.1 =
126
+ * Fixed Bug #17 - Shortcodes inside mycred_sell_this does not render.
127
+ * Fixed Bug #18 - Pending posts that gets published by admin are not awarded points.
128
+ * Fixed Bug #19 - mycred_subtract function not working properly.
129
+ * Fixed Bug #20 - If user id deleted the log returns empty string.
130
+ * Fixed Bug #21 - If user is removed the ranking is not updated leaving to missing users.
131
+
132
  = 1.0.9 =
133
  * Adjusted plugin URLs in files that were missed previously.
134
  * Fixed Bug #16 - PHP Notice when using the `mycred_history` shortcode.