Build a better WP e-Commerce user registration experience

Posted by on Jun 18, 2012 in Blog, E-Commerce, Wordpress, WP e-Commerce | 6 Comments

The problem

If you want users to be able to register on your site in WP e-Commerce you need to set Settings/Store/Checkout tab “Users must register before checking out:” to YES.
This has some drawbacks. You are forcing your users to register. I know I personally do not like that and often just leave the site. That may not make much sense as I am only doing it at purchase where I am supplying more information than that anyway. The thing is it does not matter if my thought process made sense, I am gone and you lost a customer.
There is no logout, this might bother some people.

Time for a plugin

There are probably many solutions for this issue, all sorts of plugins all with their own features and issues.
Some can only be widgets which does not suit everyone. Some take you to the WordPress admin page when you login, very confusing to users. Some just look very basic.
I am going to use “Theme my Login” plugin. You can get it free in the WordPress plugin page. You will find extensive documentation here.
The nice thing about this plugin is that as it’s name suggests the pages will adopt your themes look. It also includes a widget if you want one. When we are done you will have Registration, Login and Password retrieval pages.
Go to the plugins page search for “Theme my Login” install and activate.
Go to Appearance/Menus and add the page My Account to the menu.
Now add the new page the plugin created “Login” to your menu beneath My Account and save.

NOTE:

You must also have WordPress setting “Settings/General/ “Anyone can register” checked. This applies even when using the regular WP e-Commerce login setup.

Lets add some features

Open the plugin settings by clicking Settings in the plugins page or by clicking “Theme my Login” on the Settings menu. You can leave everything on the General Tab as is.
Click the Modules link. First I suggest you check “Enable Custom E-mail” and click Save Changes. Now click the new “custom Email” tab and fill in the details of the emails you would like your users to receive when they register. For more information on this see the documentation.

You may or may not wish to activate the Security options, if you do the new Security tab will allow you to restrict the number of attempts a user can make to login before being locked out, plus the time until they will be permitted to try again.

Now go back to modules and activate “Enable Custom Redirection” and Save Changes. Go to the Redirection tab. Click the “Subscriber” link. We only wish to do redirection for our customers. Don’t redirect yourself!
Check “Referer” for both Logging in and Logging out. This will keep the user on the same page when they login, as opposed to sending them to your sites backend admin area! They will see a you have logged in or logged out message.
You could also send them to a custom page such as your home page or the products page, or even the My Account page. Just select the last option and enter a URL. For example you may send them to the My Account page on login and to your Homepage on logout.

Next open your site in another tab or window. Click the Login link you added to the menu. Click the Log In link. Then click the Register link. Copy the URL of that page.
In the backend go to Appearance/Menus and paste it into the URL field of the Custom Links box. Label it “Register and click Add to Menu. Locate it where you want in the menu, probably on the Your Account menu.
Next on your site click the Lost password Link. Get the URL and add it as a custom link again.

You are done.

There is some duplicate functionality because a user can go straight to the My Account page and login as well. This is not a problem more a convenience. If they are logged in they will not be shown login fields on the My Account page.

Why can’t I change the page titles!

Now you may try and change the page names in the backend and wonder why they will not change on your site. Never fear, there is a solution which is kindly supplied by the plugin developer Jeff Farthing.
A small PHP edit. Do not be scared it is a simple cut and paste. If you have never done this before see Tools at the end of this post.

Open functions.php in your theme folder. Add the code below which can also be found at this page in the plugin documents. Right before the very last ?> paste the code and save.

function tml_title( $title, $action ) {
	if ( is_user_logged_in() ) {
		$user = wp_get_current_user;
		if ( 'profile' == $action )
			$title = 'Your Profile';
		else
			$title = sprintf( 'Welcome, %s', $user->display_name );
	} else {
		switch ( $action ) {
			case 'register' :
				$title = 'Sign Up';
				break;
			case 'lostpassword':
			case 'retrievepassword':
			case 'resetpass':
			case 'rp':
				$title = 'Password Recovery';
				break;
			case 'login':
			default:
				$title = 'Sign In';
		}
	}
	return $title;
}
add_filter( 'tml_title', 'tml_title', 11, 2 );

In the code above you will see ‘Password Recovery’ and ‘Sign In’ you may change these to whatever you like.

Tools:

You may edit your PHP outside WordPress and upload it to your server. You must use an appropriate code editor NOT microsoft word or anything like that which adds a lot of invisible formatting and will be a disaster.
If you do not have one, 2 excellent free ones are…
TextWrangler for Mac, http://www.barebones.com/products/textwrangler/
Notepad++ for the PC http://notepad-plus-plus.org/

6 Comments

  1. Simon Woolcott
    April 27, 2015

    Brilliant, solves the issue I had with people not having a clue what to do when signing up. The password set during signup is great.

    One thing would make this perfect and remove a sep for visitors to my site: is there anyway that once an email address is confirmed. that user is logged in to the site automatically?

    Reply
  2. Tom
    June 27, 2013

    Thanks for a great tutorial.

    This really helped.

    Reply
  3. Ragi
    January 14, 2013

    am using wp-ecommerce….in checkout page, by clicking the login button, the page is redirecting to wordpress admin login page..how can i redirect into checkout page itself

    Reply
  4. Mike
    December 13, 2012

    Hey, its really great tutorial, I have a question as I am working on the login part for the 1st time.

    My question is the, after having the registration process, it is send an email, but no password…. Can you help me?

    -Mike

    Reply
  5. neticaret
    October 19, 2012

    That really helped a lot! Thank you…

    Reply
  6. Kate
    September 22, 2012

    Mark, you are a dead-set LEGEND!!

    This is exactly what I’ve been trying to sort out all day and now I’ve found all the answers to my problems right here in this post. So clearly explained and well written.

    But can you help me with just one more small thing? Slight CSS positioning issue on this page http://www.mogovillagecellars.com/login/?action=register and I’m not sure where it should be fixed.

    I swear, you are the most helpful person I have come across during this whole epic saga of building my website from a standing start of next to zero knowledge of… practically anything.

    Reply

Leave a Reply