Plugin Directory

Changeset 3426515


Ignore:
Timestamp:
12/23/2025 09:50:18 PM (3 months ago)
Author:
apos37
Message:

1.1.3

  • Update: Added option to redirect wp-login.php page in plugin settings under common forms
Location:
gf-tools
Files:
70 added
5 edited

Legend:

Unmodified
Added
Removed
  • gf-tools/trunk/gf-tools.php

    r3386074 r3426515  
    44 * Plugin URI:          https://pluginrx.com/plugin/gf-tools/
    55 * Description:         Unlock advanced tools to supercharge your Gravity Forms experience with enhanced features and streamlined management.
    6  * Version:             1.1.2
     6 * Version:             1.1.3
    77 * Requires at least:   5.9
    8  * Tested up to:        6.8
     8 * Tested up to:        6.9
    99 * Requires PHP:        7.4
    1010 * Author:              PluginRx
  • gf-tools/trunk/includes/class-gf-tools.php

    r3386074 r3426515  
    547547                    [
    548548                        'type'    => 'form_page_pair',
     549                        'name'    => 'password_reset_mapping',
     550                        'label'   => esc_html__( 'Password Reset Form & Page (For Logged-Out Users)', 'gf-tools' ) . ' — <a href="' . GFADVTOOLS_FORMS_URL . 'download.php?file=password-reset-form.json&_wpnonce=' . $download_nonce . '">' . esc_html__( 'Download Example Form', 'gf-tools' ) . '</a>',
     551                        'tooltip' => esc_html__( 'This setting will lock the form and page to prevent accidental deletion. This form should support both requesting a reset and setting a new password, based on the current action (see example form).', 'gf-tools' ),
     552                        'args'    => [
     553                            'form' => [
     554                                'name'    => 'password_reset_form',
     555                                'class'   => 'small',
     556                                'choices' => $form_choices,
     557                            ],
     558                            'page' => [
     559                                'name'    => 'password_reset_page',
     560                                'class'   => 'small',
     561                                'choices' => $page_choices,
     562                            ],
     563                        ],
     564                    ],
     565                    [
     566                        'type'    => 'form_page_pair',
    549567                        'name'    => 'login_mapping',
    550568                        'label'   => esc_html__( 'Login Form & Page', 'gf-tools' ) . ' — <a href="' . GFADVTOOLS_FORMS_URL . 'download.php?file=login-form.json&_wpnonce=' . $download_nonce . '">' . esc_html__( 'Download Example Form', 'gf-tools' ) . '</a>',
     
    564582                    ],
    565583                    [
    566                         'type'    => 'form_page_pair',
    567                         'name'    => 'password_reset_mapping',
    568                         'label'   => esc_html__( 'Password Reset Form & Page (For Logged-Out Users)', 'gf-tools' ) . ' — <a href="' . GFADVTOOLS_FORMS_URL . 'download.php?file=password-reset-form.json&_wpnonce=' . $download_nonce . '">' . esc_html__( 'Download Example Form', 'gf-tools' ) . '</a>',
    569                         'tooltip' => esc_html__( 'This setting will lock the form and page to prevent accidental deletion. This form should support both requesting a reset and setting a new password, based on the current action (see example form).', 'gf-tools' ),
    570                         'args'    => [
    571                             'form' => [
    572                                 'name'    => 'password_reset_form',
    573                                 'class'   => 'small',
    574                                 'choices' => $form_choices,
    575                             ],
    576                             'page' => [
    577                                 'name'    => 'password_reset_page',
    578                                 'class'   => 'small',
    579                                 'choices' => $page_choices,
     584                        'type'    => 'checkbox',
     585                        'name'    => 'core_login_redirect_group',
     586                        'label'   => esc_html__( 'Redirect the Core WordPress Login Page', 'gf-tools' ),
     587                        'tooltip' => esc_html__( 'This setting will redirect users away from the default WordPress login page to your custom login page if selected above.', 'gf-tools' ),
     588                        'choices' => [
     589                            [
     590                                'label' => esc_html__( 'Yes', 'gf-tools' ),
     591                                'name'  => 'core_login_redirect',
    580592                            ],
    581593                        ],
  • gf-tools/trunk/includes/class-login.php

    r3386074 r3426515  
    297297        // Priority 1: Get raw URL from query or entry
    298298        $raw_url = '';
    299         if ( isset( $_GET['redirect_to'] ) ) {
    300             $raw_url = sanitize_url( wp_unslash( $_GET['redirect_to'] ) );
     299        if ( isset( $_GET[ 'redirect_to' ] ) ) {
     300            $raw_url = sanitize_url( wp_unslash( $_GET[ 'redirect_to' ] ) );
    301301        } elseif ( $this->redirect_to_field_id ) {
    302302            $raw_url = sanitize_url( rgar( $entry, $this->redirect_to_field_id ) );
     
    305305        if ( !empty( $raw_url ) ) {
    306306            $redirect_to = urldecode( $raw_url );
    307         }
    308 
    309         // Get user for potential fallback and filtering
    310         $user_email = sanitize_email( rgar( $entry, $this->email_field_id ) );
    311         $user = $user_email ? get_user_by( 'email', $user_email ) : null;
    312 
    313         if ( $user ) {
    314             $access_admin = user_can( $user, 'read' ) && user_can( $user, 'access_admin' );
    315 
    316             // Priority 2: fallback only if redirect still not set
    317             if ( !$redirect_to ) {
     307
     308        } else {
     309            // Get user for potential fallback and filtering
     310            $user_email = sanitize_email( rgar( $entry, $this->email_field_id ) );
     311            $user = $user_email ? get_user_by( 'email', $user_email ) : null;
     312
     313            if ( $user ) {
     314                $access_admin = user_can( $user, 'manage_options' );
     315
     316                // Fallback
    318317                $redirect_to = $access_admin ? admin_url() : home_url();
    319             }
    320 
    321             // Apply final filter
    322             $redirect_to = apply_filters( 'gfat_user_landing_page', $redirect_to, $user, $access_admin );
    323         }
     318
     319                // Apply final filter
     320                $redirect_to = apply_filters( 'gfat_user_landing_page', $redirect_to, $user, $access_admin );
     321            }
     322        }       
    324323
    325324        // If still no redirect, fallback to login page
  • gf-tools/trunk/includes/class-wp-login.php

    r3328469 r3426515  
    2525     */
    2626    public $page_ids = [];
     27
     28
     29    /**
     30     * Are we redirecting the core login page?
     31     *
     32     * @var boolean
     33     */
     34    private $is_redirecting_core_login_page = false;
    2735
    2836
     
    3846            $this->page_ids[ $option ] = isset( $plugin_settings[ $option . '_page' ] ) ? absint( $plugin_settings[ $option . '_page' ] ) : 0;
    3947        }
     48
     49        // Are we redirecting the core login page?
     50        $this->is_redirecting_core_login_page = isset( $plugin_settings[ 'core_login_redirect' ] ) ? (bool) $plugin_settings[ 'core_login_redirect' ] : false;
    4051
    4152        // Registration
     
    214225
    215226        // Only redirect GET requests to custom login page for all other cases
    216         if ( $this->is_enabled( 'login' ) && $_SERVER[ 'REQUEST_METHOD' ] === 'GET' ) {
     227        if ( $this->is_redirecting_core_login_page && $this->is_enabled( 'login' ) && $_SERVER[ 'REQUEST_METHOD' ] === 'GET' ) {
    217228            $url = $this->page_url( 'login' );
    218229            if ( $url ) {
  • gf-tools/trunk/readme.txt

    r3386074 r3426515  
    44Requires at least: 5.9
    55Requires PHP: 7.4
    6 Tested up to: 6.8
    7 Stable tag: 1.1.2
     6Tested up to: 6.9
     7Stable tag: 1.1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    104104
    105105== Changelog ==
     106= 1.1.3 =
     107* Update: Added option to redirect wp-login.php page in plugin settings under common forms
     108
    106109= 1.1.2 =
    107110* Update: Added validation option to fields in the form editor
Note: See TracChangeset for help on using the changeset viewer.