THIS THREAD HAS BEEN CLOSED.

[tut]Add new fields into the registration form

Updated on Aug 1, 2016 in FreelanceEngine
1 on Jun 28, 2016

This is tutorial to add address field into the registration form with customize code and AE Fields.
Copy template-js/modal-register to freelanceengine-child/template-js/ then add this html code where you want to appearances this field

<div class="form-group">
<label for="repeat_pass"><?php _e('Your address', ET_DOMAIN) ?></label>
<input type="text" class="form-control" id="et_user_adress" name="et_user_adress" placeholder="Type your adress" >
</div>

Add these code into freelanceengine-child/functioins.php file

add_action('ae_after_insert_user', 'cs_save_custom_fields' );
function cs_save_custom_fields( $result ) {
 $user_id = $result->ID;
 $et_user_adress = isset($_REQUEST['et_user_adress']) ? $_REQUEST['et_user_adress'] : '';
 if( ! empty($et_user_adress ) ) {
  update_user_meta( $user_id, 'et_user_adress', $et_user_adress );
  $profile_id = wp_insert_post( array(
   'post_type' => 'fre_profile',
   'post_title' => 'Profressinal title',
   'post_status' => 'publish',
   'post_author' => $user_id )
  );
  if( ! is_wp_error( $profile_id )){
   update_post_meta( $profile_id, 'et_user_adress', $et_user_adress );
  }
 }
}

3) Go to dashboard->Custom fields->Create new field with field name is “et_user_adress”.
Done.

  • Liked by
0 on Aug 1, 2016

Note:

Please make sure you are using AE Custom Fields plugin and added new field with field name is et_user_adress.

it helps this tutorial works properly.

 

 

  • Liked by
Cancel
Loading more replies
Posting & Replying function will be deactivated from 3pm GMT+7 12th Sep.
Read More