handuo Posted February 15, 2023 Share Posted February 15, 2023 Hello! Please help! I have two php files. (WP) One does the registration. (form-login.php) With the other, the registered user can set up a prominent advertiser profile: enter profile url and profile name. (store.php) I would like to merge the two files. That the profile data must also be entered on the registration form. I tried to copy the lines of store.php into the appropriate places, but it doesn't work. The registration runs without an error message, but the "Store Slug / URL" and "Store Name" are not entered into the database. I'm not doing something right. Is it at all possible to request data during registration that can only be provided by registered users? Could you help me with the correct code? Or what should I read, where can I learn about it? Thanks! <?php use Rtcl\Helpers\Functions; use Rtcl\Helpers\Link; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } Functions::print_notices(); ?> <?php do_action( 'rtcl_before_user_login_form' ); ?> <div class="row" id="rtcl-user-login-wrapper"> <div class="col-md-<?php echo ( Functions::is_registration_enabled() && ! Functions::is_registration_page_separate() ) ? "6" : '12'; ?> rtcl-login-form-wrap"> <h2><?php esc_html_e( 'Login', 'classified-listing' ); ?></h2> <form id="rtcl-login-form" class="form-horizontal" method="post"> <?php do_action( 'rtcl_login_form_start' ); ?> <div class="form-group"> <label for="rtcl-user-login" class="control-label"> <?php esc_html_e( 'Username or E-mail', 'classified-listing' ); ?> <strong class="rtcl-required">*</strong> </label> <input type="text" name="username" autocomplete="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" id="rtcl-user-login" class="form-control" required/> </div> <div class="form-group"> <label for="rtcl-user-pass" class="control-label"> <?php esc_html_e( 'Password', 'classified-listing' ); ?> <strong class="rtcl-required">*</strong> </label> <input type="password" name="password" id="rtcl-user-pass" autocomplete="current-password" class="form-control" required/> </div> <?php do_action( 'rtcl_login_form' ); ?> <div class="form-group"> <div id="rtcl-login-g-recaptcha" class="mb-2"></div> <div id="rtcl-login-g-recaptcha-message"></div> </div> <div class="form-group d-flex align-items-center"> <button type="submit" name="rtcl-login" class="btn btn-primary" value="login"> <?php esc_html_e( 'Login', 'classified-listing' ); ?> </button> <div class="form-check"> <input type="checkbox" name="rememberme" id="rtcl-rememberme" value="forever"> <label class="form-check-label" for="rtcl-rememberme"> <?php esc_html_e( 'Remember Me', 'classified-listing' ); ?> </label> </div> </div> <div class="form-group"> <p class="rtcl-forgot-password"> <?php if ( Functions::is_registration_enabled() && Functions::is_registration_page_separate() ): ?> <a href="<?php echo esc_url( Link::get_registration_page_link() ); ?>"><?php esc_html_e( 'Register', 'classified-listing' ); ?></a><span>|</span> <?php endif; ?> <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php esc_html_e( 'Forgot your password?', 'classified-listing' ); ?></a> </p> </div> <?php do_action( 'rtcl_login_form_end' ); ?> </form> </div> <?php if ( Functions::is_registration_enabled() && ! Functions::is_registration_page_separate() ): ?> <div class="col-md-6 rtcl-registration-form-wrap"> <h2><?php esc_html_e( 'Register', 'classified-listing' ); ?></h2> <form id="rtcl-register-form" class="form-horizontal" method="post"> <?php do_action( 'rtcl_register_form_start' ); ?> <div class="form-group"> <label for="rtcl-reg-username" class="control-label"> <?php esc_html_e( 'Username', 'classified-listing' ); ?> <strong class="rtcl-required">*</strong> </label> <input type="text" name="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" autocomplete="username" id="rtcl-reg-username" class="form-control" required/> <span class="help-block"><?php esc_html_e( 'Username cannot be changed.', 'classified-listing' ); ?></span> </div> <div class="form-group"> <label for="rtcl-reg-email" class="control-label"> <?php esc_html_e( 'Email address', 'classified-listing' ); ?> <strong class="rtcl-required">*</strong> </label> <input type="email" name="email" value="<?php echo ( ! empty( $_POST['email'] ) ) ? esc_attr( wp_unslash( $_POST['email'] ) ) : ''; ?>" autocomplete="email" id="rtcl-reg-email" class="form-control" required/> </div> <div class="form-group"> <label for="rtcl-reg-password" class="control-label"> <?php esc_html_e( 'Password', 'classified-listing' ); ?> <strong class="rtcl-required">*</strong> </label> <input type="password" name="password" id="rtcl-reg-password" autocomplete="new-password" class="form-control rtcl-password" required/> </div> <div class="form-group"> <label for="rtcl-reg-confirm-password" class="control-label"> <?php esc_html_e( 'Confirm Password', 'classified-listing' ); ?> <strong class="rtcl-required">*</strong> </label> <div class="confirm-password-wrap"> <input type="password" name="pass2" id="rtcl-reg-confirm-password" class="form-control" autocomplete="off" data-rule-equalTo="#rtcl-reg-password" data-msg-equalTo="<?php esc_attr_e( 'Password does not match.' ); ?>" required/> <span class="rtcl-checkmark"></span> </div> </div> <?php do_action( 'rtcl_register_form' ); ?> <div class="form-group"> <div id="rtcl-registration-g-recaptcha" class="mb-2"></div> <div id="rtcl-registration-g-recaptcha-message"></div> <input type="submit" name="rtcl-register" class="btn btn-primary" value="<?php esc_html_e( 'Register', 'classified-listing' ); ?>"/> </div> <?php do_action( 'rtcl_register_form_end' ); ?> </form> </div> <?php endif; ?> </div> <?php do_action( 'rtcl_after_user_login_form' ); ?> <?php use Rtcl\Helpers\Functions; use Rtcl\Helpers\Link; use Rtcl\Helpers\Text; use RtclStore\Helpers\Functions as StoreFunctions; use RtclStore\Models\Store; use RtclStore\Resources\Options; $max_image_size = Functions::formatBytes(Functions::get_max_upload(), 0); $allowed_image_type = implode(', ', (array) Functions::get_option_item('rtcl_misc_settings', 'image_allowed_type', array('png', 'jpeg', 'jpg'))); ?> <div id="rtcl-store-content-wrap"> <div class="rtcl-store-settings rtcl-store-content" id="rtcl-store-settings-content"> <form id="rtcl-store-settings" class="classima-form" method="post" role="form"> <?php do_action( 'rtcl_store_my_account_form_start', $store ); ?> <div class="classima-form-section classima-form-store-info"> <div class="classified-listing-form-title"> <i class="fa fa-folder-open" aria-hidden="true"></i><h3><?php esc_html_e( 'Store Information', 'classima' ); ?></h3> </div> <div class="row"> <div class="col-sm-3 col-12"> <label class="control-label"><?php esc_html_e( 'Store Slug / URL', 'classima' ); ?></label> </div> <div class="col-sm-9 col-12"> <div class="form-group"> <?php $id = $store ? $store->get_slug() : ''; $storeIdAttr = ( $id ) ? " disabled readonly" : null; ?> <input type="text" name="id" id="rtcl-store-id" value="<?php echo esc_attr( $id ); ?>" class="form-control" required<?php echo esc_attr( $storeIdAttr ); ?>/> <span class="help-block"><?php esc_html_e('This should be unique and you can\'t able to change in future. This will be your store url.', 'classima'); ?></span> </div> </div> </div> <div class="row"> <div class="col-sm-3 col-12"> <label class="control-label"><?php esc_html_e( 'Store Name', 'classima' ); ?></label> </div> <div class="col-sm-9 col-12"> <div class="form-group"> <input type="text" name="name" id="rtcl-store-name" value="<?php echo esc_attr( $store ? $store->get_the_title() : '' ); ?>" class="form-control" required/> </div> </div> </div> <?php $selectedTerm = StoreFunctions::get_store_selected_term_id($store ? $store->get_id() : 0); $selectedTermId = isset($selectedTerm['termId']) ? $selectedTerm['termId'] : []; $parent = isset($selectedTerm['parent']) ? $selectedTerm['parent'] : []; $childTerm = !empty($selectedTermId) ? end($selectedTermId) : 0; $storeTerms = StoreFunctions::get_store_category(); ?> </div> <?php do_action( 'rtcl_store_my_account_form_end', $store ); ?> <div class="row"> <div class="col-sm-3 col-12"></div> <div class="col-sm-9 col-12"> <div class="form-group"> <input type="submit" name="submit" class="btn rtcl-submit-btn" value="<?php esc_html_e( 'Update Store', 'classima' ); ?>" /> </div> </div> </div> </form> <div class="rtcl-response"></div> </div> </div> Quote Link to comment https://forums.phpfreaks.com/topic/315918-how-to-two-php-files-merge-pls/ Share on other sites More sharing options...
requinix Posted February 15, 2023 Share Posted February 15, 2023 This is just the code that shows the form. You'd also have to deal with the code that handles the (merged) form - to make sure it understands the new fields that are being included. There's also the possibility the merged HTML isn't correct, so you should also post what you came up with for that. 1 Quote Link to comment https://forums.phpfreaks.com/topic/315918-how-to-two-php-files-merge-pls/#findComment-1605735 Share on other sites More sharing options...
handuo Posted February 16, 2023 Author Share Posted February 16, 2023 18 hours ago, requinix said: This is just the code that shows the form. You'd also have to deal with the code that handles the (merged) form - to make sure it understands the new fields that are being included. There's also the possibility the merged HTML isn't correct, so you should also post what you came up with for that. Thank you very much for your question requinix. Very helpful, I think I understand where I need to learn and understand next I am thinking. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/315918-how-to-two-php-files-merge-pls/#findComment-1605767 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.