WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 months ago

Last modified 3 months ago

#22139 closed enhancement (fixed)

Hooks for wp-login customization

Reported by: borkweb Owned by: SergeyBiryukov
Milestone: 4.6 Priority: normal
Severity: normal Version: 3.4
Component: Login and Registration Keywords: has-patch
Focuses: Cc:

Description

I have an application that leverages wp-login.php as the login page (of course), however, the HTML on the wp-login.php doesn't have a way for my application to insert its navigational elements, branding, etc.

I propose the addition of two new action hooks: login_before_container and login_after_container which would come before and after the login div, respectively.

Attachments (5)

wp-login.diff (665 bytes) - added by borkweb 4 years ago.
Addition of two new hooks
22139.diff (629 bytes) - added by iamfriendly 10 months ago.
Added an action before the login container on the wp-login screen
22139.2.diff (912 bytes) - added by voldemortensen 3 months ago.
22139.3.diff (588 bytes) - added by voldemortensen 3 months ago.
22139.patch (808 bytes) - added by sebastian.pisula 3 months ago.

Download all attachments as: .zip

Change History (29)

@borkweb
4 years ago

Addition of two new hooks

#1 @DrewAPicture
4 years ago

Related (sort of?): #21506 - Standard Theme Hooks

#2 @borkweb
4 years ago

The concept behind #21506 is similar to this, I suppose, in that it proposes some standardized hooks in twenty ten that can be leveraged to do what I want to do with wp-login.php...to a degree. Because this diff addresses wp-login.php, I'd say it is a different beast.

The hook names that I used may definitely be worth debating, though. The attached diff was my (lame?) attempt at picking a suitable name :)

#4 @SergeyBiryukov
4 years ago

  • Version changed from trunk to 3.4

#5 follow-up: @misterbisson
4 years ago

+1 for this. The diff is just two do_action calls that make it possible to significantly redesign the login page. Combined with some .htaccess rules you can do this: https://accounts.gigaom.com/subscription/sign-in/

Last edited 2 years ago by misterbisson (previous) (diff)

#6 @jeremyfelt
2 years ago

  • Component changed from Administration to Login and Registration

#7 @ArdathkSheyna
2 years ago

+2, but add additional filters for changing the login form header text (or even allow for eliminating the link entirely, leaving just the H1 tag), also for adding classes or other attributes to the form tags. For the login form itself, could even bring in the filters used in the wp_login_form() function.

#8 follow-up: @stgoos
2 years ago

+2 as I'm currently working on tweaking the wp-login page layout heavily for a website for a small group of users only (family and friends) so the front page will be the login page.

For me the bare minimum would be the "login_before_container" hook but the "login_after_container" hook just in front of the "login_footer" hook also makes sense to me for better customization of the wp-login page.

Please include this ticket in the next WP release.

Btw [offtopic] - isn't it weird that the version field in the change properties ranges from 0.71 up to only 3.4 while the WP version is already at 3.9.1?!

Last edited 2 years ago by stgoos (previous) (diff)

#9 in reply to: ↑ 5 @stgoos
2 years ago

Replying to misterbisson:

+1 for this. The diff is just two do_action calls that make it possible to significantly redesign the login page. Combined with some .htaccess rules you can do this: https://accounts.gigaom.com/subscription/sign-in/

What are .htaccess rules you have used for getting such a url for the wp-login.php page?

#10 in reply to: ↑ 8 ; follow-up: @helen
2 years ago

Replying to stgoos:

Btw [offtopic] - isn't it weird that the version field in the change properties ranges from 0.71 up to only 3.4 while the WP version is already at 3.9.1?!

It's not weird; the version field is to keep track of when enhancements were requested. When it is already set, you cannot change it to something newer - it can be set to something older in the case of bugs, which may have been introduced earlier than the original reported version.

#11 in reply to: ↑ 10 @stgoos
2 years ago

Replying to helen:

Replying to stgoos:

Btw [offtopic] - isn't it weird that the version field in the change properties ranges from 0.71 up to only 3.4 while the WP version is already at 3.9.1?!

It's not weird; the version field is to keep track of when enhancements were requested. When it is already set, you cannot change it to something newer - it can be set to something older in the case of bugs, which may have been introduced earlier than the original reported version.

Thanks for the explaination Helen - that actually makes a lot of sense :)

#12 @stgoos
12 months ago

Bump.

Since we're almost at WordPress 4.3 now, it would be nice to see this feature request being picked up for let say the 4.4 release ;)

@iamfriendly
10 months ago

Added an action before the login container on the wp-login screen

#13 follow-up: @iamfriendly
10 months ago

Refreshed the patch and added docs. Only needs the before container action as the login_footer is fine to use for after the container.

#14 in reply to: ↑ 13 @stgoos
8 months ago

Replying to iamfriendly:

Refreshed the patch and added docs. Only needs the before container action as the login_footer is fine to use for after the container.

I don't agree with you on that last comment. We would need both for max flexibility.

#15 @stgoos
5 months ago

  • Severity changed from normal to blocker

Dear WordPress team,

Would it be possible to finally include this simple enhancement of 2 extra hooks in version 4.5?

This enhancement/feature request is already open for >3 years and still hasn't been assigned an owner and is still awaiting review...

The lacking of the 2 hooks blocks customization of the login page with extra div blocks and such.

Many thanks in advance!

Last edited 5 months ago by stgoos (previous) (diff)

#16 @jeremyfelt
5 months ago

  • Severity changed from blocker to normal

It's too late for enhancements to be added to 4.5, though testing of the latest patch and discussion can always happen now to ready it for inclusion earlier in a cycle.

At first glance, the action seems useful enough to add HTML. For adding full navigational elements and branding, it would be nice if wp-login.php had better support for theming in general. Is it enough to add the action just to allow for some customization?

#17 @stgoos
5 months ago

Hi Jeremy,

I understand. 4.6 would be fine as well :)

It's sufficient enough when both the hooks suggested by borkweb in his patch would be included in wp-login.php.

Thanks!

#18 @voldemortensen
3 months ago

  • Milestone changed from Awaiting Review to 4.6

I'd like to see this considered for 4.6

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


3 months ago

#21 @jeremyfelt
3 months ago

  • Keywords commit removed

+1 for the login_before_container action placement. Could this be login_header instead? login_head is used inside <head>.

What's the benefit of the new login_after_container action vs the existing login_footer action in login_footer()?

#22 @voldemortensen
3 months ago

I do like login_header more than login_before_container. And, after thinking about it, there isn't really much gained by having an extra action in the footer.

#23 @SergeyBiryukov
3 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 37243:

Login/Registration: Add login_header action that fires in the login page header after the body tag is opened and complements login_footer.

Props borkweb, iamfriendly, voldemortensen.
Fixes #22139.

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


3 months ago

Note: See TracTickets for help on using tickets.