activity stream post ID?
-
How do I get the Post ID of an entry in the activity stream?
$post->ID only gives me the id of the latest post.
-
if ‘type’ => ‘new_blog_post’ then ‘secondary_item_id’ => $post_id,
Ok i get that in theory but the syntax here isn’t making sense. Got the type conditional to work but can’t echo the secondary_item_id object. I really wish the codex for buddypress was as easy to get info from as the wordpress codex. Thank You so much though… you’re the first person to respond to any of my posts.
@nuprn1 i tried:
if ( ‘new_blog_post’ == bp_get_activity_type() ) : echo $secondary_item_id => post_id; endif;
but still can’t get the post_idThe codex docs are pretty darned incomplete and without any examples it’s really hard to deal with the buddypress functions/filters. Any hints on how i echo that post id????
The codex is only as good as people like you and I taking the time to update it. Where are you trying to do this? In which function or filter?
i’m doing this in my template in activity/entry.php
My goal is to filter wordpress posts of a particular category so i can grab some post meta data and make some really cool things happen in my activity streams.Wish i could help out and update the codex but i don’t have the buddypress function knowledge to be an authority there (yet). Just a few snippets/examples in there i think would go a long way to make it all click. I totally understand though that this is a large endeavor to maintain/develop on one path and document/support on another.
I think i now realize i’m viewing buddypress in a fundamentally wrong way but this is probably a testament to how well buddypress ‘feels’ integrated with wp. The theme folders of buddypress need to be viewed as an extension of a wordpress plugin rather than a template file hitting primarily the wordpress core as typical template files do. That being said i should be focussing my effort on plugin filtering/hooks and doing my activity stream tweaks as a separate plugin that listens for new blog posts and then does whatever required actions i throw at it. Am i closer to enlightenment now?
@hoodiemark – don’t know if you fixed this one, but the call you need is:
if (bp_get_activity_type() == ‘new_blog_post’) : bp_activity_secondary_item_id(); endif;
The post_id is the secondary_item_id, so no need to go trying to traverse deeper into the data structure.
You have two calls you can use:
bp_activity_secondary_item_id()
This echoes the idbp_get_activity_secondary_item_id()
This returns the idHow do we start including this stuff in the Codex?
p.s. @hoodiemark – in answer to your second question. I don’t think a filter is a good way to solve this one…
We wanted to avoid displaying post content for blog posts in the activity stream.
The filter options only seemed to let us control how the activity for a blog post was created in the first place, not how much of it was displayed in the stream.
If we’d used the filter to stop the ‘unwanted’ content being added in the first place, it would have meant it was also unavailable in places where it was wanted (e.g. the blog post widget seems to rely on the activity template).
I hope that makes sense!
- The topic ‘activity stream post ID?’ is closed to new replies.