Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Front End User Registration WordPress

  • SOLVED

Hello

I'm having big difficulty with front end user profile editor plugins. I've managed to get them to work and run on the site, but then it seems they don't work with Custom user meta_key's, and their too bloated with other unnecessary stuff.

Can anyone tell me the simplest cleanest way to put a Front End User Pofile editor form on a page template

I don't mind coding, I just need to know where the code goes, etc.

If anyone's got a working example on their site, I could probably figure it out with the relevant code :-)

The user profile form needs to accommodate the below...

<strong>Name</strong>
<strong>Contact Info</strong>
<strong>About the user</strong> - would be sweet if we could get the password indicator in here :-)
<strong>Profile Info</strong> - these are my meta_key's

I'm not really fussed about a confirmation message, if you fancy dropping one in then fine, but keep the form visible after submission, with the new value variables.

See this gist for how I registered my user meta keys [[LINK href="https://gist.github.com/1696983"]]functions.php[[/LINK]]

Any help would be great thanks.

Answers (4)

2012-01-29

idt answers:

Hi,

Have you tried using [[LINK href="http://wordpress.org/extend/plugins/cimy-user-extra-fields/"]]Cimy User Extra Fields[[/LINK]] and [[LINK href="http://wordpress.org/extend/plugins/theme-my-login/"]]Theme My Login[[/LINK]]?

Thanks,
idt


idt comments:

Cimy User Extra Fields to specify which fields goes in the user registrations and you can theme your registration/Edit Profile page using Theme My Login. These two works great together.


Josh Cranwell comments:

Hi idt

I've created a really awesome custom registration page using gravity forms, and gravity form is capturing alot of important data that I want to keep. A lot backtracking moving over to Cimy.

Would be quicker personally for me to code one manually on a page template.

Though I will look at Cimy for next time.

Thanks


idt comments:

I see. Have you tried using Theme My Login? It allows you theme your Edit Profile page and I think it works with Gravity Forms. It will be like accessing your Dashboad's Edit Profile but in an Page, not in the WP Dashboard. Haven't tried using Theme My Login and Gravity Forms together though.

2012-01-29

Jatin Soni answers:

Just install this plugin and it works completely fine with me, you will get all your custom user meta into front end profile. I am using this for one of my website and working completely fine without any issue.

http://wordpress.org/extend/plugins/theme-my-login/

If you are looking to only display profile and not editor and without any plugin let me know but its little time consuming too.

2012-01-29

Kannan C answers:

This is will work as a page template, let me know if you have any difficulty.

<?php
global $user_ID, $user_identity, $user_level;
if ($user_ID) {
if($_POST)
{
$message = "Your profile updated successfully.";
$first = $wpdb->escape($_POST['first_name']);
$last = $wpdb->escape($_POST['last_name']);
$email = $wpdb->escape($_POST['email']);
$user_url = $wpdb->escape($_POST['website']);
$description = $wpdb->escape($_POST['desc']);
$password = $wpdb->escape($_POST['pwd']);
$confirm_password = $wpdb->escape($_POST['confirm']);

update_user_meta( $user_ID, 'first_name', $first );
update_user_meta( $user_ID, 'last_name', $last );
update_user_meta( $user_ID, 'description', $description );
wp_update_user( array ('ID' => $user_ID, 'user_url' => $user_url) );

if(isset($email)) {
if (preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email)){
wp_update_user( array ('ID' => $user_ID, 'user_email' => $email) ) ;
}
else { $message = "<div id='error'>Please enter a valid email id.</div>"; }
}
if($password) {
if (strlen($password) < 5 || strlen($password) > 15) {
$message = "<div id='error'>Password must be 5 to 15 characters in length.</div>";
}
//elseif( $password == $confirm_password ) {
elseif(isset($password) && $password != $confirm_password) {
$message = "<div class='error'>Password Mismatch</div>";
} elseif ( isset($password) && !empty($password) ) {
$update = wp_set_password( $password, $user_ID );
$message = "<div id='success'>Your profile updated successfully.</div>";
}
}

}
}
/*
Template Name: Your account
*/
if ($user_ID) {
$user_info = get_userdata($user_ID);
get_header();
?>
<div id="user-interact">
<div class="indent">
<div id="respond">
<h1 class="margin">Edit your account</h1>
<?php if($_POST) {
echo "<div id='result'><div class='message'>".$message."</div></div>";
}
?>
<form action="" method="post">
<label>First name:</label><br /><input type="text" name="first_name" class="text" value="<?php echo $user_info->first_name; ?>" maxlength="30" /> <br />
<label>Last name:</label><br /><input type="text" name="last_name" class="text" value="<?php echo $user_info->last_name; ?>" maxlength="30" /> <br />
<label>Email address:</label><br /><input type="text" name="email" class="text" value="<?php echo $user_info->user_email; ?>" maxlength="30" /><br />
<label>Website:</label><br /><input type="text" name="website" class="text" value="<?php echo $user_info->user_url; ?>" maxlength="30" /> <br />
<label>About yourself:</label><br /><textarea name="desc" class="text" rows="5"><?php echo $user_info->description; ?></textarea> <br />
<label>Change password</label><br /><input type="password" name="pwd" class="text" maxlength="15" /> <br />
<label>Retype password</label><br /><input type="password" name="confirm" class="text" maxlength="15" /><br />
<span class="grey">If you would like to change the password type a new one. Otherwise leave this blank</span>
<br /><br />
<input type="submit" name="submit" value="Submit" id="submit" />

</form>
</div>
</div>
</div>
<?php
get_footer();
}
else {
$redirect_to = get_bloginfo('url')."/login";//change this to your custom login url
wp_safe_redirect($redirect_to);
exit;
}
?>

Note: This is having password change ability. If you don't want, just remove it.


Josh Cranwell comments:

This looks really promising. I will check it out first thing in the morning! Thanks


Josh Cranwell comments:

Absolutely perfect...

See my gist... [[LINK href="https://gist.github.com/1699676"]]https://gist.github.com/1699676[[/LINK]]

Thanks

2012-01-29

Fahad Murtaza answers:

Why not use gravity forms?


Josh Cranwell comments:

See I am using gravity forms for my user registration.

But I could only find one thing on the net that told me how to do it. [[LINK href="http://blog.fublo.net/2011/12/edit-wordpress-user-profiles-gravity-forms/"]]http://blog.fublo.net/2011/12/edit-wordpress-user-profiles-gravity-forms/[[/LINK]]

But I couldn't figure it out. I need it to be a profile updater, and to be able to show the current user values.

Thanks


Fahad Murtaza comments:

On my way to office right now. Will see what I can do :)