• Resolved corrinarusso

    (@corrinarusso)


    Hi guys – I’ve added Custom Fields for the Member registration sign up form.
    However, I’d like to capture different information on course enrol forms.

    Is there a hook I can use to conditionally display input fields based on the type of registration form?
    (I also have a Gravity Forms licence is that helps).

    Secondly, where in the backend is the collected meta-data output for the user?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author LifterLMS

    (@lifterlms)

    @corrinarusso,

    Second first: if you add custom meta data you must decide where / how you want to display that custom meta data (on your own). It’s custom. I haven’t written a robust-enough api to automatically do it all for you, sorry…

    Add data to the information tab of the student’s reporting screen by using this hook: https://lifterlms.com/docs/add-custom-fields-lifterlms-checkout-open-registration/#display-reporting

    Use these filters to display (and edit) from the user’s WP profile on the admin panel: https://lifterlms.com/docs/add-custom-fields-lifterlms-checkout-open-registration/#display-profile-wp

    Firstly last: You’re talking about the form on the checkout screen then you can pretty easily figure out if the access plan is for a course or a membership. In your existing code that adds the fields you’ll want to access an LLMS_Access_Plan object to check what the plan grants access to:

    
    $plan = isset( $_GET['plan] ) ? llms_get_post( $_GET['plan] ) : false;
    if ( ! $plan ) { return; }
    $type = get_post_type( $plan->get( 'product_id' ) );
    if ( 'course' === $type ) {
       // do course stuff
    } elseif ( 'llms_membership' === $type ) {
       // do membership stuff
    }
    

    I wrote that really quick and didn’t run it. Use at your own risk for fear of typos and errors.

    That’s the basic idea though.

    Hope that helps,

    Thread Starter corrinarusso

    (@corrinarusso)

    This is perfect.

    Thanks very much.

    Plugin Author chrisbadgett

    (@chrisbadgett)

    You are welcome 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom Fields’ is closed to new replies.