WordPress.org

Make WordPress Core

Opened 15 months ago

Last modified 9 months ago

#20279 new enhancement

Functions defined in wp-login.php should be moved to a separate file to make them re-usable

Reported by: beaulebens Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version:
Severity: normal Keywords: has-patch
Cc: wycks, emeraldimp, scott@…, zombrows

Description

Currently, there are a series of functions defined at the top of wp-login.php:

login_header()
login_footer()
wp_shake_js()
retrieve_password()
check_password_reset_key()
reset_password()
register_new_user()

If these functions were moved to a separate file, they would be reusable by folks who are trying to do more advanced things involving the login flow.

As an example, if you want to create a page resembling wp-login right now, there's no easy way to do it without just duplicating everything from this file. Moving these functions means you can use login_header() and login_footer() to recreate the bulk of the page, then handle the "content block" yourself. This marginally improves the re-usability of the login system.

Patch attached which does this.

Attachments (1)

20279.diff (24.3 KB) - added by beaulebens 15 months ago.
Dotted filename used only to match the other functions.*.php files in wp-includes. Feel free to change it.

Download all attachments as: .zip

Change History (8)

beaulebens15 months ago

Dotted filename used only to match the other functions.*.php files in wp-includes. Feel free to change it.

comment:1 nacin15 months ago

See also #15384. I think some of these functions are good as a separate file, while others are pretty intrinsic to the login skin/flow.

We don't use dotted filenames — those files are from BackPress. This would simply be wp-includes/login.php.

Also, 19852#comment:31, where we may end up moving wp-login.php to the admin pot for 3.4.

comment:2 wycks15 months ago

  • Cc wycks added

I was just looking at wp_shake_js and it looks strange there, all for cleaning this up a bit.

comment:3 emeraldimp13 months ago

  • Cc emeraldimp added

comment:4 scottconnerly13 months ago

  • Cc scott@… added

comment:5 zombrows13 months ago

  • Cc zombrows added

comment:7 adrian79 months ago

Me too waiting for this enhancement. Maybe moved to pluggable.php. Also retrieve_password and others taking values directly from $_POST should accept one or more parameters.

For now a solution for me was to fork these functions and put them in functions.php of my theme.

Note: See TracTickets for help on using tickets.