Changeset 2034415
- Timestamp:
- 02/19/2019 06:34:38 PM (7 years ago)
- Location:
- woo-earn-sharing/trunk
- Files:
-
- 4 edited
-
admin/class-woo-earn-sharing-admin.php (modified) (1 diff)
-
admin/partials/woo-earn-sharing-admin-display.php (modified) (1 diff)
-
includes/class-woo-earn-sharing-util.php (modified) (1 diff)
-
public/partials/woo-earn-sharing-public-display.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
woo-earn-sharing/trunk/admin/class-woo-earn-sharing-admin.php
r1973077 r2034415 94 94 95 95 function wooes_register_plugin_settings() { 96 register_setting( 'wooes-plugins-settings-group', 'wooes_reward_percent', array('default' => 10) ); 96 register_setting( 'wooes-plugins-settings-group', 'wooes_reward_percent', array('default' => 10, 'sanitize_callback' => 'floatval') ); 97 register_setting( 'wooes-plugins-settings-group', 'wooes_reward_max', array('default' => 0, 'sanitize_callback' => 'floatval') ); 97 98 register_setting( 'wooes-plugins-settings-group', 'wooes_referrals' ); 98 register_setting( 'wooes-plugins-settings-group', 'wooes_code_length', array('default' => 6 ) );99 register_setting( 'wooes-plugins-settings-group', 'wooes_code_length', array('default' => 6, 'sanitize_callback' => 'intval') ); 99 100 register_setting( 'wooes-plugins-settings-group', 'wooes_code_alphanumeric', array('default' => 'false') ); 100 101 register_setting( 'wooes-plugins-settings-group', 'wooes_money_back', array('default' => 'true') ); -
woo-earn-sharing/trunk/admin/partials/woo-earn-sharing-admin-display.php
r1973077 r2034415 28 28 <th scope="row"><?php _e('Reward %','woo-earn-sharing') ?></th> 29 29 <td><input type="number" step="0.01" name="wooes_reward_percent" value="<?php echo esc_attr( get_option('wooes_reward_percent') ); ?>" /></td> 30 </tr> 31 32 <tr valign="top"> 33 <th scope="row"><?php _e('Max reward','woo-earn-sharing') ?> <span style="font-weight:100;font-size:0.8rem;float: left;width: 100%;"><?php _e('0 to unlimited','woo-earn-sharing') ?></span> </th> 34 <td><input type="number" step="0.01" name="wooes_reward_max" value="<?php echo esc_attr( get_option('wooes_reward_max',0) ); ?>" /></td> 30 35 </tr> 31 36 -
woo-earn-sharing/trunk/includes/class-woo-earn-sharing-util.php
r1973077 r2034415 33 33 $old_balance = floatval(get_user_meta($user->ID, 'wooes_balance',true)); 34 34 $reward_percent = floatval(get_option('wooes_reward_percent'))/100; 35 update_user_meta($user->ID, 'wooes_balance', $old_balance+$order->get_total()*$reward_percent); 36 wp_die(get_user_meta($user->ID, 'wooes_balance',true)); 35 $give = $order->get_total()*$reward_percent; 36 if ($give > floatval(get_option('wooes_reward_max')) && floatval(get_option('wooes_reward_max')) != 0) { 37 $give = floatval(get_option('wooes_reward_max')); 38 } 39 update_user_meta($user->ID, 'wooes_balance', $old_balance+$give); 37 40 38 41 } -
woo-earn-sharing/trunk/public/partials/woo-earn-sharing-public-display.php
r1973077 r2034415 24 24 25 25 <div class="wooes-my-account-page"> 26 <?php echo do_shortcode(wp_kses_post(get_option('wooes_page_html'))) ?> 26 <?php 27 if (empty(get_option('wooes_page_html'))) { 28 echo "<div class=\"wooes-my-account-info\"> 29 <div class=\"current-balance\"> 30 31 Balance: [wooes_user_balance] 32 33 </div> 34 <div class=\"current-code\"> 35 36 Your Code: [wooes_user_code] 37 38 </div> 39 </div>"; 40 }else{ 41 echo do_shortcode(wp_kses_post(get_option('wooes_page_html'))); 42 } 43 ?> 27 44 </div> 28 45 </div>
Note: See TracChangeset
for help on using the changeset viewer.