Please use this code in your child theme’s functions.php file
function whoop_add_signup_form_fields() {
?>
<div class="row_spacer_registration clearfix">
<div class="form_row clearfix">
<input placeholder='Company Name' type="text" name="company"
id="company" class="textfield input-text" value="" size="25"/>
<span id="company_info"></span>
</div>
</div>
<?php
}
add_action('social_connect_form', 'whoop_add_signup_form_fields', 1);
function whoop_check_signup_form_errors($errors) {
$company = esc_sql(sanitize_text_field($_POST['company']));
if ($company == '') {
$errors->add('empty_company', __('ERROR: Please enter your company name.', 'geodirectory'));
}
return $errors;
}
add_filter('registration_errors', 'whoop_check_signup_form_errors');
function whoop_insert_signup_extra_fields($user_id) {
$company = esc_sql(sanitize_text_field($_POST['company']));
update_user_meta($user_id, 'company', $company);
}
add_action('geodir_user_register', 'whoop_insert_signup_extra_fields');
add_action( 'show_user_profile', 'whoop_extra_profile_fields' );
add_action( 'edit_user_profile', 'whoop_extra_profile_fields' );
function whoop_extra_profile_fields( $user ) { ?>
<h3>Extra profile information</h3>
<table class="form-table">
<tr>
<th><label for="company">Company</label></th>
<td>
<input type="text" name="company" id="company" value="<?php echo esc_attr( get_the_author_meta( 'company', $user->ID ) ); ?>" class="regular-text" /><br />
<span class="description">Please enter your Company name.</span>
</td>
</tr>
</table>
<?php }
add_action( 'personal_options_update', 'whoop_save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'whoop_save_extra_profile_fields' );
function whoop_save_extra_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) )
return false;
update_user_meta( $user_id, 'company', $_POST['company'] );
}