PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Gravity Forms & Buddypress, bp_activity_add

  1. Hi, does anyone know how to use gravity forms to submit a post from the frontend that uses bp_activity_add in the after form submission to update buddypress activity stream to including the thumbnail image?

    Here is my code so far:

    add_filter("gform_post_submission_1", "set_post_thumbnail_as", 10, 2);
    function set_post_thumbnail_as($entry, $form){
    
        //getting first image associated with the post
        $post_id = $entry["post_id"];
        $attachments = get_posts(array('numberposts' => '1', 'post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC'));
        if(sizeof($attachments) == 0)
            return; //no images attached to the post
    
        //setting first image as the thumbnail for this post
        update_post_meta( $post_id, '_thumbnail_id', $attachments[0]->ID);
    
    	// update bp activty stream content.
    	$activity_id = bp_activity_add( array( 'id' => $post_id, 'content' => '$attachments' ));
    }

    If someone could help that'd be great

    Posted 12 years ago on Wednesday July 13, 2011 | Permalink
  2. Can I get my money baccccck?

    Posted 12 years ago on Wednesday July 13, 2011 | Permalink
  3. I'm not sure about your first request but I'm sure someone will answer that for you. Why are you requesting a refund? Is there some other issue we can help you with?

    Posted 12 years ago on Wednesday July 13, 2011 | Permalink
  4. I'm not familiar enough with BuddyPress to know how the bp_activity_add function call works. Based on your code it looks like you are on the right track as far as implementing it using the gform_post_submission hook. Can you provide more information on what exactly this function call does and what appears in BuddyPress?

    Posted 12 years ago on Wednesday July 13, 2011 | Permalink

This topic has been resolved and has been closed to new replies.