Plugin Directory

Changeset 2857095


Ignore:
Timestamp:
01/30/2023 01:14:41 PM (3 years ago)
Author:
quentn
Message:

Fix: Learndash issue when new user is registered

Location:
quentn-wp/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • quentn-wp/trunk/admin/class-quentn-wp-admin.php

    r2398796 r2857095  
    400400    public function register_custom_fields() {
    401401
     402        $tab = ( !empty( $_GET['tab'] ) ) ? sanitize_key( $_GET['tab'] ) : '';
     403
    402404        $fields = array();
    403         $fields[] = array(
    404             'id'        => 'quentn_auto_login_redirect_url',
    405             'title'     => __( 'Redirect URL', 'quentn-wp' ),
    406             'callback'  => array( $this, 'field_quentn_auto_login_redirect_url' ),
    407             'page'      => 'quentn-dashboard-auto-login',
    408             'section'   => 'quentn_auto_login_option',
    409         );
     405        if ( $tab == 'quentn_settings' ) {
     406            $fields[] = array(
     407                'id' => 'quentn_auto_login_redirect_url',
     408                'title' => __('Redirect URL', 'quentn-wp'),
     409                'callback' => array($this, 'field_quentn_auto_login_redirect_url'),
     410                'page' => 'quentn-dashboard-auto-login',
     411                'section' => 'quentn_auto_login_option',
     412            );
     413        }
    410414
    411415        //add tag fields for all wordpress roles
    412         $wp_roles =  new WP_Roles;
    413 
    414         $qntn_terms = $this->api_handler->get_terms();
    415 
    416         //loop through all available roles of WP and set three options for each, add tag (bool), remove tag (bool), quentn tags (array)
    417         //set enable/disable add user from wp to quentn
    418         foreach ( $wp_roles->get_names() as $slug => $name ) {
    419             $fields[] = array(
    420                 'id'        =>  'add_wp_user_'.$slug.'_to_quentn',
    421                 'title'     =>  translate_user_role( $name ),
    422                 'callback'  =>  array( $this, 'input_add_wp_user_to_quentn' ),
    423                 'page'      =>  'quentn-dashboard-tags',
    424                 'section'   =>  'quentn_tags_option',
    425                 'args'      =>  array( 'role' => $slug, 'role_title' => translate_user_role( $name ) )
    426             );
    427 
    428             //set quentn terms selection option
    429             $fields [] = array(
    430                 'id'        => 'quentn_tags'.$slug,
    431                 'title'     => '',
    432                 'callback'  => array( $this, 'field_wp_role_quentn_tags' ),
    433                 'page'      => 'quentn-dashboard-tags',
    434                 'section'   => 'quentn_tags_option',
    435                 'args'      => array(
    436                     'label_for' => __('Please Select Tags', 'quentn-wp'),
    437                     'role'      => $slug,
    438                     'terms'     => $qntn_terms,
    439                 )
    440             );
    441 
    442             //set enable/disable remove tags when user loses a role
    443             $fields[] = array(
    444                 'id'        => 'delete_wp_user_'.$slug.'_from_quentn',
    445                 'title'     => '',
    446                 'callback'  => array( $this, 'input_delete_wp_user_to_quentn' ),
    447                 'page'      => 'quentn-dashboard-tags',
    448                 'section'   => 'quentn_tags_option',
    449                 'args'      => array( 'role' => $slug )
    450             );
     416        if ( $tab == 'quentn_tags_selection' ) {
     417           
     418            $wp_roles = new WP_Roles;
     419
     420            $qntn_terms = $this->api_handler->get_terms();
     421
     422            //loop through all available roles of WP and set three options for each, add tag (bool), remove tag (bool), quentn tags (array)
     423            //set enable/disable add user from wp to quentn
     424            foreach ( $wp_roles->get_names() as $slug => $name ) {
     425                $fields[] = array(
     426                    'id' => 'add_wp_user_' . $slug . '_to_quentn',
     427                    'title' => translate_user_role( $name ),
     428                    'callback' => array( $this, 'input_add_wp_user_to_quentn' ),
     429                    'page' => 'quentn-dashboard-tags',
     430                    'section' => 'quentn_tags_option',
     431                    'args' => array( 'role' => $slug, 'role_title' => translate_user_role( $name ) )
     432                );
     433
     434                //set quentn terms selection option
     435                $fields [] = array(
     436                    'id' => 'quentn_tags' . $slug,
     437                    'title' => '',
     438                    'callback' => array( $this, 'field_wp_role_quentn_tags' ),
     439                    'page' => 'quentn-dashboard-tags',
     440                    'section' => 'quentn_tags_option',
     441                    'args' => array(
     442                        'label_for' => __('Please Select Tags', 'quentn-wp'),
     443                        'role' => $slug,
     444                        'terms' => $qntn_terms,
     445                    )
     446                );
     447
     448                //set enable/disable remove tags when user loses a role
     449                $fields[] = array(
     450                    'id' => 'delete_wp_user_' . $slug . '_from_quentn',
     451                    'title' => '',
     452                    'callback' => array( $this, 'input_delete_wp_user_to_quentn' ),
     453                    'page' => 'quentn-dashboard-tags',
     454                    'section' => 'quentn_tags_option',
     455                    'args' => array( 'role' => $slug )
     456                );
     457            }
    451458        }
    452459
  • quentn-wp/trunk/includes/class-quentn-wp-elementor-integration.php

    r2700751 r2857095  
    348348        $quentn_attach_contact_information = $record->get_form_settings( 'quentn_attach_contact_information' );
    349349
     350        //add http as prefix if its not set in redirect_url
     351        $parsed = parse_url( $quentn_default_redirect_url );
     352        if ( empty( $parsed['scheme'] ) ) {
     353            $quentn_default_redirect_url = 'http://' . ltrim( $quentn_default_redirect_url, '/' );
     354        }
     355
     356        //add http as prefix if its not set in confirm redirect url
     357        $parsed_confirmed_url = parse_url( $quentn_confirmed_redirect_url );
     358        if ( empty( $parsed_confirmed_url['scheme'] ) ) {
     359            $quentn_confirmed_redirect_url = 'http://' . ltrim( $quentn_confirmed_redirect_url, '/' );
     360        }
     361
    350362        if( ! empty( $quentn_terms ) ) {
    351363            $contact['terms'] = $quentn_terms;
    352364        }
     365
    353366        $contact['request_ip'] = $_SERVER["REMOTE_ADDR"]; //add ip address and terms to subscriber data
    354367        $request_data['contact'] = $contact;
  • quentn-wp/trunk/includes/class-quentn-wp-learndash.php

    r2327486 r2857095  
    1717            add_action( 'add_user_to_blog', array( $this, 'quentn_learndash_courses' ) );
    1818        } else {
    19             add_action( 'user_register', array( $this, 'quentn_learndash_courses', 100, 2 ) );
     19            add_action( 'user_register', array( $this, 'quentn_learndash_courses' ), 100 );
    2020        }
    2121
     
    2424
    2525        //update user lerandash courses
    26         add_action( 'profile_update', array( $this, 'quentn_learndash_courses' ), 100, 2 );
     26        add_action( 'profile_update', array( $this, 'quentn_learndash_courses' ), 100 );
    2727
    2828        //remove learndash courses if user role is removed
  • quentn-wp/trunk/includes/class-quentn-wp-page-restriction-meta-box.php

    r2327486 r2857095  
    295295            //if return url is not empty, then it must be valid
    296296            if( $q_redirection_type != 'restricted_url' || ! filter_var( $q_redirect_url, FILTER_VALIDATE_URL ) ) {
     297                //we are not stopping complete page to save if redirect url not valid. that's why we comment this code to avoid user confusion
    297298                //$q_redirect_url = '';
    298299            }
  • quentn-wp/trunk/includes/class-quentn-wp.php

    r2830198 r2857095  
    7575            $this->version = QUENTN_WP_VERSION;
    7676        } else {
    77             $this->version = '1.2.4';
     77            $this->version = '1.2.5';
    7878        }
    7979        $this->plugin_name = 'quentn-wp';
  • quentn-wp/trunk/quentn-wp.php

    r2830198 r2857095  
    1717 * Plugin URI:        https://docs.quentn.com/de/beta-quentn-wordpress-plugin/installieren-und-verbinden
    1818 * Description:       This plugin allows you to restrict access to specific pages, create custom access links and create dynamic page countdowns. Optionally, you can connect your Quentn account to your WordPress installation to share contacts and manage access restrictions through Quentn.
    19  * Version:           1.2.4
     19 * Version:           1.2.5
    2020 * Author:            Quentn.com GmbH
    2121 * Author URI:        https://quentn.com/
     
    3737define( "TABLE_QUENTN_RESTRICTIONS", 'qntn_restrictions' );
    3838define( "TABLE_QUENTN_USER_DATA", 'qntn_user_data' );
    39 define( 'QUENTN_WP_VERSION', '1.2.4' );
     39define( 'QUENTN_WP_VERSION', '1.2.5' );
    4040
    4141/**
  • quentn-wp/trunk/readme.txt

    r2830198 r2857095  
    44Requires at least: 4.6.0
    55Tested up to: 6.1.1
    6 Stable tag: 1.2.4
     6Stable tag: 1.2.5
    77Requires PHP: 5.6.0
    88License: GPLv2 or later
     
    6666
    6767== Changelog ==
     68= 1.2.5 =
     69* Fix: Learndash issue when new user is registered.
     70
    6871= 1.2.4 =
    6972* Test with new wordpress ( 6.1.1 ), Elementor ( 3.9.0 ) and Elemnetor PRO ( 3.9.0 ) versions.
     
    150153== Upgrade Notice ==
    151154
     155= 1.2.5 =
     156Thanks for using Quentn Plugin! Please update the plugin to fix Learndash error when new user is registered.
     157
    152158= 1.2.4 =
    153159Thanks for using Quentn Plugin! Please update the plugin. It is now tested with new wordpress ( 6.1.1 ), Elementor ( 3.9.0 ) and Elemnetor PRO ( 3.9.0 ) versions.
Note: See TracChangeset for help on using the changeset viewer.