impresspages / ImpressPages

ImpressPages is php framework with admin panel. Build functional website in one hour.
http://www.impresspages.org
Other
502 stars 175 forks source link

How to connect sign up and login form to plugin 'user'? #873

Closed heervandijk closed 6 years ago

heervandijk commented 6 years ago

My first comment on Github, so don't shoot me...

I have been spending days to get new stuff going for my website. Bought some new plugins from IMP market and got additional scripts. One of those is a modal pop up sign up form for example. I am scratching my head on getting the form to submit the data as the regular login form does.

Apart from getting it to work, I would like to learn how it works. Have been doing some trial and error like crazy and google was not of help either.

Any help is appreciated.

This is the code from /Plugin/Usermanager/FormModel.php (below modal form)

`public static function registrationForm () { $form = new \Ip\Form(); $form->setEnvironment(\Ip\Form::ENVIRONMENT_PUBLIC); $form->addClass('ipsUserRegistrationForm');

$field = new Checkbox([ 'name' => 'accept-tos', 'label' => 'I accept and understand the Terms of Use and the Privacy Policy', ]); $field->addValidator('Required'); $form->addField($field);

$field = new \Ip\Form\Field\Hidden( array( 'name' => 'sa', // HTML "name" attribute 'value' => 'UserManager.register', )); $form->addField($field);

$builder = new FormBuilder($form); $builder ->addFields([ 'firstname' => 'First name', 'lastname' => 'Last name', ], true) ->addFields(['email' => 'Email'], true, ['Email']);

$field = new \Ip\Form\Field\Password( array( 'name' => 'password', // HTML "name" attribute 'label' => __('Password', 'UserManager', false) // Field label that will be displayed next to input field )); $field->addAttribute('autocomplete', 'off'); $field->addvalidator('Required'); $form->addField($field);

$field = new \Ip\Form\Field\Password( array( 'name' => 'password_confirmation', // HTML "name" attribute 'label' => __('Password (confirmation)', 'UserManager', false) // Field label that will be displayed next to input field )); $field->addAttribute('autocomplete', 'off'); $field->addvalidator('Required'); $field->addValidator(PasswordConfirmationValidator::class); $form->addField($field);

$field = new \Ip\Form\Field\Captcha( array( 'name' => 'captcha', // HTML "name" attribute 'label' => __('Prove you are a human', 'UserManager', false) // Field label that will be displayed next to input field )); $field->addvalidator('Required'); $form->addField($field);

$form = ipFilter('User_registrationForm', $form);

$field = new \Ip\Form\Field\Submit( array( 'name' => 'register', // HTML "name" attribute 'value' => __('SIGN UP', 'UserManager', false) // Field label that will be displayed next to input field )); $form->addField($field);

$form = ipFilter('User_registrationForm2', $form);

return $form; } `

This is the modal form as it is originally. `

<a data-toggle="modal" href="#rbm_sign_up" class="rbm_modal_trigger" data-backdrop="true">sign up</a>

<!-- End of Trigger Part -->

<!-- Responsive Bootstrap Modal Popup -->
<div id="rbm_sign_up" class="modal fade rbm_modal rbm_form_general rbm_size_signup rbm_center rbm_bd_semi_trnsp rbm_bd_black rbm_bg_white rbm_blue rbm_none_radius rbm_shadow_lg_black rbm_animate rbm_duration_md rbmFadeInDown rbm_easeOutQuint" role="dialog">

    <!-- Modal Dialog-->
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">

            <!-- Modal Header-->
            <div class="rbm_form_header">
                <a href="#" class="rbm_btn_x_out_shtr" data-dismiss="modal"><span class="fa fa-times"></span></a>
                <!-- Modal Title-->
                <h3>sign up</h3>
            </div>
            <!-- /Modal Header-->

            <!-- Modal Body-->
            <div class="rbm_form_body">
                <!-- Form-->
                <form action="#" method="#">
                    <div class="rbm_input_inline">
                        <div class="rbm_input_txt">
                            <label for="first_name">first name</label>
                            <input type="text" id="first_name" placeholder="first name" required>
                        </div>
                        <div class="rbm_input_txt">
                            <label for="last_name">last name</label>
                            <input type="text" id="last_name" placeholder="last name" required>
                        </div>
                    </div>
                    <div class="rbm_input_txt">
                        <label for="signup_email">email</label>
                        <input type="email" id="signup_email" placeholder="enter your email" required>
                    </div>
                    <div class="rbm_input_txt">
                        <label for="signup_pwd">password</label>
                        <input type="password" id="signup_pwd" placeholder="password" required>
                    </div>
                    <div class="rbm_input_txt">
                        <label for="signup_cpwd">confirm your password</label>
                        <input type="password" id="signup_cpwd" placeholder="confirm your password" required>
                    </div>
                    <div class="rbm_radio">
                        <div>
                            <input type="radio" name="radio_btn">
                            <span></span>
                        </div>
                        <label>male</label>
                    </div>
                    <div class="rbm_radio">
                        <div>
                            <input type="radio" name="radio_btn">
                            <span></span>
                        </div>
                        <label>female</label>
                    </div>
                    <div class="rbm_form_submit">
                        <button type="submit" class="rbm_btn_x_out_shtr">sign up</button>
                    </div>
                </form>
                <!-- /Form-->   
            </div>
            <!-- /Modal Body-->

        </div> <!-- /Modal content-->
    </div> <!-- /Modal Dialog-->
</div> <!-- .modal -->
<!-- End Responsive Bootstrap Modal Popup -->`
jankus commented 6 years ago

If these come from plugins or other scripts (as you've mentioned), contact authors directly. It's hard to comment on code we have no control or experience over.