Extra registration fields… checkbox and textarea.
-
Hi Jeff, very nice plugin.
I’ve added a checkbox and a textarea in registration page and both are showed in the profile page but don’t returns user’s data.
This are the settings I used..
on register-form.php
<p> <label for="user_note<?php $template->the_instance(); ?>"><?php _e( 'Note', 'theme-my-login' ) ?></label> <textarea rows="4" cols="45" name="user_note" id="user_note<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_note' ); ?>"></textarea> </p> <p> <input type="checkbox" name="user_ckb" id="user_ckb<?php $template->the_instance(); ?>" value="<?php $template->the_posted_value( 'user_ckb' ); ?>" /> <label for="user_ckb<?php $template->the_instance(); ?>"><?php _e("Ckb"); ?></label> </p>
on profile-form.php
<tr> <th><label for="user_note"><?php _e( 'Note', 'theme-my-login' ) ?></label></th> <td><textarea rows="4" cols="45" name="user_note" id="user_note" class="input" value="<?php echo esc_attr( $profileuser->user_note ) ?>"></textarea></td> </tr> <tr> <th><label for="user_ckb"><?php _e( 'Ckb', 'theme-my-login' ) ?></label></th> <td><input type="checkbox" name="user_ckb" id="user_ckb" value="<?php echo esc_attr( $profileuser->user_ckb) ?>" /></td> </tr>
on theme-my-login-custom.php
function tml_user_register( $user_id ) { if ( !empty( $_POST['user_note'] ) ) update_user_meta( $user_id, 'user_note', $_POST['user_note'] ); if ( !isset( $_POST['user_ckb'] ) ) update_user_meta( $user_id, 'user_ckb', $_POST['user_ckb'] ); } add_action( 'user_register', 'tml_user_register' );
function tml_edit_user_profile( $profileuser ) { <tr> <th><label for="user_note"><?php _e( 'Note', 'theme-my-login' ) ?></label></th> <td><textarea rows="4" cols="45" name="user_note" id="user_note" value="<?php echo esc_attr( $profileuser->user_note ) ?>"></textarea></td> </tr> <tr> <th><label for="user_ckb"><?php _e( 'Ckb', 'theme-my-login' ) ?></label></th> <td><input type="checkbox" name="user_ckb" id="user_ckb" value="<?php echo esc_attr( $profileuser->user_ckb) ?>" /></td> </tr> } add_action( 'edit_user_profile', 'tml_edit_user_profile' );
Does anyone know where I’m wrong? thanks for the help
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Extra registration fields… checkbox and textarea.’ is closed to new replies.