Make WordPress Core

Opened 11 years ago

Last modified 7 years ago

#23279 new enhancement

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

Reported by: rmccue's profile 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 10 years ago.
First pass at moving login HTML to templates

Download all attachments as: .zip

Change History (22)

#1 @netweb
11 years ago

  • Cc netweb added

#2 @DrewAPicture
11 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
11 years ago

  • Cc rachelbaker added

#4 @SergeyBiryukov
11 years ago

Sounds like a duplicate of #17948.

#5 @toscho
11 years ago

  • Cc info@… added

#6 @sabreuse
11 years ago

  • Cc sabreuse added

10 years ago

First pass at moving login HTML to templates

#7 @rmccue
10 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
10 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
10 years ago

  • Cc wordpress@… added

#10 @boonebgorges
10 years ago

  • Cc boonebgorges@… added

#11 @rmccue
10 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
10 years ago

  • Cc avrylnoxke@… added

#13 @mindctrl
10 years ago

  • Cc public@… added

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

10 years ago

#15 @nacin
10 years 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.

10 years ago

#17 @chriscct7
9 years ago

@rmccue did you want to continue on this?

#18 @rmccue
9 years 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
9 years ago

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

#20 follow-up: @magicroundabout
8 years ago

I'd really like to see some improvements here. Themes can better "brand" their login forms using page templates or shortcodes, but the current set of tags and filters doesn't allow much in the way of customization.

I can do a wp_login_form() but I can't do a wp_lostpassword_form() or a wp_registration_form() - more template tags like this would help us build our own forms in page templates. It it worth me having a go add extracting this form code to functions like this? Or are there complications to doing this that I've not considered?

#21 in reply to: ↑ 20 @SergeyBiryukov
7 years ago

Replying to magicroundabout:

I can do a wp_login_form() but I can't do a wp_lostpassword_form() or a wp_registration_form() - more template tags like this would help us build our own forms in page templates.

Related: #34466

Note: See TracTickets for help on using tickets.