LearnDash Design & Tutorials

LearnDash Design & Tutorials

Replace the LearnDash Registration Popup with a Custom Form

Affiliate Disclosure: We may be compensated if you use our links to make a purchase. We are extremely selective in who we partner with & only recommend products we believe in. Our affiliate relationships do not influence our recommendations.

Are you using the LearnDash login & registration modal popup, but want to replace the form with one of your own? Maybe a Gravity Form that utilizes user registration, or a custom form you built with WPForms.

LearnDash provides a way to use the registration popup and just replace the form that shows up within it. This article will show you how to do just that.

The following example will use a Gravity Form, but you can use the same method—and nearly the same code—for any other form that can be inserted via a shortcode.

Create Your Form

You obviously need to create a form first. We aren’t going into detail on how to do this. Please consult the documentation for whatever form plugin you’re using.

IMPORTANT
Be sure it’s set up to create a new user account on your WordPress site. You can optionally add a payment field if you’d like to offer premium registrations.

Custom Code Snippets

My preferred way to make changes like we’re about to make is with the Code Snippets plugin. You could also add this code to the functions.php file of your child theme (if you’re using one), but I find Code Snippets to be easier to manage and less likely to bring your site down if you make a mistake.

  1. Install & activate “Code Snippets” from your WordPress plugins page
  2. Navigate to Snippets > Add New in the left sidebar
  3. Give your snippet a name. Something like “LearnDash – Custom Registration Form”
  4. Paste the code snippet into the Code area
  5. Choose the Only run on site front-end option
  6. Click the Save Changes and Activate button

Replace the LearnDash Form with a Custom Form

Here’s the code snippet that will replace the LearnDash registration form with a custom form of your own (Gravity Forms, WPForms, Formidable Forms, etc.).

Be sure to change the form ID in your code to match the form you set up for registration. In this example, 123.

add_action( 'learndash_register_modal_register_form_override', 'ldx_custom_reg_form' );

function ldx_custom_reg_form() {
	echo apply_shortcodes( '[gravityform id="123" title="false" description="false"]' );
}

If you’re not using Gravity Forms, simply look up the shortcode syntax for your form plugin, and use that instead. The only thing you need to change is the shortcode itself (the stuff inside the [ and ] brackets).

Sponsor

Finally Revealed...

NEW breakthrough solution allows you to IMMEDIATELY GROW student engagement and revenue per student by creating a state of the art mobile application in UNDER 60 MINUTES without ANY coding knowledge!

5 out of 5 stars

Proven and tested by over 1,000 LearnDash customers.

Get your LearnDash Mobile App →

Previous

Limit the Width of the LearnDash Login Modal

Next

How to Use Custom Fonts for H5P in WordPress

2 Comments

  1. Alya

    Hello,

    From the popup modal, is there a way to link the ‘register an account’ button to a url page instead of clicking it and popped out the username & email field? I want to remove the fields, and just want to direct them to a custom registration page that I have made.

    This tutorial here https://onexlab-io.medium.com/learndash-custom-registration-form-a93f0b1b66d8 requires to edit the core file. So it will be overwritten once I update LearnDash.

    Is there a code that I can edit through my child theme?

    Any help is much appreciated.

    • You can use the code above to replace the username & email fields and use a form of your own. This will do exactly the same thing as that other article you linked, but it will not affect any core files. Using the Code Snippets plugin is essentially the same thing as using a child theme.

      If you want to redirect the “register an account” button to a completely different page, you’ll need to ask LearnDash if there’s a hook for that. First, I would search developers.learndash.com. If you can’t find anything there, you can reach out to LearnDash support.

Leave a Reply

Your email address will not be published. Required fields are marked *

Powered by WordPress & Theme by Anders Norén