How to use Gravity form with the Geodirectory?

The Geodirectory plugin is an awesome way to create a Directory website in WordPress. So far Geodirectory only supports and recommends Ninja form to allow creating a contact listing form.
I have seen many people ask this question about the Gravity form integration with Geodirectory. I have no proper information over the internet about it. so here we will discuss How you can use Gravity form with the Geodirectory?

I have divided this integration into 5 steps. By following these 5 steps you can create a Contact Listing form using Gravity form to easily contact the Listing author.

Step 1 – Create a Dynamically Populated email tag

Gravity form supports Dynamic Population. we will use this feature to create a dynamic tag for the Listing Author email.
I have already prepared a snippet for you. you can use the code snippet plugin to use it OR if you have a child theme you can add this code to your child-themes functions.php.

/**
 * This code will help you to send email to the listing author email address. 
 */
add_filter( 'gform_field_value_author_email', 'populate_post_author_email' );
function populate_post_author_email( $value ) {
	global $post;
	$author_email = get_the_author_meta( 'email', $post->post_author );
	return $author_email;
}

If you want the contact listing email should go to the email address added in the Listing email field. You can use the code below.

/**
 * This code will help you to send email directly to the email address added for contact in the listing.
 */
add_filter( 'gform_field_value_author_email', 'populate_post_author_email' );
function populate_post_author_email( $value ) {
	global $gd_post;
	$email_to = is_email( $gd_post->email ) ? $gd_post->email : '';
	return $email_to;
}

Now that our Dynamically populated tag is ready. we can move to step 2.

Step 2 – Create a Gravity form for Geodirectory Contact Listing

Now you have to create a simple Gravity form for contacting a Listing.

Follow these mini steps to configure the dynamically created tag in the form.

1. Create a hidden field in the form

2. Click on the field setting

3. Enable allow the field to be populated dynamically

4. Add parameter Name to author_email as we have created in the above snippet.

Step 3 – Set Notification for Listing the Author

Now the last step is to allow the form submission notification to be enabled for the listing of the author.

You can look for the hidden field name in the field tags and use it inside the send to the email field.

Now your Gravity form is ready to work like a contact listing form with Geodirectory.

You can ask in the comment section if you have any queries.

Related Post

Start a Project with Us

Ready to dive into your next WordPress project? Reach out to us today for a chat, and let’s team up to make your digital dreams a reality!

People Who Worked With Us

A descriptive paragraph that tells clients how good you are and proves that you are the best choice that they’ve made.