We have a gravity form, and I'd like to be able to hide or show specific fields based on whether the user has a specific memberpress subscription. My overall approach was to use the HTML field to run a script to see if the user has a specific memberpress subscription and if so, populate a random field. I would then use that field for conditional logic on the fields I want to hide/show for users with the active memberpress subscription.
Based on this post, I see that I can check if a user already has active memberpress: How can I detect if user has subscribed Memberpress product already
But how can I then populate a value into a specific field of my form if the code returns true that user does have active memberpress subscription?
$mepr_user->is_active_on_membership( $membership_id ); // true or false
If you're embedding HTML / JavaScript you can take advantage of the Available Shortcodes from MemberPress.
Just replace the membership number with the correct ID from MemberPress.