Make WordPress Core

Opened 3 years ago

Last modified 7 weeks ago

#23279 new enhancement

Add templates to style registration, signup, activation, login and password reset pages

Reported by: rmccue Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Login and Registration Keywords: has-patch
Focuses: template Cc:


As discussed in IRC, the ability to override the various user-related pages would be a great ability for themes to have. At the moment, it's pretty tedious to style these and there's very little control over the content of the page (some for good reason, others not so much).

Related: #1155, #3123, #22139

Attachments (1)

23279.diff (20.2 KB) - added by rmccue 2 years ago.
First pass at moving login HTML to templates

Download all attachments as: .zip

Change History (20)

#1 @netweb
3 years ago

  • Cc netweb added

#2 @DrewAPicture
3 years ago

  • Cc DrewAPicture added

This would be great. We briefly talked about some of this for Twenty Twelve in the scope of styling the signup pages to match the theme. It was ultimately decided to target the outer container classes, but templating would have been ideal. +1

#3 @rachelbaker
3 years ago

  • Cc rachelbaker added

#4 @SergeyBiryukov
3 years ago

Sounds like a duplicate of #17948.

#5 @toscho
3 years ago

  • Cc info@… added

#6 @sabreuse
3 years ago

  • Cc sabreuse added

2 years ago

First pass at moving login HTML to templates

#7 @rmccue
2 years ago

Phew, so, attachment:23279.diff contains my first run at this. It does the following:

  • Moves all the main HTML from wp-login.php to templates called core/login.php, core/register.php, core/resetpassword.php and core/retrievepassword.php (Considering using wp/ here instead, as core/ might conflict easily.)
  • Adds default fallback templates in wp-includes/theme-compat/ with the same ol' HTML as always.
  • Adds the login_locate_template function to extend locate_template with the theme-compat check. (This could go into a non-login_-namespaced function if we'd prefer; something like wp_locate_core_template)
  • Adds a resetpassword_form hook to match the other *_form filters.
  • Moves hidden fields from the templates to a function hooked into login_form, register_form, lostpassword_form, and resetpassword_form. (This currently uses a single function with a switch to avoid having 4 functions, but I'm easy on this.)
  • Adds a login_register_link function to link to the registration form if it's enabled (along with $before and $after parameters to prepend/append content)
  • Reformats some of the inline Javascript on the login form.

Comments very welcome. At the moment, the header/footer content is still locked into login_header and login_footer, so it's possible we want that moved to a template as well. If so, we should probably use wp/login/* (with wp/login/header.php and wp/login/footer.php) there to make it clear.

Note that I also didn't touch successful authentication with interim logins, as it's basically just login_header then login_footer. Happy to move that too.

#8 @rmccue
2 years ago

(Also worth noting that #17948 isn't really a duplicate, it's about actions/filters rather than templating. Interestingly, #1155 was opened for templating then closed in favour of #3123 which introduced hooks instead, so we've done this dance before.)

#9 @emzo
2 years ago

  • Cc wordpress@… added

#10 @boonebgorges
2 years ago

  • Cc boonebgorges@… added

#11 @rmccue
2 years ago

  • Keywords has-patch added

I haven't experienced any problems with this in my past day of testing, so marking as has-patch.

#12 @iseulde
2 years ago

  • Cc avrylnoxke@… added

#13 @mindctrl
2 years ago

  • Cc public@… added

This ticket was mentioned in IRC in #wordpress-dev by rmccue. View the logs.

2 years ago

#15 @nacin
22 months ago

  • Component changed from Themes to Login and Registration
  • Focuses template added

theme-compat is where code goes to die. We'd probably want to do something a bit different here. Would it make sense to modify this more off get_search_form()? Use the file if present, here's some HTML if not?

This ticket was mentioned in IRC in #wordpress-dev by rmccue. View the logs.

22 months ago

#17 @chriscct7
7 weeks ago

@rmccue did you want to continue on this?

#18 @rmccue
7 weeks ago

FWIW, I still think theme-compat is the correct choice for this. In the past it's been a place for code to die, but I don't see any reason it needs to be. I'd still love to have this, but needs consensus on the approach.

#19 @jfarthing84
7 weeks ago

FWIW, there's already a plugin that does this.

Note: See TracTickets for help on using tickets.