Make WordPress Core

Opened 3 years ago

Last modified 19 months 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 22 months ago.
First pass at moving login HTML to templates

Download all attachments as: .zip

Change History (17)

comment:1 @netweb3 years ago

  • Cc netweb added

comment:2 @DrewAPicture3 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

comment:3 @rachelbaker3 years ago

  • Cc rachelbaker added

comment:4 @SergeyBiryukov3 years ago

Sounds like a duplicate of #17948.

comment:5 @toscho3 years ago

  • Cc info@… added

comment:6 @sabreuse3 years ago

  • Cc sabreuse added

@rmccue22 months ago

First pass at moving login HTML to templates

comment:7 @rmccue22 months 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.

comment:8 @rmccue22 months 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.)

comment:9 @emzo22 months ago

  • Cc wordpress@… added

comment:10 @boonebgorges22 months ago

  • Cc boonebgorges@… added

comment:11 @rmccue22 months ago

  • Keywords has-patch added

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

comment:12 @iseulde22 months ago

  • Cc avrylnoxke@… added

comment:13 @mindctrl21 months ago

  • Cc public@… added

comment:14 @ircbot21 months ago

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

comment:15 @nacin19 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?

comment:16 @ircbot19 months ago

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

Note: See TracTickets for help on using tickets.