Profile Builder for User Login

So, you have installed WordPress, in a breeze. Great, congratulations! Now you start to explore and everything seems to fabulous, until … Until you log out, what a surprise – you are greeted by WordPress!  Did WordPress hijack my site?

Does WordPress have to remind visitors the site is powered by WordPress? Or worse, visitors could mistaken your sites being run by WordPress.

If you happen to remove the META widget, without a login plugin, you will have to manually type yoursite/wp-login.php to re-login, again under the glaring WordPress Logo.

Not sure if this is by intention or by omission, this is one of the most amateurish features of WordPress.  For a very popular software, such as WordPress, it is unfathomable.

Among all the CMS’, WordPress is the worst in this regard.

Right away, you have to start to find a solution, a theme or a plugin. Countless hours have been wasted in finding and testing a suitable plugin. What did you get? Not much and none of them will work out of the box as desired.

Eventually, we settled on Profile Builder.  The selection of Profile Builder is not just related to the login issue but also due to two other important issues that will be discussed later in other TIPs.

Profile Builder has a basic and a pro version.  Pro version is your choice if you want to save time and also it offers more features that you may find very useful.

This TIP covers the basic version only.

For detailed instruction, please check with
http://wordpress.org/extend/plugins/profile-builder/

To use this tip, you will need to have to edit some of Profile Builder files and wp-login.php file.

Before you proceed, ALWAYS and ALWAYS back up files first, if anything goes wrong, you can always replace the modified file with your backup file.

You need to create four pages (be sure to name them exactly as the following if you wish to use modified files below)

edit-profile, login, register, and lostpass

After the creation of the four pages, you may well need to remove them from your navigation menu.  Check with your theme designer if you cannot remove yourself.

Now we need to integrate login, register and logout links into theme.

For this site, they are integrated into the header (header.php) at the top right corner.

Copy and paste the following codes to the place of your choice in your header.php.

<?php if ( !is_user_logged_in() ) { ?>
<a href=”/register/” rel=”nofollow”>Register</a>
&nbsp;
<a href=”/login/” rel=nofollow>Login</a>
<?php } else { ?>
Welcome,&nbsp;
<a href=”/edit-profile/” rel=”nofollow”>
<?php
global $current_user;
if ( isset($current_user) ) {
echo $current_user->user_login; } ?> </a>
&nbsp;
<a href=”<?php echo wp_logout_url( home_url() ); ?>” title=”Logout” rel=”nofollow”>Logout</a>
<?php }?>

Now we have a workable login/logout mechanism.

What does this TIP do?

It replaces WP default register and login page with login, register, and edit-profile pages that match your theme.  No need to worry about using a plugin just to remove the glaring and mistaking WP logo.

There are still problems with this implementation:

  • After registration, we would like to be redirected to login page
  • After login, we would want to be re-directed to home page
  • At the login page, we want to use lostpass page you just created, not the default WP lostpass page.

The basic version will not be able do these, as it lacks custom re-direct function. If you are using Pro Version, you can set the re-directs. Otherwise, you will need to edit the following two files:
wp-content/plugins/profile-builder/front-end/wppb-login.php
wp-content/plugins/profile-builder/front-end/wppb-register.php

Locate login re-redirect, lostpass link and register re-direct and make appropriate changes.  Or you can download the modified file directly from here. Download the zip and replace the two files:
front-end.zip

To force all registration through Profile Builder register page, you need to add one line

wp_redirect( site_url(‘/register/’) );

to
Yoursite/wp-login.php

After
<?php
login_footer(‘user_pass’);
break;

case ‘register’ :

Again, you may download the modified file from here.
wp-login.zip

Changing core files is not preferred, but in certain cases you have no choice but change them. Alternative, you can use loads of plugins just to do little things. Keep a record of what you have done for future reference.

TIP Summary

TIP: use Profile Builder as front-end registration, login and edit profile pages
Plugin: Profile Builder Basic 1.1.24
WordPress: 3.3.1

This TIP has been tested, but as with all our tips and hacks, USE IT AT YOUR OWN RISK.

Comments

  1. wp-tips says:

    Updated to 1.1.26

    The two modified files have been updated to Profile Builder Basic 1.1.26, so you may upgrade your Profile Builder to the new version then upload the two modified files.

  2. the drawback of modifing the wp-login.php core file is that you have to modify it again if your WP version is updated/upgraded. To elimnate the need, you can install redirection plugin, redirct “/wp-login.php?action=register” to your register page or your home page (those access your WP login-register url directly are 100% spammers)