1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Want to set a private client login page in wordpress.

Discussion in 'Blogging' started by Duffers5000, Nov 1, 2013.

  1. Duffers5000

    Duffers5000 Elite Member

    Joined:
    Apr 1, 2012
    Messages:
    2,466
    Likes Received:
    7,615
    This should be a simple one but Ive spent a few days looking at options and havent found the answer yet.

    I want to have a simple private page on a wordpress site that clients can login to.

    I know I can password protect a wordpress page but its not secure enough and my page will list a lot of sensitive information.

    I've also looked at a few plugin but they are too bloated for my means, Im not trying to set up a membership site.

    So really I just want a secure login page that will ask for a password everytime you visit. I want to email the password out to 500 clients if I start asking them to register I wont convert them all. Looking for any suggestions

    Thanks as always.
     
  2. dbdnvikas

    dbdnvikas Junior Member

    Joined:
    Feb 18, 2011
    Messages:
    188
    Likes Received:
    65
    Location:
    BHW
    Create a new directory, password protect it, add index file and done.
     
    • Thanks Thanks x 1
  3. Conor

    Conor Jr. VIP Jr. VIP

    Joined:
    Nov 7, 2012
    Messages:
    3,373
    Likes Received:
    5,439
    Gender:
    Male
    Location:
    South Africa
    Home Page:
    You could add all users as a custom role:
    http://wordpress.org/plugins/user-role-editor/

    Then, in your custom functions, make something like this:

    Code:
    function securepage() { if (is_user_logged_in() &&  current_user_can('customrole') && is_page('securepage')) {
    echo "Secure Content";
    }
    else {
    $args = array(
            'echo' => true,
            'redirect' => site_url( $_SERVER['REQUEST_URI'] ), 
            'form_id' => 'loginform',
            'label_username' => __( 'Username' ),
            'label_password' => __( 'Password' ),
            'label_remember' => __( 'Remember Me' ),
            'label_log_in' => __( 'Log In' ),
            'id_username' => 'user_login',
            'id_password' => 'user_pass',
            'id_remember' => 'rememberme',
            'id_submit' => 'wp-submit',
            'remember' => false,
            'value_username' => NULL,
            'value_remember' => false );
    wp_login_form( $args );
    }
    }
    
    I just wrote the code off the top of my head using WP references, it should work but just double check to be sure :)

    References:
    http://codex.wordpress.org/Function_Reference/is_user_logged_in
    http://codex.wordpress.org/Function_Reference/wp_login_form
    http://wordpress.org/support/topic/display-a-custom-image-only-if-user-role-is-contributor
    http://codex.wordpress.org/Function_Reference/is_page
     
    • Thanks Thanks x 1
    Last edited: Nov 1, 2013
  4. dbdnvikas

    dbdnvikas Junior Member

    Joined:
    Feb 18, 2011
    Messages:
    188
    Likes Received:
    65
    Location:
    BHW

    :O top of your head? - Your head is valuable for me in that case. :p
     
    • Thanks Thanks x 1
  5. Conor

    Conor Jr. VIP Jr. VIP

    Joined:
    Nov 7, 2012
    Messages:
    3,373
    Likes Received:
    5,439
    Gender:
    Male
    Location:
    South Africa
    Home Page:
    Lol, it's just a simple function dude :p My coding skills are very limited at the moment.
     
  6. MadStacks

    MadStacks BANNED BANNED

    Joined:
    Oct 20, 2013
    Messages:
    1,494
    Likes Received:
    493
    You could simply install a free membership management plugin to WordPress. Then you can protect pages and even charge people to view them.