[wp-hackers] New themed login patch available -- 2.7.1 compatible

David Still dave at stilldesigning.com
Fri Feb 20 21:47:25 GMT 2009

About a year ago, I wrote a patch to address the TRAC issue 4478
(http://core.trac.wordpress.org/ticket/4478).  It was compatible with
2.5.1 (and apparently 2.6, although I didn't try this myself).  I
recently updated my WordPress installations to 2.7.1, and found myself
needing to update the patch.  The updated patch can found attached to
the TRAC issue linked above, and you can read all about it on my blog
at http://stilldesigning.com/2009/02/19/wordpress-custom-themed-login-gets-an-update/

Previous feedback on the plugin was that a more extensive patch was
desired, but given my personal time constraints and a desire for
simplicity, I went in a different direction and created a simpler
patch.  The current wp-login.php page builds a login / registration
page in two parts: Header + Form.  The Form calls the login_header()
function, passing any error messages and page titles to the function.
The Form also adds the closing page tags (</body></html>).

This patch breaks up the Header function into two parts,
login_header() and login_error(), and adds a new function,
login_footer().  This changes the basic structure of the login page
from this:

|      Header      |
|      (error)     |
|       Form       |
|     (footer)     |

To this:

|      Header      |
|      (error)     |
|       Form       |
|      Footer      |

I then added a function to the top of wp-login.php to check for the
existence of a login.php in the current Theme.  If present, it loads
login.php, which should contain custom login_header and login_footer
functions, with login_header calling login_header_error to display any
error messaging.  If login.php is not present, the default functions
are used.  The result is a login / registration page that is entirely
customizable without losing any of the form functionality.  It is
compatible with all existing themes, as a login.php template is not

As always, feedback is welcome.

- Dave

More information about the wp-hackers mailing list