The logging is just a byproduct of using a Gravity Form. You're going to have a record of every form submission. You will have to figure out what to do with those submissions.
Sounds like you will have one form and will populate the "To:" email with the email address from that member's BuddyPress profile. I think this will work for you. Add this to your functions.php:
function populate_bp_member_email() {
global $bp;
return $bp->displayed_user->userdata->user_email;
}
add_action('gform_field_value_email', 'populate_bp_member_email');
I'm pretty sure that function will work to get the email of the displayed user. I don't have BuddyPress installed, so you might have to modify that code to make it work. Try it like that and see.
This hook is the key: gform_field_value_$parameter. You can read more about it here: http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name
Insert a hidden field into your form, and on the advanced tab, check the box to "Allow field to be populated dynamically". After that, you will have a text box for "Parameter Name:". In that box, use the same word you used in the hook. In my case it was email (gform_field_value_email), so I entered email here.
http://min.us/meoFecw
That word is important and can be almost anything. The key is to make the parameter name for the hidden field and in the filter the same. For me, it was email, same in both places.
Now you have a function to get the email from the BuddyPress profile, and are inserting that email into a hidden field in the form. Now, you need to use that email in the notification email. I used this in my "To:" email {Member Email:1} (Member Email is the title of field one in my form.)
Now use the function call to embed the form in whichever BuddyPress templates you want. You can read about how to do that here:
http://www.gravityhelp.com/documentation/page/Embedding_A_Form
Be sure when using the function call to insert the form that you also enqueue the scripts and stylesheets. It's all at the bottom of that page.
Please post again if you need more help. Thanks.
Posted 13 years ago on Friday August 12, 2011 |
Permalink