Make WordPress Core

Opened 14 years ago

Closed 12 years ago

Last modified 5 years ago

#16411 closed enhancement (invalid)

Custom Login and Registration URLs

Reported by: danielpataki's profile danielpataki Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

For bigger websites it would be beneficial to allow custom registrations by being able to change the login and registration urls. You can change the login url in a haphazard way now like this, but this is not very good.

function bsb_login_url($redirect_to) {
	$redirect_to = str_replace(get_bloginfo("url").'/wp-login.php', '', $redirect_to);
	$link = get_bloginfo("url")."/login/".$redirect_to;
	return $link;
}   
add_filter( 'login_url', 'bsb_login_url' );

Looking at wp-login.php, the registration link is output like this:

<a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></a>

If, by using a filter, hook, or even a definition in the config file, you could change the url output here that would be nice.

Change History (11)

#1 @danielpataki
14 years ago

Just want to add quickly, that this can also be accomplished in another bad way like this:

add_action("init", "bsb_register_redirect") ;

function bsb_register_redirect() {
	
	if(get_current_url(true) == get_bloginfo('url')."/wp-login.php?action=register")
	header("Location: http://bitesizebio.com/register/");
} 
Last edited 14 years ago by danielpataki (previous) (diff)

#2 follow-up: @SergeyBiryukov
14 years ago

There are plugins for that. Theme My Login is one for example.

Last edited 14 years ago by SergeyBiryukov (previous) (diff)

#3 in reply to: ↑ 2 @markmcwilliams
14 years ago

Replying to SergeyBiryukov:

There are plugins for that. Theme My Login is one for example.

I think he's on about having site.com/login/ and site.com/register/ instead of the site.com/wp-login.php and site.com/wp-login.php?action=register we currently have, although this will more than likely be plugin material, as it can be achieved through either functions.php or a plugin!

#4 follow-up: @SergeyBiryukov
14 years ago

Theme My Login can do that. Sorry for the wrong link, fixed.

#5 in reply to: ↑ 4 @markmcwilliams
14 years ago

Replying to SergeyBiryukov:

Theme My Login can do that. Sorry for the wrong link, fixed.

Oh, I never noticed I was looking at the wrong plugin!

#6 @danielpataki
14 years ago

It's not the fact that it can not be done which is the problem, I just think that this should be something the core could support. For larger websites, having a more elaborate registration, lost password and login process is a must, and it would be easier to achieve with built in support.

#7 @ptahdunbar
14 years ago

  • Cc trac@… added

#8 @Moskjis
14 years ago

There exists a wp_login_form function to address this (at least, part of it).

#9 @RyanMurphy
14 years ago

Ozh has a plugin that does /login instead of /wp-login.php. I don't think it would be too hard for it to also handle /register if someone asked/sent him a patch.

#12 @scribu
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

There's nothing haphazard about using the 'login_url' filter; it's the standard way of extending WordPress.

What's missing is a matching wp_register_url() and is_login_url() functions, which are addressed in #19898

Note: See TracTickets for help on using tickets.