There are 2 profile builder plugins + Cimy User Extra Fields. Cimy User Extra Fields adds its fields to the registration (standard). How to do what they got into the profile builde? The bottom line is that I need to register in a pop-up window with my fields. While it does not work.

    1 answer 1

    You can simplify your task. You can make a pop-up window with your own means and add fields by adding a bit of code.

    I use bootstrap (but you can search for other options on the Internet how to make a pop-up form). If you use bootstrap, plug it in css and js.

    Popup form:

    <?php if (is_user_logged_in()): ?> <p><a href="<?php echo wp_logout_url( home_url() ); ?>">Выйти</a></p> <?php endif ?> <?php if (!(is_user_logged_in())): ?> <p><a data-toggle="modal" data-target="#myModal" href="http://4eizmerenie.ru/wp-login.php">Войти</a></p> <?php endif ?> 

    Below is the form code itself:

     <div class="modal fade" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Modal title</h4> </div> <div class="modal-body"> <p>One fine body&hellip;</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> 

    (taken from here: http://getbootstrap.com/javascript/#modals )

    Now for the additional fields: the WP documentation itself says how to add (the code is quite working): https://codex.wordpress.org/Customizing_the_Registration_Form

    Those. add to the file funtions.php (well, correcting the desired field name):

     //1. Add a new form element... add_action( 'register_form', 'myplugin_register_form' ); function myplugin_register_form() { $first_name = ( ! empty( $_POST['first_name'] ) ) ? trim( $_POST['first_name'] ) : ''; ?> <p> <label for="first_name"><?php _e( 'First Name', 'mydomain' ) ?><br /> <input type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr( wp_unslash( $first_name ) ); ?>" size="25" /></label> </p> <?php } //2. Add validation. In this case, we make sure first_name is required. add_filter( 'registration_errors', 'myplugin_registration_errors', 10, 3 ); function myplugin_registration_errors( $errors, $sanitized_user_login, $user_email ) { if ( empty( $_POST['first_name'] ) || ! empty( $_POST['first_name'] ) && trim( $_POST['first_name'] ) == '' ) { $errors->add( 'first_name_error', __( '<strong>ERROR</strong>: You must include a first name.', 'mydomain' ) ); } return $errors; } //3. Finally, save our extra registration user meta. add_action( 'user_register', 'myplugin_user_register' ); function myplugin_user_register( $user_id ) { if ( ! empty( $_POST['first_name'] ) ) { update_user_meta( $user_id, 'first_name', trim( $_POST['first_name'] ) ); } }