Make WordPress Core

Opened 21 months ago

Closed 15 months ago

Last modified 15 months ago

#55388 closed enhancement (fixed)

Lost Password URL filtration

Reported by: wparslan's profile wparslan Owned by: davidbaumwald's profile davidbaumwald
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Login and Registration Keywords: has-patch commit needs-dev-note has-test-report
Focuses: Cc:

Description

We have a register URL filter to change the whole tag of register link on wp-login.php

wp-login.php line 1450

<?php
$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );

/** This filter is documented in wp-includes/general-template.php */
echo apply_filters( 'register', $registration_url );

So I suggest the lost password should also get the same treatment as well like;

<?php
$lost_password_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) );

echo apply_filters( 'lost_password_url', $lost_password_url );

Change History (15)

#1 @dingo_d
21 months ago

  • Focuses accessibility coding-standards removed
  • Keywords needs-patch added

This ticket was mentioned in Slack in #core by wparslan. View the logs.


20 months ago

This ticket was mentioned in PR #2715 on WordPress/wordpress-develop by rolf-yoast.


19 months ago
#3

  • Keywords has-patch added; needs-patch removed

Replaces the lost password link and adds a filter to it.

Also props to @CasVisser, @JasmijnB & @CatoOri

Trac ticket: https://core.trac.wordpress.org/ticket/55388

#4 @SergeyBiryukov
19 months ago

  • Milestone changed from Awaiting Review to 6.1

#5 @audrasjb
19 months ago

Hi, it looks great to me, thanks for the PR!
I added a small suggestion in the PR :)

#6 @rafiahmedd
18 months ago

The PR looks good however I think Doc block is also needed before the hook.

#7 @davidbaumwald
18 months ago

  • Owner set to davidbaumwald
  • Status changed from new to reviewing

SergeyBiryukov commented on PR #3248:


15 months ago
#9

Hi there, thanks for the PR! I have some notes:

  • lost_password_url sounds pretty similar to the existing lostpassword_url filter in wp_lostpassword_url(). Since the new hook filters the whole link and not just the URL, I think lost_password_html_link would be a better name, for consistency with the login_site_html_link filter added in r50117. I would personally drop html, but would prefer consistency here 🙂
  • There is exactly the same link below the registration form, it could also use the new filter.

f2e5ead addresses these suggestions.

#10 @antonvlasenko
15 months ago

Test Report

This report validates that the indicated patch addresses the issue.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/3248

Environment

  • OS: macOS 12.6
  • Web Server: Apache 2.x
  • PHP: 8.0.29
  • WordPress: 6.1-alpha-53344-src)
  • Browser: Safari 16.0
  • Theme: Twenty Twenty-Two

Actual Results

  • ✅ I was able to change the "lost password" url on the wp-login.php page by adding a callback function for the lost_password_html_link filter. This PR works as expected.

#11 @hellofromTonya
15 months ago

  • Keywords commit needs-dev-note has-test-report added

PR 3248 LTGM 👍. Has a valid testing report. Marking for commit.

As a new filter is being added, also marking needs-dev-note for it to be included in the misc dev note.

#12 @davidbaumwald
15 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 54206:

Login and Registration: Add a new filter for the lost password link.

On the login page, the "Register" link for new users has been filterable for some time. This change adds the ability to filter the "Lost your password?" link as well.

Props wparslan, audrasjb, rafiahmedd, SergeyBiryukov, antonvlasenko, hellofromTonya.
Fixes #55388.

dream-encode commented on PR #2715:


15 months ago
#14

Thanks for the PR! This was merged into Core in https://core.trac.wordpress.org/changeset/54206.

dream-encode commented on PR #2715:


15 months ago
#15

@rolf-yoast Can you point me to the w.org profiles for the following contributors? I'd like to make sure they get core props for this ticket.

@CasVisser, @JasmijnB & @CatoOri

Note: See TracTickets for help on using tickets.