@flashvilla, hope this helps:
I’m using Gravity Forms to display a contact form on each member profile page and dynamically populating a hidden field with the member’s email address.
Here’s info on dynamically populating a field in GF
Their example:
add_filter( 'gform_field_value_your_parameter', 'my_custom_population_function' );
function my_custom_population_function( $value ) {
return 'boom!';
}
I have changed this to:
add_filter('gform_field_value_bp_member_email', 'bp_member_email');
function bp_member_email($value){
return bp_get_displayed_user_email();
}
In Gravityforms, I have then created a hidden field and in the advanced tab of that field, checked “Allow field to be populated dynamically” and entered the “Parameter Name:” as “bp_member_email”
Then, in the notifications, the “Send to Email” should be changed from a standard email to a Gravityform tag. You can get that by clicking the little arrow key beside many fields such as “From Name” box. Find the name of your hidden field and click that. It should give you something like this: {BP Member Email:7} where “BP Member Email” is the name I gave the hidden field – yours will be whatever you named it.
You’ll also need to embed the form to your child theme: /themes/yourchildtheme/buddypress/members/single/home.php
Details on how to embed into your theme can be found here. Example: (where 1 is the ID of your form and 12 is the starting tabindex)
<?php gravity_form(1, false, false, false, '', true, 12); ?>
If this worked, you can view the source code of the member page and you’ll see the member’s email as an input value in the hidden field.
Hope this helps!
Please note: if you can’t have the person’s email displayed publicly in the source code for privacy (even though it’s not visible on the site), you will need an alternative method. Members on my site all have their emails visible so it’s not an issue for me.