Last active
December 14, 2017 15:24
-
-
Save dcavins/e3e6a702e35d4f9ec8948c920d8b6c03 to your computer and use it in GitHub Desktop.
Add custom field to registration form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function my_custom_section_registration() { | |
| ?> | |
| <div id="sa-interest-opt-in" class="register-section checkbox"> | |
| <label><input type="text" name="my_custom_input" id="my_custom_input" /> Label text.</label> | |
| </div> | |
| <?php | |
| } | |
| add_action( 'bp_before_registration_submit_buttons', 'my_custom_section_registration' ); | |
| /** | |
| * Update usermeta with custom registration data | |
| * @since 0.1 | |
| */ | |
| function my_custom_registration_fields_handler( $user_id ) { | |
| if ( isset( $_POST['my_custom_input'] ) ) { | |
| // Do something | |
| } | |
| } | |
| add_action( 'bp_core_signup_user', 'my_custom_registration_fields_handler' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment