I expected something like gender or maybe age, but a captcha, a password strength indicator and a photo upload are things I can’t help you with.
I integrated Simple-Local-Avatars in my registration page, but that took me two or three days and it’s not that simple to explain. If you want to use the photo upload for an avatar too I could send you my code.
However, first-name and last-name are fairly simple and maybe this gives you a good starting point.
- duplicate the template-file called
register-form.php
from the plugin-contents to your theme and reference it in the shortcode
- open register-form.php and search for this line
<p>
<label for="user_email<?php $template->the_instance(); ?>"><?php _e( 'E-mail', 'theme-my-login' ) ?></label>
<input type="text" name="user_email" id="user_email<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_email' ); ?>" size="20" />
</p>
paste this text-block underneath it:
<p>
<label for="first_name<?php $template->the_instance(); ?>">First Name</label>
<input type="text" name="first_name" id="first_name<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'first_name' ); ?>" size="20" />
</p>
<p>
<label for="last_name<?php $template->the_instance(); ?>">Last Name</label>
<input type="text" name="last_name" id="last_name<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'last_name' ); ?>" size="20" />
</p>
If you uploaded the file, you can already see the new fields in the register-form.
- Now you need to create a file called
theme-my-login-custom.php
if you haven’t already and place it in the plugin-directory of your wordpress install.
Paste the following code in it to check if the fields are set and show an error-message if not (if you don’t want to make the fields required just skip this step)
function tml_registration_errors( $errors ) {
if ( empty( $_POST['first_name'] ) )
$errors->add( 'empty_first_name', '<strong>ERROR</strong>: Please insert your first name.' );
if ( empty( $_POST['last_name'] ) )
$errors->add( 'empty_last_name', '<strong>ERROR</strong>: Please inser your last name.' );
return $errors;
}
add_filter( 'registration_errors', 'tml_registration_errors' );
- Again in the
theme-my-login-custom.php
paste the following code to fill the fields in the user-profile with the fields from your registration page.
function tml_user_register( $user_id ) {
if ( !empty( $_POST['first_name'] ) )
update_user_meta( $user_id, 'first_name', $_POST['first_name'] );
if ( !empty( $_POST['last_name'] ) )
update_user_meta( $user_id, 'last_name', $_POST['last_name'] );
}
add_action( 'user_register', 'tml_user_register' );
I guess this is all you need to do. If you stuck at some point feel free to ask me again.
And your other problem with the missing register-page is propably due to your shortcode referencing on a file, which isn’t exisiting anymore.