Disable redirect from form

Hi,

In Membership 2 Pro, I make use of option to make some content of a blogpost hidden via the read more tag protection.

In the ‘more tag protection message’ I use the shortcode [ms-membership-register-user membership_id=”980″] to register for a specific membership.

When someone enters the registration form and submits it, the person is redirected to the thank you page. This is not what I want. I want that the subscriber stays on the blog page and can continue reading.

How can this be done?

Cheers, Ron

  • Adam Czajczyk
    • Support Gorilla

    Hello Ron,

    I hope you’re well today and thank you for your question!

    I run some checks on my test site and it seems that in case of that kind of setup such a redirect is not currently supported because the payment gateway always “returns user” to the thank you page and the information about “where user came from” (what page of your site) is not carried over to and from payment gateway.

    I’ve asked our second line support team to take a look into it and see if there’d be a workaround possible. I’ll let you know once I get a replay from them. Please note though that it may take them a bit longer to respond than it takes us here on support forum so please keep an eye on this thread for further information.

    Best regards,

    Adam

  • Panos
    • SLS

    Hi Merijn ,

    In case the membership is free you can add attached mu-plugin in your wp-content/mu-plugins folder (if it doesn’t exist you can simply create a new folder under wp-content and name it “mu-plugins”:wink:.

    In case this membership is paid it is more complex, as payment gateways return to specific pages, and needs further digging in order to see if this is possible. Whichever is the case please let us know :slight_smile:

    Thanks!

    Panos

  • Merijn
    • Design Lord, Child of Thor

    Sorry Panos, forgot to mention it is not (yet) a Multisite environment. Does it work the same then?

    Or can I just copy-past it into functions.php? (for example).

    Ofcourse a plugin is the preferred way.

    Rgds,

    Merijn

  • Dimitris
    • Support Star

    Hey there Merijn,

    hope you’re doing good and don’t mind me chiming in! :slight_smile:

    If you un-zip the file that my colleague Panos attached in his previous reply, you should be getting a file like ms_register_redirect.php.

    Simply copy that to /wp-content/mu-plugins/ folder and it should be activated once.

    Reference: https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    FYI, all mu-plugins are available in the whole multisite installation, if there’s one.

    Warm regards,

    Dimitris

  • Merijn
    • Design Lord, Child of Thor

    Hi Dimitris, sorry for my late reply, was abroad…

    I found this code to place in (child) template functions.php:

    add_filter('ms_frontend_handle_registration', '__return_false');

    add_action( 'gform_user_registered', 'pi_gravity_registration_autologin', 10, 4 );

    function pi_gravity_registration_autologin( $user_id, $user_config, $entry, $password ) {
    $user = get_userdata( $user_id );
    $user_login = $user->user_login;
    $user_password = $password;

    wp_signon( array(
    'user_login' => $user_login,
    'user_password' => $user_password,
    'remember' => false
    ) );
    }

    Is that the same? (it does work, but I like it better in a plugin….)

  • Adam Czajczyk
    • Support Gorilla

    Hello merijn!

    This is a different code but if it works for you well you can try using it in an mu-plugin instead of functions.php file. In order to give it a try just create an empty file with a .php extension and then

    – put a PHP opening tag at the beginning of the file:

    <?php

    – paste your code below that tag

    – save the file and upload it to the “/wp-content/mu-plugins” folder

    Make sure that you are editing the file with a “clean text” editor (such as e.g. Notepad++, Sublime etc).

    Best regards,

    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.