Plugin Directory

Changeset 3321473


Ignore:
Timestamp:
07/02/2025 10:56:43 PM (9 months ago)
Author:
denisaleman
Message:

2.1.0

Location:
login-links
Files:
68 added
3 edited

Legend:

Unmodified
Added
Removed
  • login-links/trunk/login-links.php

    r3264103 r3321473  
    99 * Plugin Name: Login Links
    1010 * Description: A plugin to create login links for users.
    11  * Version: 2.0.0
     11 * Version: 2.1.0
    1212 * Author: Denis Alemán
    13  * Author URI: https://wordpress.org/plugins/login-links/
     13 * Author URI: https://www.linkedin.com/in/denisalemancom/
    1414 * License: GPLv3
    1515 */
  • login-links/trunk/readme.txt

    r3264103 r3321473  
    8989It’s more convenient. People often forget their passwords or set simple ones to avoid forgetting them. With login links, forgetting a password is impossible because no password is required. The login is done via a one-time link.
    9090
     91= How do I change the URL where users are redirected after logging in via a login link? =
     92
     93You can customize the redirect URL by using the WordPress filter hook `lgnl_success_login_redirect_url`. This filter lets you modify the URL the user is sent to after a successful login with a temporary login link token.
     94
     95Example of usage:
     96
     97`
     98add_filter( 'lgnl_success_login_redirect_url', function( $redirect_url, $link, $key, $request_uri ) {
     99    return 'https://yourwebsite.com/your-custom-page/';
     100}, 10, 4 );
     101`
     102
    91103== Screenshots ==
    92104
     
    119131i18n improved.
    120132Multiple minor bugs fixed.
     133
     134= 2.1.0 =
     135Added filter 'lgnl_success_login_redirect_url' to allow customization of the redirect URL after successful login.
     136Minor code refactoring and documentation updates.
  • login-links/trunk/services/LGNLLoginLinkAuthHandler.php

    r3264103 r3321473  
    116116                    do_action( 'lgnl_link_login_user_success', $link, $user );
    117117
     118                    $redirect_url = remove_query_arg( $key, home_url( $wp->request ) );
     119
     120                    /**
     121                     * Filter the redirect URL after successful login via login link token.
     122                     *
     123                     * Allows modification of the URL where the user is redirected once authenticated
     124                     * with a valid login link token. By default, the URL is the current request URL
     125                     * with the login token query parameter removed.
     126                     *
     127                     * @param string        $redirect_url The redirect URL after successful login.
     128                     * @param LGNLLoginLink $link         The login link object used for authentication.
     129                     * @param string        $key          The query parameter key used for the login token.
     130                     * @param string        $request_uri  The current request URI (relative path).
     131                     *
     132                     * @return string The filtered redirect URL.
     133                     *
     134                     * @since 2.1.0
     135                     */
     136                    $redirect_url = apply_filters( 'lgnl_success_login_redirect_url', $redirect_url, $link, $key, $wp->request );
     137
    118138                    // phpcs:disable
    119139                    /**
     
    128148                    }
    129149
    130                     wp_safe_redirect( remove_query_arg( $key, home_url( $wp->request ) ) );
     150                    wp_safe_redirect( $redirect_url );
    131151                    exit;
    132152                }
Note: See TracChangeset for help on using the changeset viewer.