Question

MemberPress - Hidden Fields

  • 21 December 2023
  • 8 replies
  • 83 views

Userlevel 1
Badge +1

I am starting to work with both Typeform and MemberPress, new to both.

What I am trying to do is embed a Typeform in a MemberPress course and collect the MemberPress user information and pass that to Typeform via Hidden Fields. 

Thank goodness the documentation for Typeform is pretty good. I think my challenge is not knowing how to capture the MemberPress data or data fields… or something there. 

Any help would be great. 


8 replies

Userlevel 7
Badge +5

Hi @JoelCouch72 That is….a great question. We sadly don’t have too much documentation here on how to pass in fields from MemberPress. I tried poking around their Help Center, but I don’t see any documentation on hidden field features. Do you happen to know if they have any? If you have any documentation you’ve seen, I can try to piece together whether or not this is possible. Their support team might have more information on this as well. 

Userlevel 1
Badge +1

Unfortunately, I am also coming up short on the MemberPress side of things. I have not yet been successful in reaching out to their support either. I am going to keep digging, this is a pretty big deal for us.. asking someone their name and email every time we sit down is just silly. There’s gotta be a way to do this… 

Userlevel 1
Badge +1

Okay, diving deep… much deeper than my current skill set supports. Webhooks… does that term ring some kind of magic? 

 

I see the dev tools and see some documentation around their API and within that space are webhooks. I can also see that Typeform does some kind of magic thing with webhooks. However, all of the documentation I am finding seems to think I already know everything and does not go into detail. I guess, technically, I am not a developer… but I am a learner. I’d really like to find a method to which we can grab the MemberPress username information and pass it to Typeform.

 

You guys have always been fantastic as supporting. I know this is a bit of a stretch to post here but I guess 50% of this is Typeform, so I’m hopeful. 

Thanks so much! 

Userlevel 1
Badge +1

I got in touch with MemberPress support. This is what I got:

 

it's possible to embed it on course and lesson pages. Regarding adding username to hidden fields on the course or lesson page, they could try to create a custom template for wp-content/plugins/memberpress-courses/app/views/classroom/courses_single_course.php or wp-content/plugins/memberpress-courses/app/views/classroom/courses_single_lesson.php files and add hidden fields like this:
 

<?php global $current_user; wp_get_current_user(); if ( is_user_logged_in() ) {   echo '<form style="display:none;"><input type="hidden" id="mpcs-username" name="mpcs-username" value="' . $current_user->user_login . '" /></form>';}This will only add hidden fields to the course or lesson page depending on the custom template, but to add and connect it with Typeform, they would need to contact the developer to adjust this, though.contact one of our recommended developers.

 

This means to me that it is indeed possible but currently out of scope for us. 

 

If you don’t mind, let me explain now (way down here) what I’m trying to do at a high level and see if we can discover a different way to accomplish our goal. 

 

We have a series of course content, sort of a journey for businesses. We want to be able to report on this “journey” on several levels but certainly including the individual. Originally, I was thinking that in order to link the data from all of the form submissions I’d simply capture username and append it to the record. Username in our case is an email, so this should also be unique. 

 

Since that’s not possible, the question becomes how can we have a series of forms submit to a pool of data and keep track of who submitted the form? Do you have any other ideas? The only idea I can come up with is having the user manually put in their information, which will be quite monotonous. 

Userlevel 7
Badge +5

Hi @JoelCouch72 Hm, shoot. Without having an easy way to pass information into the form through hidden fields, you would need to ask their information each time. 

@mathio or @picsoung have you seen any other techie ways to go about passing information in at all? 

Userlevel 1
Badge +1

I haven’t given up! I found a WordPress plugin called WP Webhooks. According to their support I can do exactly what I’m wanting.

My adventure continues!

This is what they had to say:

Yes, absolutely! You can do that with our WP Webhooks Pro plugin! 🙂 You can use our Entry submitted trigger from our Typeform integration:

Setup

  1. Within the settings of this webhook trigger, copy the receivable URL.
  2. Head into Typeform and go to the Connect panel of your chosen Workspace and click on the Webhooks tab.
  3. Place the receivable URL there and send data based on your requirements.
  4. After you can click on View Deliveries and send a demo request.
  5. By default, the webhook fires on all event types. To limit these types, you can set conditionals against the event_type key within the payload data.


Tips

  1. To learn more about the webhook setup, please follow this manual: https://www.typeform.com/help/a/webhooks-360029573471/


Useful links

  1. The typeform_entry_submitted trigger web page
  2. Official documentation

 

P.S. We are no longer working with MemberPress and have shifted to LearnDash. However, the integration of Typeform remains along with the logistics in getting that integration. 

Userlevel 7
Badge +5

 Hello @JoelCouch72 

based on the PHP code snippet you posted above, you could use a code like this to pass hidden fields to your typeform. This should only display the form if a user is logged in. This assumes the PHP methods are already provided by Wordpress / MemberPress:

<?php 

global $current_user; wp_get_current_user();

if ( is_user_logged_in() ) {
echo '<div data-tf-live="<your-id>" data-tf-hidden="username=' . $current_user->user_login . '"></div>';
echo '<script src="//embed.typeform.com/next/embed.js"></script>';
}

I dont know if this is still relevant, since you have switched away from that platform.

Userlevel 7
Badge +5

Oh, thanks so much for sharing, @JoelCouch72 ! Let us know how it goes and/or if you use the solution above, too. 😀

Reply