Skip to content

Instantly share code, notes, and snippets.

@dcavins
Last active December 14, 2017 15:24
Show Gist options
  • Select an option

  • Save dcavins/e3e6a702e35d4f9ec8948c920d8b6c03 to your computer and use it in GitHub Desktop.

Select an option

Save dcavins/e3e6a702e35d4f9ec8948c920d8b6c03 to your computer and use it in GitHub Desktop.
Add custom field to registration form.
<?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