Viewing 1 replies (of 1 total)
  • A.Tariq

    (@arsalantariq)

    Hi @ghost994,

    Thank you for contacting us,

    Sorry to say, there is no shortcode available in the plugin but we can share you the code that is being used in the WooCommerce my-account page.

    public function viewLicenseKeys()
        {
            $user = wp_get_current_user();
    
            if (!$user) {
                return;
            }
    
            if (array_key_exists('action', $_POST)) {
                $licenseKey = sanitize_text_field($_POST['license']);
    
                if ($_POST['action'] === 'activate' && Settings::get('lmfwc_allow_users_to_activate')) {
                    $nonce = wp_verify_nonce($_POST['_wpnonce'], 'lmfwc_myaccount_activate_license');
    
                    if ($nonce) {
                        try {
                            lmfwc_activate_license($licenseKey);
                        } catch (Exception $e) {
                        }
                    }
                }
    
                if ($_POST['action'] === 'deactivate' && Settings::get('lmfwc_allow_users_to_deactivate')) {
                    $nonce = wp_verify_nonce($_POST['_wpnonce'],'lmfwc_myaccount_deactivate_license');
    
                    if ($nonce) {
                        try {
                            lmfwc_deactivate_license($licenseKey);
                        } catch (Exception $e) {
                        }
                    }
                }
            }
    
            wp_enqueue_style('lmfwc_admin_css', LMFWC_CSS_URL . 'main.css');
    
            global $wp_query;
    
            $page = 1;
    
            if ($wp_query->query['view-license-keys']) {
                $page = intval($wp_query->query['view-license-keys']);
            }
    
            $licenseKeys = apply_filters('lmfwc_get_all_customer_license_keys', $user->ID);
    
            echo wc_get_template_html(
                'myaccount/lmfwc-view-license-keys.php',
                array(
                    'dateFormat'  => get_option('date_format'),
                    'licenseKeys' => $licenseKeys,
                    'page'        => $page
                ),
                '',
                LMFWC_TEMPLATES_DIR
            );
        }

    You have to modify some of the code.

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘License Manager’ is closed to new replies.