使用自定义表单buddypress注册时无法在数据库中存储用户数据

时间:2018-07-06 06:58:04

标签: php html wordpress css3 buddypress

我创建了自己的注册表格,以代替buddypress的注册表格。我在buddypress中编辑register.php文件。我有约束,无法将数据存储到数据库。是否缺少任何内容,因此提交后不会保存数据。 这里是原始文件registration.php

<div class="register-section eight columns" id="profile-details-section">

                <!-- <h4><i class="icon icon-comments"></i> <?php _e( 'Profile Details', 'buddypress' ); ?></h4> -->

                <?php /* Use the profile field loop to render input fields for the 'base' profile field group */ ?>
                <?php if ( bp_is_active( 'xprofile' ) ) : if ( bp_has_profile( array( 'profile_group_id' => 1, 'fetch_field_data' => false ) ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

                <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
                <div class="twelve columns">
                    <div<?php bp_field_css_class( 'editfield' ); ?>>
                        <fieldset>

                        <?php
                        $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
                        $field_type->edit_field_html();

                        /**
                         * Fires before the display of the visibility options for xprofile fields.
                         *
                         * @since 1.7.0
                         */
                        do_action( 'bp_custom_profile_edit_fields_pre_visibility' );

                        if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
                            <p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>"><span id="<?php bp_the_profile_field_input_name(); ?>-2">
                                <?php
                                printf(
                                    __( 'This field can be seen by: %s', 'buddypress' ),
                                    '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
                                );
                                ?>
                                </span>
                                <button type="button" class="visibility-toggle-link" aria-describedby="<?php bp_the_profile_field_input_name(); ?>-2" aria-expanded="false"><?php _ex( 'Change', 'Change profile field visibility level', 'buddypress' ); ?></button>
                            </p>

                            <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
                                <fieldset>
                                    <legend><?php _e( 'Who can see this field?', 'buddypress' ) ?></legend>

                                    <?php bp_profile_visibility_radio_buttons() ?>

                                </fieldset>
                                <button type="button" class="field-visibility-settings-close"><?php _e( 'Close', 'buddypress' ) ?></button>

                            </div>
                        <?php else : ?>
                            <p class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
                                <?php
                                printf(
                                    __( 'This field can be seen by: %s', 'buddypress' ),
                                    '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
                                );
                                ?>
                            </p>
                        <?php endif ?>

                        <?php

                        /**
                         * Fires after the display of the visibility options for xprofile fields.
                         *
                         * @since 1.1.0
                         */
                        do_action( 'bp_custom_profile_edit_fields' ); ?>

                        </fieldset>
                    </div>
                </div>

                <?php endwhile; ?>

                <input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_field_ids(); ?>" />

                <?php endwhile; endif; endif; ?>

                <?php

                /**
                 * Fires and displays any extra member registration xprofile fields.
                 *
                 * @since 1.9.0
                 */
                do_action('bp_signup_profile_fields' ); ?>

            </div><!-- #profile-details-section -->
            </div>

以及我的自定义注册表格:

                <div class="tab">
                <div class="row form-group">
                    <div class="six columns">
                    <input type="text" class="input-form-regis" name="field_1" placeholder="First Name">
                    </div>
                    <div class="six columns">
                    <input type="text" class="input-form-regis" name="field_229" placeholder="Last Name">
                    </div>
                </div>
                <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold">Gender</label>
                </div>
                <div class="nine columns">
                  <input type="radio" name="field_3" value="Man"> <span class="text-bold">Man</span>
                  <input type="radio" name="field_3" value="Woman"> <span class="text-bold">Woman</span>
                </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold label-custome">Date of birth</label>
                </div>
                <div class="three columns">
                  <input type="text" class="input-form-regis" name="field_351" placeholder="Birtplace"> 
                </div>
                <div class="four columns pull-left">
                  <input type="text" class="input-form-regis" name="field_2" placeholder="Date of birth">
                </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold label-custome">Height and weight</label>
                </div>
                <div class="three columns">
                  <input type="text" class="input-form-regis" name="field_303" placeholder="Height"><span class="label-satuan">cm</span>
                </div>
                <div class="three columns pull-left">
                  <input type="text" class="input-form-regis" name="field_304" placeholder="Weight"><span class="label-satuan">kg</span>
                </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold label-custome">Address</label>
                </div>
                <div class="six columns pull-left">
                  <input type="text" class="input-form-regis" name="field_305" placeholder="Address"> 
                </div>
              </div>
              <div class="row form-group form-address">
                <div class="three columns">
                </div>
                <div class="three columns form-address">
                  <input type="text" class="input-form-regis" name="field_306" placeholder="District"> 
                </div>
                <div class="three columns pull-left form-address">
                  <input type="text" class="input-form-regis" name="field_307" placeholder="Village">
                </div>
              </div>
              <div class="row form-group form-address">
                <div class="three columns">
                </div>
                <div class="three columns form-address pull-left">
                  <input type="text" class="input-form-regis" name="field_308" placeholder="Postal code"> 
                </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold label-custome">Phone number</label>
                </div>
                <div class="six columns pull-left">
                  <input type="text" class="input-form-regis" name="field_309" placeholder="Phone number"> 
                </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold label-custome">ID card number</label>
                </div>
                <div class="six columns pull-left">
                  <input type="text" class="input-form-regis" name="field_310" placeholder="ID card number"> 
                </div>
              </div>
              <div class="row form-group form-address">
                <div class="three columns">
                <label class="text-bold label-custome">Last education</label>
                </div>
                <div class="three columns ">
                  <div class="styled-select-reg">
                  <select  class="input-form-reg" name="field_311" >
                    <option selected value>Select education level</option>
                    <option value="Bachelor degree">Bachelor degree</option>
                  </select>
                  </div>
                </div>
                <div class="five columns pull-left ">
                  <input type="text" class="input-form-regis" name="field_312" placeholder="Name of the institution">
                </div>
              </div>
                <div class="row form-group">
                  <div class="three columns">
                    <label class="text-bold">Religion</label>
                  </div>
                  <div class="nine columns">
                    <input type="radio" name="field_316"> <span class="text-bold">Inslam</span>
                    <input type="radio" name="field_316"> <span class="text-bold">Christian</span>
                    <input type="radio" name="field_316"> <span class="text-bold">Catholic</span>
                    <input type="radio" name="field_316"> <span class="text-bold">Hindu</span>
                    <input type="radio" name="field_316"> <span class="text-bold">Buddha</span>
                  </div>
                </div>

              <div class="row form-group">
                  <div class="three columns">

                  </div>
                  <div class="nine columns form-address text-left">
                    <input type="radio" name="field_316"> <span class="text-bold">Kong Hu Cu</span>
                    <input type="radio" name="field_316"> <span class="text-bold">Believe in the omnipotent god</span>
                  </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold label-custome">Ethnic</label>
                </div>
                <div class="six columns pull-left">
                  <input type="text" class="input-form-regis" name="field_352" placeholder="Ethnic"> 
                </div>
              </div>
              <div class="row form-group">
                <div class="eleven columns">
                  <button type="button" id="nextBtn" onclick="nextPrev(1)" class="btn btn-next-form pull-right">NEXT</button>
                </div>
              </div>
            </div>
            <!-- next tab -->
            <div class="tab">
            <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold">Job</label>
                </div>
                <div class="nine columns">
                  <input type="radio" name="field_324"> <span class="text-bold">Employees</span>
                  <input type="radio" name="job"> <span class="text-bold">Entrepreneur</span>
                </div>
              </div>
              <div class="row form-group">
                  <div class="three columns">
                    <label class="text-bold label-custome">Company name</label>
                  </div>
                  <div class="six columns pull-left">
                    <input type="text" class="input-form-regis" name="field_327" placeholder="Company name"> 
                  </div>
              </div>
              <div class="row form-group">
                  <div class="three columns">
                  </div>
                  <div class="six columns pull-left form-address">
                    <input type="text" class="input-form-regis" name="field_328" placeholder="Position"> 
                  </div>
              </div>
              <div class="row form-group">
                  <div class="three columns">
                    <label class="text-bold label-custome">Hobby</label>
                  </div>
                  <div class="six columns pull-left">
                    <input type="text" class="input-form-regis" name="field_329" placeholder="Hobby"> 
                  </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold">Smoke</label>
                </div>
                <div class="nine columns">
                  <input type="radio" name="field_334" value="Yes"> <span class="text-bold">Yes</span>
                  <input type="radio" name="field_334" value="No"> <span class="text-bold">No</span>
                </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold">Favorite</label>
                </div>
                <div class="nine columns">
                  <input type="checkbox" name="field_337" value="Meal"> <span class="text-bold">Meal</span>
                  <input type="checkbox" name="field_337" value="Music"> <span class="text-bold">Music</span>
                  <input type="checkbox" name="field_337" value="Sport"> <span class="text-bold">Sport</span>
                  <input type="checkbox" name="field_337" value="Book"> <span class="text-bold">Book</span>
                </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold">Pet</label>
                </div>
                <div class="two columns">
                  <input type="radio" name="field_342" value="Yes"> <span class="text-bold">Yes</span>
                  <input type="radio" name="field_342" value="No"> <span class="text-bold">No</span>
                </div>
                <div class="three columns pull-left">
                    <input type="text" class="input-form-regis" name="field_345" placeholder="Pet"> 
                  </div>
              </div>
              <div class="row form-group">
                  <div class="three columns">
                    <label class="text-bold label-custome">About me</label>
                  </div>
                  <div class="six columns pull-left">
                    <textarea class="input-form-regis" name="field_353"></textarea> 
                  </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold">Status</label>
                </div>
                <div class="six columns pull-left">
                  <input type="radio" name="field_9" value="Single"> <span class="text-bold">Single</span>
                  <input type="radio" name="field_9" value="Divorced"> <span class="text-bold">Divorced</span>
                  <input type="radio" name="field_9" value="Deat divorced"> <span class="text-bold">Death divorced</span>
                </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                <label class="text-bold label-custome">Number of children</label>
                </div>
                <div class="four columns pull-left">
                  <div class="styled-select-reg">
                  <select  class="input-form-reg" name="field_350" >
                    <option selected value>Select</option>
                    <option value="0">0</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                  </select>
                  </div>
                </div>
              </div>
              <div class="row form-group">
                  <div class="three columns">
                    <label class="text-bold label-custome">Age</label>
                  </div>
                  <div class="three columns">
                    <label class="text-bold label-custome label-child">Child</label>
                  </div>
                  <div class="two columns pull-left">
                    <input type="text" class="input-form-regis" name="field_357" placeholder="Age"> 
                  </div>
              </div>
              <div class="row form-group">
                <div class="three columns">
                  <label class="text-bold">Child Status</label>
                </div>
                <div class="four columns pull-left">
                  <input type="radio" name="field_354" value="Biological"> <span class="text-bold">Biological children</span>
                  <input type="radio" name="field_354" value="Adopted"> <span class="text-bold">Adopted children</span>

                </div>
              </div>
              <!-- button finish -->
              <div class="row form-group">
                <div class="nine columns">
                  <!-- <button type="submit" id="nextBtn" onclick="nextPrev(1)" class="btn btn-next-form pull-right">FINISH</button> -->
                  <input type="submit" name="signup_submit" id="signup_submit" class="btn btn-next-form pull-right" value="<?php esc_attr_e( 'FINISH', 'buddypress' ); ?>" />
                </div>
              </div>
            </div>

请帮助我的主人。谢谢:)

0 个答案:

没有答案