Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding Gravity Forms Entry to Site Activity


  • littlemisslanna
    Participant

    @littlemisslanna

    Topic title explains it all! I want a notification on the activity page to show up when people add (and maybe edit?) a new entry via Gravity Forms to a specific form. It’s basically a character database.

    So – “Username added CharacterName.” “Username edited CharacterName.”

    I know it’s a matter of adding in a specific hook somewhere (child theme functions.php??), but I don’t know how to word it and really rather not break the site!!

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)

  • danbp
    Moderator

    @danbp

    Hi @littlemisslanna,

    Yep, but you have better to ask how to do that on Gravity Form support forum. We can help you here for BuddyPress usage, not for third party implementation. Sorry ! 😉


    littlemisslanna
    Participant

    @littlemisslanna

    Ahh, I figured since it was the activity wall I was modifying that it’d be based here. Okay, thank you! I’ll share in this thread once I get how to do that thing if nobody minds 🙂


    shanebp
    Moderator

    @shanebp

    Ask GF for the hook re a form submission.
    Then use that hook to call a function that uses bp_activity_add()


    littlemisslanna
    Participant

    @littlemisslanna

    Thanks guys! So here’s what I got from the GF support guy.

    add_action( 'gform_after_submission_5', 'gf_add_to_activity_stream', 10, 2 );
    function gf_add_to_activity_stream( $entry, $form ) {
    

    “Your custom PHP all needs to come after that, inside the new function gf_add_to_activity_stream”

    I’m just not quite sure what to add after that. Can you guys help with this part, or should I bug the support guy again?


    littlemisslanna
    Participant

    @littlemisslanna

    Small bump! Maybe?


    littlemisslanna
    Participant

    @littlemisslanna

    OK! So Gravity forms guy gave me this part.

    // apply only to form 5 because of this: _5
    add_action( 'gform_after_submission_5', 'gf_add_to_activity_stream', 10, 2 );
    function gf_add_to_activity_stream( $entry, $form ) {
    	// log the $entry to see what you have to work with
    	GFCommon::log_debug( __METHOD__ . '(): ENTRY => ' . print_r( $entry, true ) );
    	// reference https://codex.buddypress.org/developer/function-examples/bp_activity_add/
    	$success = bp_activity_add( array ( $args ) );
    	GFCommon::log_debug( __METHOD__ . "(): Database record {$success} was created." );
    }

    I’m assuming the GF common log stuff would be what calls the entry from Gravity forms, but I’m not sure where/what to put as far as the buddypress stuff he referenced!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar