working on a jQuery plugin that builds an interactive portfolio based on a simple xml file...all with one easy function call.

Wordpress Client Login and Password Protected Pages

I recently built a very basic website for a client who owns and operates a company that provides Employee Benefits services for small to medium size companies. I originally built his site useing Wordpress in order to give him a solid CMS to manage his site himself. He recently requested a way to give each of his clients a unique login in order to access one page where he could provide them links to their specific pdf documents.

Having Wordpress to work with as a platform, I did a little research and came across this post in the Wordpress Support Forums:

http://wordpress.org/support/topic/217141

After a small enhancement to the code, it ended up being exactly what I was looking for. After implementing this, my client obtained the following functionality:

  • Ability to create a unique user account for each client
  • Ability for client to log in through Wordpress’ built-in authentication and login form (customized via a plugin)
  • Ability to provide 1 password protected page to each client (client is automatically re-directed to their specific page after login)
  • Addition of a “Client Log In” button on the header of his site  that changes to “Logged in as: xxxx” after the client logs in.

This is by no means a fully functional client portal, however it does provide a very simple way to fulfill a common requirement and does not require too much overhead and maintenance.

Check it out.

  • Digg Me
  • Bookmark me on Del.icio.us
  • Post to StumbleUpon
  • Tweet Me

4 Responses to “Wordpress Client Login and Password Protected Pages”

  1. Jean says:

    Oh drat – it stripped the php opening statements! Oh well – feel free to email me if you want this code. I may just share it on my site & post a link, if that is helpful to anyone else.

  2. Jean says:

    Thanks so much for this article. It was sooo helpful!

    I added a few extra lines in the code to allow for page children to be visited by the user without being forbidden access.

    First define the parent page by adding these 2 lines:

    $parent_title = strtolower(get_the_title($post->post_parent));
    $theparent = str_replace(‘ ‘, ”, $parent_title);

    Next, in your if statement, add another or statement that allows a user access to the page if they are logged in and have the parent page username:

    || is_user_logged_in() && $username==$parent_title

    In your clientpagetemplate.php page (whatever it’s name is!) The code is placed like this (These are not complete php statements, it’s just to help show location of new code.):

    user_login );

    $parent_title = strtolower(get_the_title($post->post_parent));
    $theparent = str_replace(‘ ‘, ”, $parent_title);
    ?>

    Best wishes!

  3. Leon Amarant says:

    full code posted on: http://wordpress.org/support/topic/217141

  4. Derek says:

    you mind sharing how you set up your parent client page as a redirect page as you mentioned in post 217141 on wordpress? i see the need to do this, so you don’t have to set up a redirect each time you add a client. any help is appreciated.

Leave a Reply

About Me

I'm a web developer, UI/UX specialist and online strategist with over 10 years of experience in the field. I am currently freelancing and am available for hire. I have hands-on experience in all stages of the SDLC. If you or your business needs a web site, could use some help with your online strategy, or if you need to get started with SEM, please feel free to contact me.

I can help you with: Web Site Design and Development, Search Engine Optimization, Search Engine Marketing, Multivariate Testing, Metrics Analysis, Campaign Optimization, Social Site Integration, E-mail Marketing and everything else that has to do with the Web.

I work/haved worked with the following technologies: XHTML, CSS, Javascript, Ajax, JQuery, MySQL, SQL Server, ASP, ASP.Net, Coldfusion, PHP, Wordpress, Flash, Google Analytics, Google Adwords.

Recent Work

  • Amy Bowen Photography
  • Engel & Schultz
  • Lakeshore Benefit Group
  • The Endovascular Forum
  • Local Tide
  • Emma’s Pizza
  • Babson College
  • The  Seabreeze Inn

Comments

flickr

    about this site

    This site was built using Wordpress, Jquery and Blueprint, along with XHTML, Javascript, CSS, and PHP.

    Open source scripts from: Magpie RSS, jCarousel.

    Feeds from: Yahoo Pipes, Flickr, Twitter, and De.licio.us.

    This site is hosted by Dreamhost.

    Design inspired by Trevor Davis.