Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#55388 closed enhancement (fixed)

Lost Password URL filtration

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

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
5 years ago

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

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


5 years ago

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


4 years 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
4 years ago

  • Milestone Awaiting Review → 6.1

#5 @audrasjb
4 years ago

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

#6 @rafiahmedd
4 years ago

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

#7 @davidbaumwald
4 years ago

  • Owner set to davidbaumwald
  • Status new → reviewing

​SergeyBiryukov commented on ​PR #3248:


4 years 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
4 years 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
4 years 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
4 years ago

  • Resolution → fixed
  • Status reviewing → 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:


4 years 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:


4 years 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.