Plugin Directory

Changeset 3469771


Ignore:
Timestamp:
02/25/2026 11:20:20 PM (5 weeks ago)
Author:
globaliser
Message:

WooCommerce Related Updates.

Location:
globaliser
Files:
88 added
4 edited

Legend:

Unmodified
Added
Removed
  • globaliser/trunk/app/services/login-service.php

    r3412641 r3469771  
    3333    /**
    3434     * Block direct access to wp-login.php
     35     * Allow through: POST requests (form submissions), logged-in users,
     36     * reauth/interim-login flows, and special actions (logout, postpass, etc.)
    3537     */
    3638    public function redirect_wp_login()
     
    3840        $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    3941        $wp_login_url = site_url('wp-login.php');
    40        
     42
    4143        if ( strpos($current_url, $wp_login_url) === 0 ) {
     44            // Allow POST requests (login form submission via wp-login.php directly)
     45            if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) {
     46                return;
     47            }
     48
     49            // Allow reauth and interim-login (wp-admin redirect flow)
     50            if ( isset($_GET['reauth']) || isset($_GET['interim-login']) ) {
     51                return;
     52            }
     53
     54            // Allow special actions that need wp-login.php
     55            $allowed_actions = ['logout', 'postpass', 'rp', 'resetpass', 'lostpassword', 'retrievepassword', 'register', 'confirmaction'];
     56            $action = $_GET['action'] ?? $_POST['action'] ?? '';
     57            if ( in_array($action, $allowed_actions, true) ) {
     58                return;
     59            }
     60
    4261            wp_die('Not Found', '404 Not Found', ['response' => 404]);
    4362        }
     
    6988    /**
    7089     * Modify login form action to use custom URL
     90     * Preserves query parameters (e.g. ?action=lostpassword) from original action
    7191     */
    7292    public function modify_login_form_action()
     
    7595        <script type="text/javascript">
    7696            (function() {
     97                var customUrl = '<?php echo esc_js($this->login_url); ?>';
    7798                var forms = document.querySelectorAll('#loginform, #lostpasswordform, #registerform');
    7899                forms.forEach(function(form) {
    79100                    if (form) {
    80                         form.action = '<?php echo esc_js($this->login_url); ?>';
     101                        var originalAction = form.getAttribute('action') || '';
     102                        var qIndex = originalAction.indexOf('?');
     103                        var queryString = qIndex !== -1 ? originalAction.substring(qIndex) : '';
     104                        form.action = customUrl + queryString;
    81105                    }
    82106                });
     
    97121        if ( strpos($url, 'wp-login.php') !== false ) {
    98122            // Don't replace logout and other special action URLs
    99             $excluded_actions = ['logout', 'postpass', 'rp', 'resetpass', 'retrievepassword', 'register'];
     123            $excluded_actions = ['logout', 'postpass', 'rp', 'resetpass', 'lostpassword', 'retrievepassword', 'register', 'confirmaction'];
    100124
    101125            foreach ($excluded_actions as $action) {
     
    105129            }
    106130
    107             // Replace login URLs with custom URL
    108             return $this->login_url;
     131            // Replace login URL but preserve query string
     132            $query = parse_url($url, PHP_URL_QUERY);
     133            return $query ? $this->login_url . '?' . $query : $this->login_url;
    109134        }
    110135        return $url;
  • globaliser/trunk/constants/hooks-settings.php

    r3231149 r3469771  
    77    ['wp_update_nav_menu'],
    88    ['create_category', 'create_post_tag', 'activated_plugin', 'deactivated_plugin', 'upgrader_process_complete'],
    9     ['post_updated', 'transition_post_status', 'transition_comment_status', 'wp_insert_comment', 'wp_trash_post', 'delete_attachment', 'edited_category', 'edited_post_tag'],
     9    ['post_updated', 'transition_post_status', 'transition_comment_status', 'wp_insert_comment', 'wp_trash_post', 'delete_attachment', 'edited_category', 'edited_post_tag', 'woocommerce_update_product', 'woocommerce_new_product', 'woocommerce_update_product_variation', 'woocommerce_new_product_variation', 'woocommerce_rest_insert_product_object', 'woocommerce_rest_delete_product_object'],
    1010    ['delete_category', 'delete_post_tag'],
    1111    ['wp_save_image_editor_file', 'wp_handle_upload']
  • globaliser/trunk/globaliser.php

    r3412641 r3469771  
    44   Plugin URI: https://www.globaliser.com
    55   Description:  This plugin enables Globaliser Cloud Speed, Security, and Reliability features for WordPress sites. It is intended for Globaliser clients only.
    6    Version: 0.9.13
     6   Version: 0.9.14
    77   Author: Globaliser, Inc.
    88   Author URI: https://www.globaliser.com
  • globaliser/trunk/readme.txt

    r3412641 r3469771  
    2727
    2828== Changelog ==
     29
     30= 0.9.14 =
     31* WooCommerce related updates.
    2932
    3033= 0.9.13 =
Note: See TracChangeset for help on using the changeset viewer.