Using Registration Form from Another Plugin

Hello. I am using the latest version of the Membership plugin. I have 2 questions.

#1) In addition to the Membership plugin, I have another plugin I use on my website that also has functionality for registration forms, login , account profiles, etc.

I use the Membership plugin to handle registration and use the registration form from the Membership plugin.

I use the other plugin for logging in, editing user profiles, resetting passwords, etc. I know this is okay from other support requests I have entered.

My question to you is can I use the registration form from the other plugin for my users to register for the site? Or do I HAVE to use the registration form from the Membership plugin for my website to function properly with the Membership plugin?

#2) If I have to use the Membership plugin for registration, do you offer any "action hooks for registration" (the other plugin author asked me to ask you.)

There is a specific profile field that gets set automatically when using the other plugin's registration form, and when I use the Membership plugin for registration, that profile field does not get set automatically. The plugin author was wondering if they can set that specific profile field inside the registration form from Membership using action hooks.

If this is possible, can you provide some guidance on how to use action hooks in the registration form?

Thank you.

  • aristath

    Hello again Nick, I hope you're well today!

    My question to you is can I use the registration form from the other plugin for my users to register for the site? Or do I HAVE to use the registration form from the Membership plugin for my website to function properly with the Membership plugin?

    You'll have to use the Membership registration.

    #2) If I have to use the Membership plugin for registration, do you offer any "action hooks for registration" (the other plugin author asked me to ask you.)

    There are a lot of hooks you can use... it all depends on what you want to do exactly and where in the process of registration you want to hook!
    To take a look at the available hooks you can open up the membership/membershipincludes/classes/membershippublic.php file and look in that file at all the do_action calls we have there.

    Cheers,
    Ari.

  • Nick

    Thank you for tour fast response @Ari!

    I will take a look at the file. I am not too technical. Basically the other plugin I use to run my site has its own registration form and login and edit profile, etc. I use Membership plugin's registration form for my users, and the other plugin for logging in and editing profiles.

    There is a hidden field for the other plugin's registration form that automatically gets assigned to users when they register using the other plugin's registration form. All it is is a Yes or No value. Once the user registers using the other plugin's registration form, that user gets a Yes for that hidden field.

    However, because I am using Membership's registration form, the Yes value for that hidden field never gets assigned to the user and makes it impossible to use part of my site. The user doesn't get any value assigned to that field, which is a problem because my entire website is contingent on a user being assigned a specific value to that hidden field on the other plugin's registration form.

    Will one of the action hooks available in that file you mention be able to be used to automatically assign all users the same value from that hidden field on the other plugin's registration form? If so, can you provide any guidance I can do myself or tell the other plugin's developer for getting this hidden profile field to automatically give a Yes value to all users after registering using the registration form from the Membership plugin?

    Thank you so much.

  • Rahul Verma

    Hello @Nick

    I hope you're doing well.

    You can use 'membership_subscription_form_registration_process' hook to process something in after user registration based on user id passed as argument.

    Below is an example to help you more.

    add_action("membership_subscription_form_registration_process","after_registration",999,2);
    
    function after_registration($error,$user_id)
    {
    	print_r($_POST); // Display Submitted Data
    	print_r($error); // Display if any error
    	echo $user_id; // User id >0 if user registered otherwise it'll be 0
    	// TO DO - Here you can update user based on user id.
    }

    I hope that helps. Please feel free to ask if you have more questions on the same.

    Best Regards
    Sandeep Kumar

  • Nick

    Hi @Sandeep Kumar,

    Wow what a great reply! /thank you for the details. So I would just update the membership/membershipincludes/classes/membershippublic.php file with some of the code you mentioned (which I need to complete)? That file will be protected when I install upgrades to the Membership plugin, meaning my code for the action hook won't get overwritten on that file when there is an upgrade?

    Thank you,
    Nick

  • aristath

    So I would just update the membership/membershipincludes/classes/membershippublic.php file with some of the code you mentioned (which I need to complete)?

    No, you will have to put the code Sandeep posted above in your theme's functions.php file or a new custom plugin that you'll create.
    If you put that code in the plugin then your modifications will be lost each time there's a plugin update.

    Cheers,
    Ari.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.