Plugin Directory

Changeset 3478905


Ignore:
Timestamp:
03/10/2026 08:56:38 AM (3 weeks ago)
Author:
wpexpertsio
Message:

3.0.2

Fixed Gutenberg block icons, revised block names.
Resolved the limit issue in Contact Form 7 submissions.

Location:
mycred/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • mycred/trunk/addons/rank-plus/includes/blocks/index.js

    r3363925 r3478905  
    11(function (wp) {
    22    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.__;
    55
    66    registerBlockType(
    77        'mycred-rank-blocks/mycred-rank-congratulation-message',
    88        {
    9             title: __( 'myCred Rank Congratulation Message', 'mycred-rank-plus' ),
     9            title: __('Rank Congratulation Message', 'mycred-rank-plus'),
    1010            category: 'mycred-rank',
    1111            edit: function (props) {
    1212
    13                 return el( asyncCongratulationMessage );
     13                return el(asyncCongratulationMessage);
    1414
    1515            }
     
    2020        'mycred-rank-blocks/mycred-rank-requirements',
    2121        {
    22             title: __( 'myCred Rank Requirements', 'mycred-rank-plus' ),
     22            title: __('Rank Requirements', 'mycred-rank-plus'),
    2323            category: 'mycred-rank',
    2424            edit: function (props) {
     
    2727                    'div',
    2828                    {},
    29                     el( 'h4', { style: { margin: '5px' } }, 'Requirements' ),
     29                    el('h4', { style: { margin: '5px' } }, 'Requirements'),
    3030                    el(
    3131                        'ol',
    3232                        {},
    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')
    3737                    ),
    3838                );
     
    4545        'mycred-rank-blocks/mycred-rank-earners',
    4646        {
    47             title: __( 'myCred Rank Earners', 'mycred-rank-plus' ),
     47            title: __('Rank Earners', 'mycred-rank-plus'),
    4848            category: 'mycred-rank',
    4949            edit: function (props) {
     
    7171                    'div',
    7272                    {},
    73                     el( 'h4', { style: { margin: '5px' } }, 'People who earned this:' ),
     73                    el('h4', { style: { margin: '5px' } }, 'People who earned this:'),
    7474                    el(
    7575                        'ul',
     
    7878                            'li',
    7979                            { 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')
    8282                        ),
    8383                        el(
    8484                            'li',
    8585                            { 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')
    8888                        ),
    8989                        el(
    9090                            'li',
    9191                            { 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')
    9494                        ),
    9595                        el(
    9696                            'li',
    9797                            { 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')
    100100                        ),
    101101                        el(
    102102                            'li',
    103103                            { 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')
    106106                        )
    107107                    ),
     
    112112    );
    113113
    114     function MycredPlaceholderComponent( props ) {
     114    function MycredPlaceholderComponent(props) {
    115115
    116         if ( props.height == undefined ) {
     116        if (props.height == undefined) {
    117117
    118118            props.height = '20px';
     
    123123            'div',
    124124            { class: "mycred-loading-placeholder", style: { height: props.height } },
    125             el( 'div', {} )
     125            el('div', {})
    126126        );
    127127
    128128    }
    129129
    130     function CongratulationMessageComponent( props ) {
     130    function CongratulationMessageComponent(props) {
    131131
    132132        return el(
     
    147147
    148148    var asyncCongratulationMessage = wp.data.withSelect(
    149         function ( select ) {
     149        function (select) {
    150150
    151             var data = select( 'core/editor' ).getEditedPostAttribute( 'meta' );
     151            var data = select('core/editor').getEditedPostAttribute('meta');
    152152
    153153            return {
     
    156156
    157157        }
    158     )( CongratulationMessageComponent );
     158    )(CongratulationMessageComponent);
    159159
    160 })( window.wp );
     160})(window.wp);
  • mycred/trunk/addons/rank-plus/includes/blocks/mycred-rank-congratulation-block/block.json

    r3363925 r3478905  
    11{
    22    "apiVersion": 2,
    3     "title": "myCred Rank Congratulation Message",
     3    "title": "Rank Congratulation Message",
    44    "name": "mycred-rank-blocks/mycred-rank-congratulation-block",
    55    "category": "mycred-rank",
    6     "icon": "dashicons dashicons-mycred-main",
     6    "icon": "awards",
    77    "editorScript": "file:./block.js",
    88    "supports": {
    99        "multiple": false,
    1010        "reusable": false,
    11         "align": [ "wide", "full" ],
     11        "align": [
     12            "wide",
     13            "full"
     14        ],
    1215        "html": false,
    1316        "color": {
  • mycred/trunk/addons/rank-plus/includes/blocks/mycred-rank-earners-block/block.json

    r3363925 r3478905  
    11{
    22    "apiVersion": 2,
    3     "title": "myCred Rank Earners",
     3    "title": "Rank Earners",
    44    "name": "mycred-rank-blocks/mycred-rank-earners-block",
    55    "category": "mycred-rank",
    6     "icon": "dashicons dashicons-mycred-main",
     6    "icon": "admin-users",
    77    "editorScript": "file:./block.js",
    88    "attributes": {
     
    6868        "multiple": false,
    6969        "reusable": false,
    70         "align": [ "wide", "full" ]
     70        "align": [
     71            "wide",
     72            "full"
     73        ]
    7174    }
    7275}
  • mycred/trunk/addons/rank-plus/includes/blocks/mycred-rank-requirements-block/block.json

    r3363925 r3478905  
    11{
    22    "apiVersion": 2,
    3     "title": "myCred Rank Requirements",
     3    "title": "Rank Requirements",
    44    "name": "mycred-rank-blocks/mycred-rank-requirements-block",
    55    "category": "mycred-rank",
    6     "icon": "dashicons dashicons-mycred-main",
     6    "icon": "clipboard",
    77    "editorScript": "file:./block.js",
    88    "attributes": {
     
    6161        "multiple": false,
    6262        "reusable": false,
    63         "align": [ "wide", "full" ]
     63        "align": [
     64            "wide",
     65            "full"
     66        ]
    6467    }
    6568}
  • mycred/trunk/includes/hooks/external/mycred-hook-contact-form7.php

    r3363925 r3478905  
    11<?php
    22if ( ! defined( 'myCRED_VERSION' ) ) exit;
    3 
    43/**
    54 * Register Hook
     
    98add_filter( 'mycred_setup_hooks', 'mycred_register_contact_form_seven_hook', 50 );
    109function mycred_register_contact_form_seven_hook( $installed ) {
    11 
    1210    if ( ! function_exists( 'wpcf7' ) ) return $installed;
    13 
    1411    $installed['contact_form7'] = array(
    1512        'title'         => __( 'Contact Form 7 Form Submissions', 'mycred' ),
     
    1815        'callback'      => array( 'myCRED_Contact_Form7' )
    1916    );
    20 
    2117    return $installed;
    22 
    2318}
    24 
    2519/**
    2620 * Contact Form 7 Hook
     
    3024add_action( 'mycred_load_hooks', 'mycred_load_contact_form_seven_hook', 50 );
    3125function mycred_load_contact_form_seven_hook() {
    32 
    3326    // If the hook has been replaced or if plugin is not installed, exit now
    3427    if ( class_exists( 'myCRED_Contact_Form7' ) || ! function_exists( 'wpcf7' ) ) return;
    35 
    3628    class myCRED_Contact_Form7 extends myCRED_Hook {
    37 
    3829        public $user_id = 0;
    39 
    4030        /**
    4131         * Construct
    4232         */
    4333        public function __construct( $hook_prefs, $type = MYCRED_DEFAULT_TYPE_KEY ) {
    44 
    4534            parent::__construct( array(
    4635                'id'       => 'contact_form7',
    4736                'defaults' => array()
    4837            ), $hook_prefs, $type );
    49 
    50         }
    51 
     38        }
    5239        /**
    5340         * Run
     
    5643         */
    5744        public function run() {
    58 
    5945            if ( is_user_logged_in() ) {
    60 
    6146                $this->user_id = get_current_user_id();
    62                
    6347                add_action( 'wpcf7_submit', array( $this, 'form_submission' ), 10, 2 );
    64                
    65             }
    66 
     48            }
    6749        }
    68 
    6950        /**
    7051         * Get Forms
     
    7455         */
    7556        public function get_forms() {
    76 
    7757            global $wpdb;
    78 
    7958            $restuls     = array();
    8059            $posts_table = mycred_get_db_column( 'posts' );
     
    8463                WHERE post_type = %s
    8564                ORDER BY ID ASC;", 'wpcf7_contact_form' ) );
    86 
    8765            if ( $forms ) {
    8866                foreach ( $forms as $form )
    8967                    $restuls[ $form->ID ] = $form->post_title;
    9068            }
    91 
    9269            return $restuls;
    93 
    94         }
    95 
     70        }
    9671        /**
    9772         * Successful Form Submission
     
    10075         */
    10176        public function form_submission( $form, $result ) {
    102 
    10377            // Login is required
    10478            if ( empty( $this->user_id ) ) return;
    105 
    10679            $form_id = ( version_compare( WPCF7_VERSION, '4.8', '<' ) ) ? $form->id : $form->id();
    107 
    10880            if ( ! isset( $this->prefs[ $form_id ] ) || ! $this->prefs[ $form_id ]['creds'] != 0 ) return;
    109 
    11081            // Check for exclusions
    11182            if ( $this->core->exclude_user( $this->user_id ) ) return;
    112 
    11383            // 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;
    11685            $this->core->add_creds(
    11786                'contact_form_submission',
     
    12392                $this->mycred_type
    12493            );
    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        }
    128161        /**
    129162         * Preferences for Contact Form 7 Hook
     
    132165         */
    133166        public function preferences() {
    134 
    135167            $prefs = $this->prefs;
    136168            if ( $prefs === false ) $prefs = array();
    137 
    138169            $forms = $this->get_forms();
    139 
    140170            // No forms found
    141171            if ( empty( $forms ) ) {
     
    143173                return;
    144174            }
    145 
    146175            // Loop though prefs to make sure we always have a default settings (happens when a new form has been created)
    147176            foreach ( $forms as $form_id => $form_title ) {
    148 
    149177                if ( ! array_key_exists( $form_id, $prefs ) ) {
    150178                    $prefs[ $form_id ] = array(
     
    154182                    );
    155183                }
    156                
    157184                if ( ! isset( $prefs[ $form_id ]['limit'] ) )
    158185                    $prefs[ $form_id ]['limit'] = '0/x';
    159 
    160             }
    161 
     186            }
    162187            // Set pref if empty
    163188            if ( empty( $prefs ) ) $this->prefs = $prefs;
    164 
    165189            // Loop for settings
    166190            foreach ( $forms as $form_id => $form_title ) {
    167 
    168191?>
    169192<div class="hook-instance">
     
    217240</div>
    218241<?php
    219 
    220             }
    221 
    222         }
    223        
     242            }
     243        }
    224244        /**
    225245         * Sanitise Preferences
     
    228248         */
    229249        public function sanitise_preferences( $data ) {
    230 
    231250            $forms = $this->get_forms();
    232251            foreach ( $forms as $form_id => $form_title ) {
    233 
    234252                if ( isset( $data[ $form_id ]['limit'] ) && isset( $data[ $form_id ]['limit_by'] ) ) {
    235253                    $limit = sanitize_text_field( $data[ $form_id ]['limit'] );
     
    238256                    unset( $data[ $form_id ]['limit_by'] );
    239257                }
    240 
    241             }
    242 
     258            }
    243259            return $data;
    244 
    245         }
    246 
     260        }
    247261    }
    248 
    249262}
  • mycred/trunk/includes/mycred-blocks/blocks/mycred-leaderboard-position/block.json

    r3363925 r3478905  
    33  "apiVersion": 2,
    44  "name": "mycred-gb-blocks/mycred-leaderboard-position",
    5   "title": "MyCred Leaderboard Position",
    6   "category": "widgets",
    7   "icon": "trophy",
     5  "title": "Leaderboard Position",
     6  "category": "mycred",
     7  "icon": "awards",
    88  "description": "Displays a user's position in the MyCred leaderboard.",
    99  "attributes": {
  • mycred/trunk/mycred.php

    r3476298 r3478905  
    44 * Plugin URI: https://mycred.me
    55 * Description: An adaptive points management system for WordPress powered websites.
    6  * Version: 3.0.1
     6 * Version: 3.0.2
    77 * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
    88 * Author: myCred
     
    2121
    2222        // Plugin Version
    23         public $version             = '3.0.1';
     23        public $version             = '3.0.2';
    2424
    2525        // Instnace
  • mycred/trunk/readme.txt

    r3477941 r3478905  
    44Requires at least: 4.8
    55Tested up to: 6.9
    6 Stable tag: 3.0.1
     6Stable tag: 3.0.2
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    3737
    3838**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 ==
     41The 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
     50The dashboard simplifies the administration of loyalty points, badges, and WooCommerce rewards, making myCred a powerful rewards plugin for managing WordPress points and rewards programs.
    3951
    4052== myCred Toolkit ==
     
    282294== Upgrade Notice ==
    283295
     296= 3.0.2 =
     297Fixed Gutenberg block icons, revised block names.
     298Resolved the limit issue in Contact Form 7 submissions.
     299
    284300= 3.0.1 =
    285301Added Links and improved UI fixed in dashboard.
     
    502518
    503519== 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.
    504524
    505525= 3.0.1 =
Note: See TracChangeset for help on using the changeset viewer.