Ask your WordPress questions! Pay money and get answers fast! (more info)

Custom Login/User Functionality WordPress

  • SOLVED

Hi Experts,

I am in need of a login solution for a client of mine. I am assuming this will likely need to be a custom built solution. I am looking for someone who is interested in this project. If you are interested, please email me and let me know how you will achieve the functionality (just a brief overview) and how much time/cost it will take to complete. If you have any questions at all, please let me know.

You can certainly use an existing plugin if you think it will work as a starting point. Here are the specs of how the login needs to function:


Signup Page
• This page will prompt new users for Name, Email and Password (twice). They must also choose their Partner Name from a dropdown list.
• Login credentials should be emailed to the user after account setup.
• The Partner dropdown list should be populated automatically after a new partner section is created. (A 'partner section' is simply a regular wordpress page that should only be accessible by the user.)


Login Page
• Existing users can login by inputting their email address/password.
• A “Forgot Password” link should be present on the login page that will prompt the user for their email address and will email them their login credentials.
• When the user logs in, they should be brought to their Partner section, which they specified during signup. They should only have access to this section.

Cheers.

Answers (1)

2010-08-18

Rashad Aliyev answers:

Hello,

You need to make some Page templates doing it with easy way.

<strong>1st </strong>- sign-up.php or register.php put it to head of your file.

<?php
/*

Template Name: Sign Up

*/
?>


Now add this code to your sign-up.php :


I made a sign-up.php for you. ;)


<?php
/*


Template Name: Sign Up

*/
?>

<?php
if ( $_POST['signup_post'] == '1') {

$username = $_POST['user_login'];
$password = $_POST['password'];
$confirm = $_POST['pass_confirm'];
$email = $_POST['user_email'];

$message = add_new_user($username, $password, $confirm, $email);
}

get_header(); ?>

<!-- Main Section -->
<!-- you can put here your main DIV class -->

<?php
// If logged in change nav to My Account and Log Out
if ( !is_user_logged_in() ) { ?>

<h2><?php the_title(); ?></h2>

<!-- Show Form Errors -->
<?php display_message($message) ?>
<!-- / Show Form Errors -->


<!-- Sign Up Form -->
<form name="signupform" id="signupform" action="" method="post">

<label>User Name:<span class="asterixRequired">*</span></label>
<fieldset><input type="text" name="user_login" id="new_user_login" class="text" value="<?php echo $_POST['user_login']; ?>" /></fieldset>

<label>Password:<span class="asterixRequired">*</span></label>
<fieldset><input type="password" name="password" id="password1" class="text" value="" /></fieldset>

<label>Password Again:<span class="asterixRequired">*</span></label><br />
<fieldset><input type="password" name="pass_confirm" id="password2" class="text" value="" /></fieldset>

<label>E-Mail:<span class="asterixRequired">*</span></label><br />
<fieldset><input type="text" class="text" name="user_email" id="user_email" value="<?php echo $_POST['user_email']; ?>" /></fieldset>


<input type="submit" name="signup_submit" id="signup_submit" value="Sign Up" />

<input type="hidden" name="signup_post" value="1"/>

</form>
<!-- / Sign Up Form -->

<!-- Main Finished HERE -->

<?php
// If user is already logged in Redirect them to My Account Page
} else { ?>

<?php redirect_to_myaccount_url(); ?>

<?php }; ?>



<?php get_sidebar(); ?>



<?php get_footer(); ?>


<strong>Then let's to make A PAGE and SELECT TEMPLATE SIGN-UP.</strong>


<strong>2nd - </strong>


Then make again login.php and put other template name as sign-up. For example

<?php
/*

Template Name: Log In

*/
?>


My sample code again for login.php (login template)

<?php
/*

Template Name: Log In

*/
?>

<?php
if ( $_POST['login_post'] == '1') {

$username = $_POST['user_login'];
$password = $_POST['password'];

$message = log_in_user($username, $password);
}

get_header(); ?>

<!-- Main Section, your main DIV class here START -->



<?php
// If logged in change nav to My Account and Log Out
if ( !is_user_logged_in() ) { ?>

<h2><?php the_title(); ?></h2>
<!-- Show Form Errors -->
<?php display_message($message) ?>
<!-- / Show Form Errors -->

<form class="message" name="loginformMain" id="loginformMain" method="post" action="">
<label for="user_username">İstifadəçi adı:</label><fieldset><input type="text" name="user_login" id="user_username" class="input" value="<?php if ( $username ) { echo $username;} else { echo $_POST['user_login']; }?>" size="20" maxlength="40" tabindex="10" /></fieldset>
<label for="user_password">Şifrəniz:</label><fieldset><input type="password" name="password" id="user_password" class="input" value="" size="20" maxlength="40" tabindex="20" /></fieldset>

<input type="hidden" name="login_post" value="1"/>

<input type="submit" name="wp-submit" id="wp-submit" value="Login" /> <a href="<?php bloginfo('url'); ?>/forgot-password/">Forget Password?</a>
</form>



<?php
// If user is already logged in Redirect them to My Account Page
} else { ?>

<?php redirect_to_myaccount_url(); ?>

<?php }; ?>


<!-- / Main Box END -->


<?php get_sidebar(); ?>



<?php get_footer(); ?>


You can improve this Core codes.

best regards,



WP Answers comments:

Hi Mate,

Sorry bout the delay. I haven't had a chane to fully test this but I think this is a good start.

However there are a few things which I think are missing. Mainly there needs to be a backend component to this. A listing of all user account with the ability to choose which page the user should get directed to once they have logged in.

There also needs to be an automatic passwordretrieval system. The use should be able to click on a "forgot password?" link and an email should be sent to them with thier login information.

This login system will be different than the default wordpress login where the user will never see any kind of wordpress back-end. They simply login and get sent directly to their specific page which is specified by the admin in the back-end.

I will email you for further coding. I am certainly willing to pay more to get this going. I will outline again in an email how the system needs to work and you can quote me with a price and time estimate.

Thanks for your hard work.

Cheers.