Connect with us

How to use the Profile Builder plugin for User Login

solution

How to use the Profile Builder plugin 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
https://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 change 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 lost pass 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, lost pass link and register re-direct and make appropriate changes.

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

The line should be added after this code:
<?php
login_footer(‘user_pass’);
break;

case ‘register’ :

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

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

Continue Reading
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in solution

About Me:

Szabi Kisded

Hey there, I'm Szabi. At 30 years old, I quit my IT job and started my own business and became a full time WordPress plugin developer, blogger and stay-at-home dad. Here I'm documenting my journey earning an online (semi)passive income. Read more

Sign up for my newsletter and get the YouTube Caption Scraper WordPress plugin for free
(worth 29$)!

All My Plugins In A Bundle:

My AutoBlogging Plugins:

My Online Courses:

A Theme I Recommend:

Featured Posts:

To Top