Forum Replies Created
-
In reply to: bbPress User Profile Manipulation
Thank you again for your time on this. I’m not a coder, and I don’t really feel like I have any idea what I’m doing here. But I tried to follow your instructions. Here’s what I did:
1. I downloaded the functions.php file from my theme folder and opened it to edit in Notepad++
2. I inserted the code you have above and then did a find/replace. I found first_name and replaced it with rpi_label1. I did the same for last_name and rpi_label2
3. Here is the resulting code://* Code addition for bbP Profile Information Plugin add_action(‘register_form’,’myplugin_register_form’); function myplugin_register_form (){ $rpi_label1 = ( isset( $_POST[‘rpi_label1’] ) ) ? $_POST[‘rpi_label1’]: ”; $rpi_label2 = ( isset( $_POST[‘rpi_label2’] ) ) ? $_POST[‘rpi_label2’]: ”; ?> <p> <label for=”rpi_label1”><?php _e(‘First Name as people call you eg Dave’,’mydomain’) ?><br /> <input type=”text” name=”rpi_label1” id=”rpi_label1” class=”input” value=”<?php echo esc_attr(stripslashes($rpi_label1)); ?>” size=”25″ /></label> </p> <p> <label for=”rpi_label2”><?php _e(‘Last Name’,’mydomain’) ?><br /> <input type=”text” name=”rpi_label2” id=”rpi_label2” class=”input” value=”<?php echo esc_attr(stripslashes($rpi_label2)); ?>” size=”25″ /></label> </p> <?php } add_filter(‘registration_errors’, ‘myplugin_registration_errors’, 10, 3); function myplugin_registration_errors ($errors, $sanitized_user_login, $user_email) { if ( empty( $_POST[‘rpi_label1’] ) ) $errors->add( ‘rpi_label1_error’, __(‘ERROR: You must include a first name.’,’mydomain’) ); if ( empty( $_POST[‘rpi_label2’] ) ) $errors->add( ‘rpi_label2_error’, __(‘ERROR: You must include a last name.’,’mydomain’) ); return $errors; } add_action(‘user_register’, ‘myplugin_user_register’); function myplugin_user_register ($user_id) { if ( isset( $_POST[‘rpi_label1’] ) ) update_user_meta($user_id, ‘rpi_label1’, $_POST[‘rpi_label1’]); if ( isset( $_POST[‘rpi_label2’] ) ) update_user_meta($user_id, ‘rpi_label2’, $_POST[‘rpi_label2’]); }
Unfortunately it doesn’t seem to be working. I got an error code that reads:
Parse error: syntax error, unexpected ‘Name’ (T_STRING) in functions.php on line 119Line 119 reads:
<label for=”rpi_label1”><?php _e(‘First Name as people call you eg Dave’,’mydomain’) ?><br />
Any further help you can provide would be really appreciated.
In reply to: bbPress User Profile ManipulationThought you said you hated code?!! 🙂
Have you a specific registration template in mind, does your theme come with something?
Ha no I don’t hate code! I’m just not any good at it yet. I’m using the Genesis Enterprise Pro theme.
Here’s what I tried:
1. Created a page and dropped the [bbp-register] shortcode into it.
2. Copied the form-user-register.php file into the bbpress directory in my theme folder
3. I added this form of code for each of the four rpi_label classes:`<div class=”rpi_label1″>
<label for=”rpi_label1″><?php _e( ‘Class’, ‘bbpress’ ); ?>: </label>
<input type=”text” name=”rpi_label1″ value=”<?php bbp_sanitize_val( ‘rpi_label1’ ); ?>” size=”20″ id=”rpi_label1″ tabindex=”<?php bbp_tab_index(); ?>” />
</div>
…for this one it’s an input field for the Class of my userAm I on the right track? The data entered doesn’t seem to be making it into the user database. After filling out the registration form for a test user…then going to edit the user…the data isn’t listed.
Thanks!
In reply to: bbPress User Profile ManipulationThanks so much! I love your plugin. A followup question, I’d like to include your fields in the registration template. It looks like they’re called rpi_label1, etc. Any thoughts on how to do this?
In reply to: bbPress User Profile ManipulationThanks! I’m looking forward to reading your reply.