Can I integrate with Paid Memberships Pro Membership Directory Add On?
GravityKit and PMPro are working on a no-code solution for embedding Views on PMPro profile pages. For now, this is a way to do that, but it requires some code.
The Paid Memberships Pro Member Directory & Profile Pages Add On provides an easy way to view and navigate members on a website.
If you're using Paid Memberships Pro, this is the perfect way to list members and give each a profile page.
Displaying Gravity Forms entries in Paid Memberships Pro
We want to make it easy for PMPro users to display, on profile pages, Gravity Forms entries that a member has created.
There is a pmpro_member_profile_after
hook that allows us to display data after the profile, but there’s no place we are aware of to hook into the profile configuration UI in the back-end to add more profile sections.
Ideally, we would add a configuration section where administrators can configure which GravityView “Views” would be displayed in the profile, similar to what we have done with the LifterLMS GravityView integration.
How to display GravityView Views on PMPro profile pages
You will need GravityView, the Advanced Filtering Extension, Paid Memberships Pro, and the Member Directory Add On.
Create a View
If you don't already have a View that is configured to show your entries, create one.
Add a "Created By" filter
In the View Settings, click on the "Filter & Sort" tab to see the Advanced Filter settings.
- Create a new rule
- Select "Created By" as the field,
- Select "is" as the condition
- Select "Custom" as the value
When selecting Custom, the dropdown will convert into a text field. In the text field, place the following Merge Tag:
{get:pmpromd_id}
The Merge Tag will be replaced by custom code in the next step.
Save the View
Next, save the View.
Install the Code Snippets plugin.
If you are a developer, you can add this code wherever you want. If you aren't a developer, we suggest the Code Snippets plugin. Read this to learn how to add code samples.
Copy and paste this code in Code Snippets or where you add code customizations
/** * Adds GravityView below the Paid Memberships Pro profile output. * IMPORTANT: UPDATE THE SHORTCODE BEFORE USING! */ add_action( 'pmpro_member_profile_after', function( $user ) { // Membership Directory Add On isn't active for PM Pro. if ( ! function_exists( 'pmpromd_get_user' ) ) { return; } $pmpromd_user = pmpromd_get_user(); $_GET['pmpromd_id'] = $pmpromd_user->ID; // IMPORTANT: Replace the text with your shortcode below! echo do_shortcode( 'Replace with your GravityView shortcode' ); unset( $_GET['pmpromd_id'] ); } );
Make sure to update the shortcode
In the code above, you will need to replace
echo do_shortcode( 'Replace with your GravityView shortcode' );
With the shortcode from your View. Here's an example:
To find your shortcode, click the GravityKit menu item, click the All Views submenu, then click "Shortcode" column for the View you want to embed. That will copy it to your clipboard.
echo do_shortcode( '[gravityview id="1180" secret="fb5158a1ae40"]' );
Save the Code Snippet
Once you update the code with the GravityView shortcode, your View should now appear below the PMPro profile page content.
The View will only be showing listings that were created by the user featured in the profile.
If you want to display multiple Views
You can display multiple Views on the same profile—just clone the echo do_shortcode( 'Replace with your GravityView shortcode' );
line as many times as you want!