Jump to content

Featured Replies

comment_72649

@DoomApps

first: 
install the theme without installing / activating the plugins 

than:
Replace wpcasterpro/inc/tgm-plugin-activation/inc/welcome-page.php
 

<?php
/**
 * @package    TGM-Plugin-Activation
 * @subpackage qtt
 **/

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}

/**
 * Disable activation link generation.
 *
 * @return string|null
 */
function qtt_disable_activation_link()
{
    if (!isset($_GET)) {
        return null;
    }

    $qtt_iid = qtt_iid();

    if (isset($_GET['qttm-tgm-remove-act-nonce']) && isset($_GET['qttm-tgm-remove-act'])) {
        $nonce = $_GET['qttm-tgm-remove-act-nonce'];

        if (wp_verify_nonce($nonce, 'remove-act-nonce')) {
            if (isset($_GET['qttm-tgm-remove-act-conf']) && $_GET['qttm-tgm-remove-act-conf'] == '2') {
                delete_option('qtt_' . 'ac' . 'k_' . $qtt_iid);
            } else {
                esc_html_e('Invalid request', 'wpcasterpro');
            }
        } else {
            echo 'Invalid';
        }
    } else {
        $urladmin = admin_url('themes.php?page=qttm-welcome');
        $url = add_query_arg(
            array(
                'qttm-tgm-remove-act' => '1',
                'qttm-tgm-remove-act-conf' => '2',
                'qttm-tgm-remove-act-nonce' => wp_create_nonce('remove-act-nonce')
            ),
            $urladmin
        );

        ob_start();
        ?>
        <p class="qttm-welcome__center"><?php esc_html_e("Please confirm to remove activation:", 'wpcasterpro') ?><a
                    href="<?php echo esc_url($url); ?>"><?php esc_html_e('click here', 'wpcasterpro'); ?></a></p>
        <?php
        return ob_get_clean();
    }

    return null;
}

/**
 * qtt Welcome Page Content.
 */
if (!function_exists('qtt_welcome_page_content')) {
    function qtt_welcome_page_content()
    {
        if (!is_admin()) {
            return;
        }

        $qtt_iid = qtt_iid(true);
        $msg_rem = qtt_disable_activation_link();

        $current_theme = wp_get_theme();
        if (is_child_theme()) {
            $current_theme = $current_theme->parent();
        }

        $title = sprintf(
            esc_html__('Thank you for choosing %1$s %2$s', 'wpcasterpro'),
            $current_theme->name,
            $current_theme->version
        );

        ?>

        <div class="qttm-welcome">
            <div class="qttm-welcome__container">
                <div class="qttm-welcome__wrapper">
                    <div class="qttm-welcome__logo">
                        <img src="<?php echo esc_url(get_theme_file_uri('/inc/tgm-plugin-activation/img/logo.png')); ?>"
                             alt="<?php esc_attr_e('Logo', 'wpcasterpro'); ?>">
                    </div>
                    <h1 class="qttm-welcome__title"><?php echo esc_html($title); ?></h1>

                    <?php
                    if (isset($msg_rem)) {
                        ?>
                        <p class="qttm-welcome__center"><?php echo wp_kses_post($msg_rem); ?></p><?php
                    }
                    ?>

                    <form class="qttm-welcome__form" action="<?php echo esc_url(admin_url('themes.php?page=qttm-welcome')); ?>" method="post">
                        <label class="qttm-welcome__form-label" for="qttpcode"><?php esc_html_e('Please enter your purchase code:', 'wpcasterpro'); ?></label>
                        <input class="qttm-welcome__form-input" type="text" id="qttpcode" name="qttpcode" value="" placeholder="<?php esc_attr_e('Enter your purchase code here', 'wpcasterpro'); ?>" required>
                        <?php wp_nonce_field('action_verify', 'nonce_verify_pc'); ?>
                        <button class="qttm-welcome__form-button" type="submit"><?php esc_html_e('Verify', 'wpcasterpro'); ?></button>
                    </form>
                </div>
            </div>
        </div>
        <?php
    }
}

Replace wpcasterpro/inc/tgm-plugin-activation/inc/message.php

<?php
/**
 * @package    TGM-Plugin-Activation
 * @subpackage qtt
 **/

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}

/**
 * Display activation message and other details.
 *
 * @return string
 */
function qtt_message_tgm()
{
    ob_start();

    $item_remote = qtt_iid();
    ?>

    <?php

    /**
     * Display the product ID if set in remote
     */
    if ('pending' !== $item_remote) {
        ?>
        <p><?php esc_html_e('Item ID: ', 'wpcasterpro');
            echo esc_html($item_remote); ?></p>
        <?php
    }

    /**
     * Display a force refresh link. Can be used every 30 seconds.
     * Triggers product ID update as well
     */
    if (get_transient('qtt_tgm_refreshed')) {
        ?>
        <p><?php esc_html_e("The plugins list is up to date.", 'wpcasterpro'); ?></p>
        <?php
    } else {
        $urladmin = admin_url('themes.php?page=' . qtt_tgmpa_page());
        $url = add_query_arg(
            array(
                'tgm-refresh-iid' => '1',
                'tgmpa-force' => '1',
                'tgmpa-force-nonce' => wp_create_nonce('tgmpa-force-nonce')
            ),
            $urladmin
        );
        ?>
        <p><?php esc_html_e("If you just updated your theme, please ", 'wpcasterpro'); ?><a
                    href="<?php echo esc_url($url); ?>"><?php esc_html_e('Try to refresh clicking here', 'wpcasterpro'); ?></a></p>
        <?php
    }

    return ob_get_clean();
}

Replace wpcasterpro/inc/tgm-plugin-activation/inc/error.php :

<?php
/**
 * @package    TGM-Plugin-Activation
 * @subpackage qtt
 **/

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}

/**
 * Error notices
 */

// Success notice for plugins list update
function qtt_plugins_refresh__success() {
    ?>
    <div class="notice notice-success is-dismissible">
        <h4><?php esc_html_e('The plugins list was successfully updated', 'wpcasterpro'); ?></h4>
    </div>
    <?php
}

// Warning notice for refreshing too fast
function qtt_tgm_remote_refreshed__message() {
    ?>
    <div class="notice notice-warning is-dismissible">
        <h4><?php esc_html_e('Refreshing the page too often. Please wait a a few seconds to avoid overloads.', 'wpcasterpro'); ?></h4>
    </div>
    <?php
}

// Error notice for empty list of required plugins
function qtt_plugins_notice__refresh() {
    $urladmin = admin_url('themes.php?page=' . qtt_tgmpa_page());
    $url = add_query_arg(
        array(
            'tgmpa-force' => '1',
            'tgmpa-force-nonce2' => wp_create_nonce('tgmpa-force-nonce2'),
            'tgmpa-force-nonce' => wp_create_nonce('tgmpa-force-nonce')
        ),
        $urladmin
    );
    ?>
    <div class="notice notice-error is-dismissible">
        <h3><?php esc_html_e('qtt Notice', 'wpcasterpro'); ?></h3>
        <p><?php esc_html_e('The stored list of required plugins is empty, do you want to try again?', 'wpcasterpro'); ?></p>
        <p><?php esc_html_e('If you need support please contact us via email providing the Envato purchase code.', 'wpcasterpro'); ?> <?php echo qtt_support_message(); ?></p>
        <p><?php esc_html_e('If you already tried this, please wait some time, the server can be under maintenance.', 'wpcasterpro'); ?></p>
        <p><a href="<?php echo esc_url($url); ?>"><?php esc_html_e('Try to refresh clicking here', 'wpcasterpro'); ?></a></p>
    </div>
    <?php
}

// Activation notice
function qtt_plugins_notice__activationnag() {
    $scr = get_current_screen();
    if ($scr->id !== 'appearance_page_' . qtt_tgmpa_page() && $scr->id !== 'appearance_page_qttm-welcome') {

        $current_theme = wp_get_theme();
        if (is_child_theme()) {
            $current_theme = $current_theme->parent();
        }
        $title = sprintf(
            esc_html__('Thank you for choosing %1$s', 'wpcasterpro'),
            $current_theme->name
        );

        ?>
        <div class="notice notice-success is-dismissible qttm-welcome__notice">
            <img src="<?php echo esc_url(get_theme_file_uri('/inc/tgm-plugin-activation/img/logo.png')); ?>"
                 alt="<?php esc_attr_e('Logo', 'wpcasterpro'); ?>">
            <h3><?php echo wp_strip_all_tags($title); ?></h3>
            <p><a href="<?php echo admin_url() . 'themes.php?page=qttm-welcome'; ?>"><?php esc_html_e('Please activate your license', 'wpcasterpro'); ?></a> <?php esc_html_e("to install the premium plugins and demo contents", 'wpcasterpro') ?></p>
        </div>
        <?php
    }
}
add_action('admin_notices', 'qtt_plugins_notice__activationnag');


/**
 * Add a one-time-only admin notice to check the documentation and support
 */
if (!function_exists('qtt_manual_notice')) {
    add_action('admin_notices', 'qtt_manual_link_notice');
    function qtt_manual_link_notice()
    {
        $dismissed = get_option('qtt_manual_dismissed', false);

        if (!$dismissed && isset($_POST)) {
            if (array_key_exists('qtt_dismiss_docu_link', $_POST) && array_key_exists('qtt_manual_dismiss', $_POST)) {
                if ($_POST['qtt_dismiss_docu_link'] == 'yes') {
                    if (!wp_verify_nonce($_POST['qtt_manual_dismiss'], 'qtt_action_dismiss_notice')) {
                        wp_die('Verification error. The theme security system triggered a block. Please go back to your admin home.');
                    } else {
                        add_option('qtt_manual_dismissed', '1', '', 'yes');
                        $dismissed = true;
                    }
                }
            }
        }

        if (!$dismissed) {
            ?>
            <div class="notice notice-success qttm-welcome__notice">
                <img src="<?php echo esc_url(get_theme_file_uri('/inc/tgm-plugin-activation/img/docs.png')); ?>"
                     alt="<?php esc_attr_e('Logo', 'wpcasterpro'); ?>">
                <form class="qttm-notice__form" method="post" action="<?php echo admin_url(); ?>">
                    <input type="hidden" name="qtt_dismiss_docu_link" id="qtt_dismiss_docu_link" value="yes">
                    <?php wp_nonce_field('qtt_action_dismiss_notice', 'qtt_manual_dismiss'); ?>
                    <h3><?php esc_html_e('Theme documentation and support', 'wpcasterpro'); ?></h3>
                    <p><?php esc_html_e("New to this theme? Please check our", 'wpcasterpro') ?> <a
                                href="<?php echo qtt_connector_documentation_url(); ?>"
                                target="_blank"><?php esc_html_e('documentation and support', 'wpcasterpro'); ?></a>. </p>
                    <input type="submit" value="<?php echo esc_attr(_e('Dismiss notice for good', 'wpcasterpro')); ?>"
                           class="qttm-btn button button-primary">
                </form>
            </div>
            <?php
        }
    }
}


// Generic error notices

// Error notice for generic plugin search error
function qtt_plugins_notice__error() {
    ?>
    <div class="notice notice-error is-dismissible">
        <h3><?php esc_html_e('qtt Notice', 'wpcasterpro'); ?></h3>
        <p><?php esc_html_e('We are experiencing an error while searching for the required plugins. Please make sure your server or firewall are not blocking outgoing requests to our server.', 'wpcasterpro'); ?></p>
        <p><?php esc_html_e('If you need support please contact us via email, providing the Envato purchase code.', 'wpcasterpro'); ?> <?php echo qtt_support_message(); ?></p>
        <p><a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-"
              target="_blank"><?php esc_html_e('Where is my purchase code?', 'wpcasterpro'); ?></a></p>
    </div>
    <?php
}

// Warning notice for empty list of plugins
function qtt_plugins_notice__nolist() {
    ?>
    <div class="notice notice-warning is-dismissible">
        <h3><?php esc_html_e('qtt Notice', 'wpcasterpro'); ?></h3>
        <p><?php esc_html_e('It seems the list of plugins is actually empty. You can try searching again in a couple of minutes.', 'wpcasterpro'); ?></p>
        <p><?php esc_html_e('If you need support please contact us via email, providing the Envato purchase code.', 'wpcasterpro'); ?> <?php echo qtt_support_message(); ?></p>
        <p><a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-"
              target="_blank"><?php esc_html_e('Where is my purchase code?', 'wpcasterpro'); ?></a></p>
    </div>
    <?php
}

// Error notice for database update error
function qtt_plugins_update_error() {
    ?>
    <div class="notice notice-error is-dismissible">
        <h3><?php esc_html_e('qtt TGM Notice', 'wpcasterpro'); ?></h3>
        <p><?php esc_html_e('There is some issue while saving data in your database, please check database permissions', 'wpcasterpro'); ?></p>
        <p><?php esc_html_e('If you need support please check the Support section of your manual.', 'wpcasterpro'); ?></p>
        <p><a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-"
              target="_blank"><?php esc_html_e('Where is my purchase code?', 'wpcasterpro'); ?></a></p>
    </div>
    <?php
}

// Error notice for connection error
function qtt_plugins_conn__error() {
    ?>
    <div class="notice notice-error is-dismissible">
        <h3><?php esc_html_e('qtt Notice', 'wpcasterpro'); ?></h3>
        <p><?php esc_html_e('Your server is being blocked while searching for plugins. Please make sure your server or firewall are not blocking outgoing requests to our server.', 'wpcasterpro'); ?></p>
        <p><?php esc_html_e('If you need support please contact us via email at, providing the Envato purchase code.', 'wpcasterpro'); ?> <?php echo qtt_support_message(); ?></p>
        <p><a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-"
              target="_blank"><?php esc_html_e('Where is my purchase code?', 'wpcasterpro'); ?></a></p>
    </div>
    <?php
}

// Error notice for server connection issue
function qtt_plugins_conn__error_server() {
    ?>
    <div class="notice notice-error is-dismissible">
        <h3><?php esc_html_e('qtt TGM Notice', 'wpcasterpro'); ?></h3>
        <p><?php esc_html_e('Sorry, our server is temporarily unable to retrieve the plugins list. You may try again in a few minutes or contact our helpdesk at, providing the Envato purchase code.', 'wpcasterpro'); ?> <?php echo qtt_support_message(); ?></p>
        <p><a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-"
              target="_blank"><?php esc_html_e('Where is my purchase code?', 'wpcasterpro'); ?></a></p>
    </div>
    <?php
}

// Error notice for missing product ID
function qtt_plugins_id_miss() {
    ?>
    <div class="notice notice-error is-dismissible">
        <h3><?php esc_html_e('qtt TGM Notice', 'wpcasterpro'); ?></h3>
        <p><?php esc_html_e('Your server is not able to parse the product ID. Your firewall or server settings are blocking the request.', 'wpcasterpro'); ?></p>
        <p><?php esc_html_e('If you need support please contact us via email, providing the Envato purchase code.', 'wpcasterpro'); ?> <?php echo qtt_support_message(); ?></p>
        <p><a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-"
              target="_blank"><?php esc_html_e('Where is my purchase code?', 'wpcasterpro'); ?></a></p>
    </div>
    <?php
}

// Error notice for server issue with product ID
function qtt_plugins_id_miss_server() {
    ?>
    <div class="notice notice-error is-dismissible">
        <h3><?php esc_html_e('qtt TGM Notice', 'wpcasterpro'); ?></h3>
        <p><?php esc_html_e('Sorry, our server is not able to handle your request. You may try again in a few minutes or contact our helpdesk, providing the Envato purchase code.', 'wpcasterpro'); ?> <?php echo qtt_support_message(); ?></p>
        <p><a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-"
              target="_blank"><?php esc_html_e('Where is my purchase code?', 'wpcasterpro'); ?></a></p>
    </div>
    <?php
}

// Error notice for server responding incorrectly
function qtt_plugins_conn__error_sever() {
    ?>
    <div class="notice notice-error is-dismissible">
        <h3><?php esc_html_e('Activation required', 'wpcasterpro'); ?></h3>
        <p><?php esc_html_e('Premium plugins require a valid purchase code activation.', 'wpcasterpro'); ?> <?php echo qtt_support_message(); ?></p>
    </div>
    <?php
}

// Function to check if a purchase code is stored and valid
function qtt_tgm_pcv($req = false) {
    if (!is_admin()) {
        return;
    }
    if (trim($req) == 'pending') {
        return true;
    }
    $rid = trim($req);
    $rok = get_option('qtt_ack_' . trim($rid));
    if ($rok) {
        return true;
    }
    return false;
}

// Function to check if the domain matches the stored purchase code
function is_valid_domain($rid) {
    $rok = get_option('qtt_ack_' . trim($rid));
    if (json_decode(base64_decode(base64_decode($rok)))->url == str_replace(array('http://', 'https://'), '', get_site_url())) {
        return false;
    }
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.


Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Latest Updated Files