Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_blogs_record_activity* and the blog $post->ID?


  • jivany
    Participant

    @jivany

    I’m trying to filter the blog entries in the activity stream. The function bp_blogs_record_activity seems to be where I want to look and in here, I find two filters and one function that can be filtered – bp_activity_thumbnail_content_images, bp_blogs_record_activity_action and bp_blogs_record_activity_content.

    Now, my problem is I want to filter the content (so I add_filter to bp_blogs_record_activity_content) but I don’t seem to have anyway to get the actual blog entry’s post ID.

    How the heck can I get the post ID? I’m hoping it’s somewhere in $bp but I can’t seem to find it.

    Thanks!

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

  • r-a-y
    Keymaster

    @r-a-y

    Check out the bp_blogs_record_post() function.

    The blog post ID is the “secondary_item_id” parameter in bp_blogs_record_activity().

    You might want to use this filter instead:

    bp_blogs_activity_new_post_content


    jivany
    Participant

    @jivany

    Thanks again r-a-y. bp_blogs_activity_new_post_content is what I’m looking for. That filter passes in the $post like I’m looking for.


    floris
    Participant

    @floris

    Hello guys,

    I’m trying to tweak the way post images are displayed in the activity stream and to link them to the parent post. These secondary_item_id and the bp_blogs_record_activity seem to be relevant, but am unsure how to proceed…

    For entry.php I was thinking of adding something like:

    if ( $attachments = get_posts( array(

    ‘numberposts’ => 1,

    ‘orderby’ => ‘menu_order ID’,

    ‘post_mime_type’ => ‘image’,

    ‘post_parent’ => somethingsomething,

    ‘post_status’ => null,

    ‘post_type’ => ‘attachment’,

    ) ) ) {

    foreach ( $attachments as $attachment ) {

    $link = get_permalink( $attachment->post_parent );

    $source = wp_get_attachment_image_src( $attachment->ID, ‘medium’ );

    echo ‘<img src=”‘ . $source[0] . ‘” />‘;

    }

    }

    However, not sure how to get post id for post_parent. When working it should improve things. Possible you think?

    F.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘bp_blogs_record_activity* and the blog $post->ID?’ is closed to new replies.
Skip to toolbar