Support » Plugin: Membership 2 » Add fields (terms) to “?payment-table”

  • Resolved NixXxon23

    (@nixxxon23)



    Hi,

    thanks for the great Plugin I’m going to buy the pro Version when i go live but first i wanna make sure it works like expected.

    What i try to accomplish is to add the terms to the 2nd chechout page. I can display them but they are not submitted of validated (of course).

    I wonder if your devs have an easy solution / hook to check for some fields on the “payment-table-step”.

    Just to make it easyier for you to help. At the moment I insert the fields with the code below. Don’t know if that’s OK?!

    <?php if (is_page('registrieren')) {
          if( isset( $_POST['membership_id'] ) && $_POST['membership_id'] != '' ) { ?>
    	<?php }elseif( $_REQUEST['step'] == 'payment_table' ) { ?>
    <script>
    jQuery(document).ready(function($) {
    var entry = '<input class="wpmui-field-input wpmui-text  wpmui-input-datens" type="checkbox" id="datens" name="datens" value="akzeptiert" required="" aria-required="true">';
    $(entry).insertBefore( ".wpmui-input-wrapper" );
    });
    </script>
    <?php }} ?>
    

    THANK YOU! And best,
    Niko

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Oguz – WPMU DEV Support

    (@wpmudev-support8)

    Hey @nixxxon23,

    Hope you’re well.

    There is no easy way to implement this. If you don’t want to save anything into database maybe the putting checkbox through JS and checking again through JS when user trying to submit form is the easiest solution.

    But if you are trying to make it more solid you need a developer and custom coding about it. Probably you should play with /membership/app/view files (especially frontend views) to implement that.

    Cheers,
    Oguz

    Hi,
    thanks for you quick reply! Tried it with JS and well yes it work’s but as you mentioned it’s not really solid and leads into other issues.

    Do you know if there is an easy way to include the whole “payment-table” step below the registration form? This would also solve my problem.

    I already have a custom template for the registration form template.

    `<div class=”entry-text”>
    <h4>Die Registrierung dauert nur 2 Minuten. Nach dem Ausfüllen der Felder wird sofort Ihr Benutzerkonto erstellt.</h4>
    <p>Mit * gekennzeichnete Felder sind Pflichtfelder!</p>
    </div>
    <div class=”left fusion-one-half fusion-layout-column fusion-spacing-yes”>
    <?php if ( is_ms_registration_form_title_exists() ) : ?>
    <legend><?php echo get_ms_registration_form_title(); ?></legend>
    <?php endif; ?>

    <?php
    echo get_ms_registration_form_fields();
    echo ‘</div><div class=”right fusion-one-half fusion-layout-column fusion-column-last fusion-spacing-yes”><div class=”ms-extra-fields”>’;
    /**
    * Trigger default WordPress action to allow other plugins
    * to add custom fields to the registration form.
    *
    * signup_extra_fields Defined in wp-signup.php which is used
    * for Multisite signup process.
    *
    * register_form Defined in wp-login.php which is only used for
    * Single site registration process.
    *
    * @since 1.0.0
    */
    ms_registration_form_extra_fields();
    ?>

    <!– Adding firma field here –>
    <?php $firma = isset($_POST[‘firma’]) ? $_POST[‘firma’] : get_user_meta(get_current_user_id(), ‘ms_firma’, true); ?>
    <div class=”ms-form-element ms-form-element-firma”>
    <span class=”wpmui-wrapper wpmui-input-wrapper “>
    <label for=”firma” class=”wpmui-field-label wpmui-label-firma”>Firma </label>
    <input class=”wpmui-field-input wpmui-text wpmui-input-firma” type=”text” id=”firma” name=”firma” value=”<?php echo $firma ?>”>
    </span>
    </div>
    <!– Adding firma field here/End –>

    <!– Adding adresse field here –>
    <?php $adresse = isset($_POST[‘adresse’]) ? $_POST[‘adresse’] : get_user_meta(get_current_user_id(), ‘ms_adresse’, true); ?>
    <div class=”ms-form-element ms-form-element-adresse”>
    <span class=”wpmui-wrapper wpmui-input-wrapper “>
    <label for=”adresse” class=”wpmui-field-label wpmui-label-adresse”>Adresse *</label>
    <input class=”wpmui-field-input wpmui-text wpmui-input-adresse” type=”text” id=”adresse” name=”adresse” value=”<?php echo $adresse ?>” required=”” aria-required=”true” minlength=”3″ maxlength=”25″ pattern=”[A-Za-z]”>
    </span>
    </div>
    <!– Adding adresse field here/End –>

    <!– Adding plz field here –>
    <?php $plz = isset($_POST[‘plz’]) ? $_POST[‘plz’] : get_user_meta(get_current_user_id(), ‘ms_plz’, true); ?>
    <div class=”ms-form-element ms-form-element-plz”>
    <span class=”wpmui-wrapper wpmui-input-wrapper “>
    <label for=”plz” class=”wpmui-field-label wpmui-label-plz “>Postleitzahl *</label>
    <input class=”wpmui-field-input wpmui-text wpmui-input-plz number” type=”number” id=”plz” name=”plz” value=”<?php echo $plz ?>” required=”” aria-required=”true” minlength=”4″ maxlength=”8″ pattern=”\d*”/>
    </span>
    </div>
    <!– Adding plz field here/End –>

    <!– Adding ort field here –>
    <?php $ort = isset($_POST[‘ort’]) ? $_POST[‘ort’] : get_user_meta(get_current_user_id(), ‘ms_ort’, true); ?>
    <div class=”ms-form-element ms-form-element-ort”>
    <span class=”wpmui-wrapper wpmui-input-wrapper “>
    <label for=”ort” class=”wpmui-field-label wpmui-label-ort”>Ort *</label>
    <input class=”wpmui-field-input wpmui-text wpmui-input-ort” type=”text” id=”ort” name=”ort” value=”<?php echo $ort ?>” required=”” aria-required=”true” data-pattern-error=”Bitte nur Buchstaben benutzten!” pattern=”[A-z ‘]*”>
    </span>
    </div>
    <!– Adding ort field here/End –>

    <!– Adding telephone field here –>
    <?php $phone = isset($_POST[‘telephone’]) ? $_POST[‘telephone’] : get_user_meta(get_current_user_id(), ‘ms_telephone’, true); ?>
    <div class=”ms-form-element ms-form-element-telephone”>
    <span class=”wpmui-wrapper wpmui-input-wrapper “>
    <label for=”telephone” class=”wpmui-field-label wpmui-label-telephone “>Telefon </label>
    <input class=”wpmui-field-input wpmui-text wpmui-input-telephone number” type=”number” id=”telephone” name=”telephone” value=”<?php echo esc_attr( $phone ); ?>” pattern=”\d*”/>
    </span>
    </div>
    <!– Adding telephone field here/End –>

    <!– Adding hidden AGB field here –>
    <input class=”wpmui-field-input wpmui-text wpmui-input-agb” type=”hidden” id=”agb” name=”agb” value=”akzeptiert” required=”” aria-required=”true” checked>

    <!– Adding agb field here/End –>

    <!– Adding haftung field here –>
    <input class=”wpmui-field-input wpmui-text wpmui-input-haftung” type=”hidden” id=”haftung” name=”haftung” value=”akzeptiert” required=”” aria-required=”true” checked>

    <!– Adding hidden haftung field here/End –>

    <!– Adding datens field here –>
    <input class=”wpmui-field-input wpmui-text wpmui-input-datens” type=”hidden” id=”datens” name=”datens” value=”akzeptiert” required=”” aria-required=”true” checked>
    <!– Adding hidden datens field here/End –>

    <?php
    echo ‘</div></div>’;
    echo get_ms_registration_form_register_button();

    /**
    * This hook is intended to output hidden fields or JS code
    * at the end of the form tag.
    *
    * @since 1.0.1.0
    */
    do_action( ‘ms_shortcode_register_form_end’, ms_registration_form_obj() );
    ?>
    <br><br>
    <?php
    if ( is_ms_registration_form_login_link_exists() ) {
    echo get_ms_registration_form_login_link();
    }

    Sorry, I’m no able edit / delete my last post –> feel free to ignore it!

    One last question I’m sure there is an action hook for sending emails?

    I need to send the welcome mail not after registration complete but after “ms_view_frontend_payment_purchase_button” is submitted.

    Thank you a lot,
    Niko

    Plugin Support Oguz – WPMU DEV Support

    (@wpmudev-support8)

    Hey @nixxxon23,

    I hope you’re well today!

    Sorry for late response, I didn’t understand exactly what are you trying to ask. But if you want to send an email when the user made a payment for membership, there is an option for that at Membership 2 > Settings > Automated Email Responses page.

    I hope that helps!

    Cheers,
    Oguz

    Hi,…

    thank you for you response!
    I think i have different issues. Unfortunatly I’m not a native english speaker which makes it not easier for me to describe, but i’ll try.

    Solution 1: Enable default Mailtemplate (“Signup – User Account Created”) -> Works, BUT fires to early for my use-case (I need it to be send AFTER the step payment-table is completed / finished)

    Solution 2: Custom E-Mail with phpmail –> Works fine BUT no chance to get the password variable in my mail. –> I want it like (Your user: XXX – Your password: XXX)

    Solution 3: Enable default Mailtemplate -> “Subscription – Completed with payment”: Also no password-variable available AND it doesn’t send if a user abborts at the payment step or in my case uses “manual payment gateway”, because the payment isn’t completet then.

    So none of these solutions work for me. At least not perfect.

    My next try would be to save the decryptet password variable in the registration step to another variable to output it in my custom mail later after the payment-table step. –> Not really nice but i think my last hope?! And i don’t know how to output the decryptet passwort, yet.

    Best regards and thanks again for your support!
    Niko

    Plugin Support Oguz – WPMU DEV Support

    (@wpmudev-support8)

    Hey @nixxxon23,

    First thing first 🙂 WordPress keeps passwords hashed so calling from the database is not an option for passwords. You can keep the password on cookies maybe (or sessions or another option for users in the database), but I don’t understand why are you trying to send the password to the user. It’s not a safe way, even you’re not exposed passwords if user’s email hacked someone can see that password easily.

    So when we remove password section Solution 2 or 3 is good for you. But if you want to keep trying maybe this link can help more to usage of cookies; https://premium.wpmudev.org/blog/set-get-delete-cookies/

    Please let me know if anything else that I can help.

    Cheers,
    Oguz

    Hi,

    thanks! I KNOW! And if it was my site i would never ever code it but sometimes you have to fullfill wishes also if you do not agree.

    I managed to do it like that – in my mu-plugin (just in case someone in the future needs it):

    add_action( 'ms_model_member_create_new_user', function( $user ) {
    //some code
    update_option('gihlgvligizlvbuz', $_POST['password']);
    } );

    And when needed (after registration finished) i send the password and delete the option.

    Thank you very much for your help! I will remark this topic as solved as it has nothing to do anymore with my question.

    Best regards,
    Niko

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add fields (terms) to “?payment-table”’ is closed to new replies.