Changeset 3478905
- Timestamp:
- 03/10/2026 08:56:38 AM (3 weeks ago)
- Location:
- mycred/trunk
- Files:
-
- 8 edited
-
addons/rank-plus/includes/blocks/index.js (modified) (10 diffs)
-
addons/rank-plus/includes/blocks/mycred-rank-congratulation-block/block.json (modified) (1 diff)
-
addons/rank-plus/includes/blocks/mycred-rank-earners-block/block.json (modified) (2 diffs)
-
addons/rank-plus/includes/blocks/mycred-rank-requirements-block/block.json (modified) (2 diffs)
-
includes/hooks/external/mycred-hook-contact-form7.php (modified) (15 diffs)
-
includes/mycred-blocks/blocks/mycred-leaderboard-position/block.json (modified) (1 diff)
-
mycred.php (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mycred/trunk/addons/rank-plus/includes/blocks/index.js
r3363925 r3478905 1 1 (function (wp) { 2 2 var registerBlockType = wp.blocks.registerBlockType; 3 var el = wp.element.createElement;4 var __ = wp.i18n.__;3 var el = wp.element.createElement; 4 var __ = wp.i18n.__; 5 5 6 6 registerBlockType( 7 7 'mycred-rank-blocks/mycred-rank-congratulation-message', 8 8 { 9 title: __( 'myCred Rank Congratulation Message', 'mycred-rank-plus'),9 title: __('Rank Congratulation Message', 'mycred-rank-plus'), 10 10 category: 'mycred-rank', 11 11 edit: function (props) { 12 12 13 return el( asyncCongratulationMessage);13 return el(asyncCongratulationMessage); 14 14 15 15 } … … 20 20 'mycred-rank-blocks/mycred-rank-requirements', 21 21 { 22 title: __( 'myCred Rank Requirements', 'mycred-rank-plus'),22 title: __('Rank Requirements', 'mycred-rank-plus'), 23 23 category: 'mycred-rank', 24 24 edit: function (props) { … … 27 27 'div', 28 28 {}, 29 el( 'h4', { style: { margin: '5px' } }, 'Requirements'),29 el('h4', { style: { margin: '5px' } }, 'Requirements'), 30 30 el( 31 31 'ol', 32 32 {}, 33 el( 'li', { style: { textDecoration: 'line-through' } }, 'Website Registration'),34 el( 'li', { style: { textDecoration: 'line-through' } }, 'Content Purchase'),35 el( 'li', {}, 'WooCommerce Purchase Reward'),36 el( 'li', {}, 'Signup Referral')33 el('li', { style: { textDecoration: 'line-through' } }, 'Website Registration'), 34 el('li', { style: { textDecoration: 'line-through' } }, 'Content Purchase'), 35 el('li', {}, 'WooCommerce Purchase Reward'), 36 el('li', {}, 'Signup Referral') 37 37 ), 38 38 ); … … 45 45 'mycred-rank-blocks/mycred-rank-earners', 46 46 { 47 title: __( 'myCred Rank Earners', 'mycred-rank-plus'),47 title: __('Rank Earners', 'mycred-rank-plus'), 48 48 category: 'mycred-rank', 49 49 edit: function (props) { … … 71 71 'div', 72 72 {}, 73 el( 'h4', { style: { margin: '5px' } }, 'People who earned this:'),73 el('h4', { style: { margin: '5px' } }, 'People who earned this:'), 74 74 el( 75 75 'ul', … … 78 78 'li', 79 79 { style: liStyle }, 80 el( 'i', { class: 'dashicons dashicons-businessman', style: iStyle }, ''),81 el( 'p', { style: pStyle }, 'john')80 el('i', { class: 'dashicons dashicons-businessman', style: iStyle }, ''), 81 el('p', { style: pStyle }, 'john') 82 82 ), 83 83 el( 84 84 'li', 85 85 { style: liStyle }, 86 el( 'i', { class: 'dashicons dashicons-businesswoman', style: iStyle }, ''),87 el( 'p', { style: pStyle }, 'allie')86 el('i', { class: 'dashicons dashicons-businesswoman', style: iStyle }, ''), 87 el('p', { style: pStyle }, 'allie') 88 88 ), 89 89 el( 90 90 'li', 91 91 { style: liStyle }, 92 el( 'i', { class: 'dashicons dashicons-businessperson', style: iStyle }, ''),93 el( 'p', { style: pStyle }, 'fred')92 el('i', { class: 'dashicons dashicons-businessperson', style: iStyle }, ''), 93 el('p', { style: pStyle }, 'fred') 94 94 ), 95 95 el( 96 96 'li', 97 97 { style: liStyle }, 98 el( 'i', { class: 'dashicons dashicons-admin-users', style: iStyle }, ''),99 el( 'p', { style: pStyle }, 'jaxon')98 el('i', { class: 'dashicons dashicons-admin-users', style: iStyle }, ''), 99 el('p', { style: pStyle }, 'jaxon') 100 100 ), 101 101 el( 102 102 'li', 103 103 { style: liStyle }, 104 el( 'i', { class: 'dashicons dashicons-businessman', style: iStyle }, ''),105 el( 'p', { style: pStyle }, 'karel')104 el('i', { class: 'dashicons dashicons-businessman', style: iStyle }, ''), 105 el('p', { style: pStyle }, 'karel') 106 106 ) 107 107 ), … … 112 112 ); 113 113 114 function MycredPlaceholderComponent( props) {114 function MycredPlaceholderComponent(props) { 115 115 116 if ( props.height == undefined) {116 if (props.height == undefined) { 117 117 118 118 props.height = '20px'; … … 123 123 'div', 124 124 { class: "mycred-loading-placeholder", style: { height: props.height } }, 125 el( 'div', {})125 el('div', {}) 126 126 ); 127 127 128 128 } 129 129 130 function CongratulationMessageComponent( props) {130 function CongratulationMessageComponent(props) { 131 131 132 132 return el( … … 147 147 148 148 var asyncCongratulationMessage = wp.data.withSelect( 149 function ( select) {149 function (select) { 150 150 151 var data = select( 'core/editor' ).getEditedPostAttribute( 'meta');151 var data = select('core/editor').getEditedPostAttribute('meta'); 152 152 153 153 return { … … 156 156 157 157 } 158 )( CongratulationMessageComponent);158 )(CongratulationMessageComponent); 159 159 160 })( window.wp);160 })(window.wp); -
mycred/trunk/addons/rank-plus/includes/blocks/mycred-rank-congratulation-block/block.json
r3363925 r3478905 1 1 { 2 2 "apiVersion": 2, 3 "title": " myCredRank Congratulation Message",3 "title": "Rank Congratulation Message", 4 4 "name": "mycred-rank-blocks/mycred-rank-congratulation-block", 5 5 "category": "mycred-rank", 6 "icon": " dashicons dashicons-mycred-main",6 "icon": "awards", 7 7 "editorScript": "file:./block.js", 8 8 "supports": { 9 9 "multiple": false, 10 10 "reusable": false, 11 "align": [ "wide", "full" ], 11 "align": [ 12 "wide", 13 "full" 14 ], 12 15 "html": false, 13 16 "color": { -
mycred/trunk/addons/rank-plus/includes/blocks/mycred-rank-earners-block/block.json
r3363925 r3478905 1 1 { 2 2 "apiVersion": 2, 3 "title": " myCredRank Earners",3 "title": "Rank Earners", 4 4 "name": "mycred-rank-blocks/mycred-rank-earners-block", 5 5 "category": "mycred-rank", 6 "icon": " dashicons dashicons-mycred-main",6 "icon": "admin-users", 7 7 "editorScript": "file:./block.js", 8 8 "attributes": { … … 68 68 "multiple": false, 69 69 "reusable": false, 70 "align": [ "wide", "full" ] 70 "align": [ 71 "wide", 72 "full" 73 ] 71 74 } 72 75 } -
mycred/trunk/addons/rank-plus/includes/blocks/mycred-rank-requirements-block/block.json
r3363925 r3478905 1 1 { 2 2 "apiVersion": 2, 3 "title": " myCredRank Requirements",3 "title": "Rank Requirements", 4 4 "name": "mycred-rank-blocks/mycred-rank-requirements-block", 5 5 "category": "mycred-rank", 6 "icon": " dashicons dashicons-mycred-main",6 "icon": "clipboard", 7 7 "editorScript": "file:./block.js", 8 8 "attributes": { … … 61 61 "multiple": false, 62 62 "reusable": false, 63 "align": [ "wide", "full" ] 63 "align": [ 64 "wide", 65 "full" 66 ] 64 67 } 65 68 } -
mycred/trunk/includes/hooks/external/mycred-hook-contact-form7.php
r3363925 r3478905 1 1 <?php 2 2 if ( ! defined( 'myCRED_VERSION' ) ) exit; 3 4 3 /** 5 4 * Register Hook … … 9 8 add_filter( 'mycred_setup_hooks', 'mycred_register_contact_form_seven_hook', 50 ); 10 9 function mycred_register_contact_form_seven_hook( $installed ) { 11 12 10 if ( ! function_exists( 'wpcf7' ) ) return $installed; 13 14 11 $installed['contact_form7'] = array( 15 12 'title' => __( 'Contact Form 7 Form Submissions', 'mycred' ), … … 18 15 'callback' => array( 'myCRED_Contact_Form7' ) 19 16 ); 20 21 17 return $installed; 22 23 18 } 24 25 19 /** 26 20 * Contact Form 7 Hook … … 30 24 add_action( 'mycred_load_hooks', 'mycred_load_contact_form_seven_hook', 50 ); 31 25 function mycred_load_contact_form_seven_hook() { 32 33 26 // If the hook has been replaced or if plugin is not installed, exit now 34 27 if ( class_exists( 'myCRED_Contact_Form7' ) || ! function_exists( 'wpcf7' ) ) return; 35 36 28 class myCRED_Contact_Form7 extends myCRED_Hook { 37 38 29 public $user_id = 0; 39 40 30 /** 41 31 * Construct 42 32 */ 43 33 public function __construct( $hook_prefs, $type = MYCRED_DEFAULT_TYPE_KEY ) { 44 45 34 parent::__construct( array( 46 35 'id' => 'contact_form7', 47 36 'defaults' => array() 48 37 ), $hook_prefs, $type ); 49 50 } 51 38 } 52 39 /** 53 40 * Run … … 56 43 */ 57 44 public function run() { 58 59 45 if ( is_user_logged_in() ) { 60 61 46 $this->user_id = get_current_user_id(); 62 63 47 add_action( 'wpcf7_submit', array( $this, 'form_submission' ), 10, 2 ); 64 65 } 66 48 } 67 49 } 68 69 50 /** 70 51 * Get Forms … … 74 55 */ 75 56 public function get_forms() { 76 77 57 global $wpdb; 78 79 58 $restuls = array(); 80 59 $posts_table = mycred_get_db_column( 'posts' ); … … 84 63 WHERE post_type = %s 85 64 ORDER BY ID ASC;", 'wpcf7_contact_form' ) ); 86 87 65 if ( $forms ) { 88 66 foreach ( $forms as $form ) 89 67 $restuls[ $form->ID ] = $form->post_title; 90 68 } 91 92 69 return $restuls; 93 94 } 95 70 } 96 71 /** 97 72 * Successful Form Submission … … 100 75 */ 101 76 public function form_submission( $form, $result ) { 102 103 77 // Login is required 104 78 if ( empty( $this->user_id ) ) return; 105 106 79 $form_id = ( version_compare( WPCF7_VERSION, '4.8', '<' ) ) ? $form->id : $form->id(); 107 108 80 if ( ! isset( $this->prefs[ $form_id ] ) || ! $this->prefs[ $form_id ]['creds'] != 0 ) return; 109 110 81 // Check for exclusions 111 82 if ( $this->core->exclude_user( $this->user_id ) ) return; 112 113 83 // Limit 114 if ( $this->over_hook_limit( $form_id, 'contact_form_submission', $this->user_id ) ) return; 115 84 if ( $this->over_hook_limit( $form_id, 'contact_form_submission', $this->user_id, $form_id ) ) return; 116 85 $this->core->add_creds( 117 86 'contact_form_submission', … … 123 92 $this->mycred_type 124 93 ); 125 126 } 127 94 } 95 /** 96 * Check Limit 97 * @since 1.6 98 * @version 1.3 99 */ 100 public function over_hook_limit( $instance = '', $reference = '', $user_id = NULL, $ref_id = NULL ) { 101 // If logging is disabled, we cant use this feature 102 if ( ! MYCRED_ENABLE_LOGGING ) return false; 103 // Enforce limit if this function is used incorrectly 104 if ( ! isset( $this->prefs[ $instance ] ) && $instance != '' ) 105 return true; 106 global $wpdb, $mycred_log_table; 107 // Prep 108 $wheres = array(); 109 $now = current_time( 'timestamp' ); 110 // If hook uses multiple instances 111 if ( isset( $this->prefs[ $instance ]['limit'] ) ) 112 $prefs = $this->prefs[ $instance ]['limit']; 113 // no support for limits 114 else { 115 return false; 116 } 117 // If the user ID is not set use the current one 118 if ( $user_id === NULL ) 119 $user_id = get_current_user_id(); 120 if ( count( explode( '/', $prefs ) ) != 2 ) 121 $prefs = '0/x'; 122 // Set to "no limit" 123 if ( $prefs === '0/x' ) return false; 124 // Prep settings 125 list ( $amount, $period ) = explode( '/', $prefs ); 126 $amount = (int) $amount; 127 // We start constructing the query. 128 $wheres[] = $wpdb->prepare( "user_id = %d", $user_id ); 129 $wheres[] = $wpdb->prepare( "ref = %s", $reference ); 130 $wheres[] = $wpdb->prepare( "ctype = %s", $this->mycred_type ); 131 $wheres[] = $wpdb->prepare( "ref_id = %d", $ref_id ); 132 // If check is based on time 133 if ( ! in_array( $period, array( 't', 'x' ) ) ) { 134 // Per day 135 if ( $period == 'd' ) 136 $from = mktime( 0, 0, 0, date( 'n', $now ), date( 'j', $now ), date( 'Y', $now ) ); 137 // Per week 138 elseif ( $period == 'w' ) 139 $from = mktime( 0, 0, 0, date( "n", $now ), date( "j", $now ) - date( "N", $now ) + 1 ); 140 // Per Month 141 elseif ( $period == 'm' ) 142 $from = mktime( 0, 0, 0, date( "n", $now ), 1, date( 'Y', $now ) ); 143 $wheres[] = $wpdb->prepare( "time BETWEEN %d AND %d", $from, $now ); 144 } 145 $over_limit = false; 146 if ( ! empty( $wheres ) ) { 147 // Put all wheres together into one string 148 $wheres = implode( " AND ", $wheres ); 149 $query = "SELECT COUNT(*) FROM {$mycred_log_table} WHERE {$wheres};"; 150 //Lets play for others 151 $query = apply_filters( 'mycred_contactform7_hook_limit_query', $query, $instance, $reference, $user_id, $ref_id, $wheres, $this ); 152 // Count 153 $count = $wpdb->get_var( $query ); 154 if ( $count === NULL ) $count = 0; 155 // Limit check is first priority 156 if ( $period != 'x' && $count >= $amount ) 157 $over_limit = true; 158 } 159 return apply_filters( 'mycred_contactform7_over_hook_limit', $over_limit, $instance, $reference, $user_id, $ref_id, $this ); 160 } 128 161 /** 129 162 * Preferences for Contact Form 7 Hook … … 132 165 */ 133 166 public function preferences() { 134 135 167 $prefs = $this->prefs; 136 168 if ( $prefs === false ) $prefs = array(); 137 138 169 $forms = $this->get_forms(); 139 140 170 // No forms found 141 171 if ( empty( $forms ) ) { … … 143 173 return; 144 174 } 145 146 175 // Loop though prefs to make sure we always have a default settings (happens when a new form has been created) 147 176 foreach ( $forms as $form_id => $form_title ) { 148 149 177 if ( ! array_key_exists( $form_id, $prefs ) ) { 150 178 $prefs[ $form_id ] = array( … … 154 182 ); 155 183 } 156 157 184 if ( ! isset( $prefs[ $form_id ]['limit'] ) ) 158 185 $prefs[ $form_id ]['limit'] = '0/x'; 159 160 } 161 186 } 162 187 // Set pref if empty 163 188 if ( empty( $prefs ) ) $this->prefs = $prefs; 164 165 189 // Loop for settings 166 190 foreach ( $forms as $form_id => $form_title ) { 167 168 191 ?> 169 192 <div class="hook-instance"> … … 217 240 </div> 218 241 <?php 219 220 } 221 222 } 223 242 } 243 } 224 244 /** 225 245 * Sanitise Preferences … … 228 248 */ 229 249 public function sanitise_preferences( $data ) { 230 231 250 $forms = $this->get_forms(); 232 251 foreach ( $forms as $form_id => $form_title ) { 233 234 252 if ( isset( $data[ $form_id ]['limit'] ) && isset( $data[ $form_id ]['limit_by'] ) ) { 235 253 $limit = sanitize_text_field( $data[ $form_id ]['limit'] ); … … 238 256 unset( $data[ $form_id ]['limit_by'] ); 239 257 } 240 241 } 242 258 } 243 259 return $data; 244 245 } 246 260 } 247 261 } 248 249 262 } -
mycred/trunk/includes/mycred-blocks/blocks/mycred-leaderboard-position/block.json
r3363925 r3478905 3 3 "apiVersion": 2, 4 4 "name": "mycred-gb-blocks/mycred-leaderboard-position", 5 "title": " MyCredLeaderboard Position",6 "category": " widgets",7 "icon": " trophy",5 "title": "Leaderboard Position", 6 "category": "mycred", 7 "icon": "awards", 8 8 "description": "Displays a user's position in the MyCred leaderboard.", 9 9 "attributes": { -
mycred/trunk/mycred.php
r3476298 r3478905 4 4 * Plugin URI: https://mycred.me 5 5 * Description: An adaptive points management system for WordPress powered websites. 6 * Version: 3.0. 16 * Version: 3.0.2 7 7 * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards 8 8 * Author: myCred … … 21 21 22 22 // Plugin Version 23 public $version = '3.0. 1';23 public $version = '3.0.2'; 24 24 25 25 // Instnace -
mycred/trunk/readme.txt
r3477941 r3478905 4 4 Requires at least: 4.8 5 5 Tested up to: 6.9 6 Stable tag: 3.0. 16 Stable tag: 3.0.2 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 37 37 38 38 **Badges** – Use myCred as a full-featured WordPress & WooCommerce rewards system plugin to award badges for achievements, encouraging higher participation, engagement, and community growth. 39 40 == myCred Dashboard == 41 The myCred Dashboard provides a centralized interface to monitor and manage points and rewards across your WordPress site. It helps administrators track loyalty points, user engagement, and overall rewards activity from one place. 42 43 - **Program Overview** – Monitor participation, engagement, and performance of your loyalty program. 44 - **Points Management** – Award or deduct points instantly to maintain a balanced points and rewards system. 45 - **User Insights** – Search users to view activity, manage loyalty points, and assign badges or ranks. 46 - **Activity Tracking** – Review recent transactions, top members, and rewards activity in real time. 47 - **WooCommerce Rewards Metrics** – Track points earned from purchases, points redeemed at checkout, and the revenue impact of WooCommerce rewards. 48 - **Flexible Controls** – Filter data by user, point type, or date to analyze points and rewards performance. 49 50 The dashboard simplifies the administration of loyalty points, badges, and WooCommerce rewards, making myCred a powerful rewards plugin for managing WordPress points and rewards programs. 39 51 40 52 == myCred Toolkit == … … 282 294 == Upgrade Notice == 283 295 296 = 3.0.2 = 297 Fixed Gutenberg block icons, revised block names. 298 Resolved the limit issue in Contact Form 7 submissions. 299 284 300 = 3.0.1 = 285 301 Added Links and improved UI fixed in dashboard. … … 502 518 503 519 == Changelog == 520 521 = 3.0.2 = 522 - **FIX** - Improved Gutenberg block icons and removed "myCred" prefix from block names for better visibility on WordPress.org. 523 - **FIX** - Resolved limit issues in Contact Form 7 form submissions by correctly passing the form ID to the limit checker. 504 524 505 525 = 3.0.1 =
Note: See TracChangeset
for help on using the changeset viewer.