Hi Brajesh,
Tried to get an answer to this at buddypress.org but no luck as usual, but it should be a simple one for you.
I really need a way of identifying an activity as a group post, along the lines of “if_is_group_post”. Such a function doesn’t appear to exist in BuddyPress, and surprisingly they don’t even have their own post type (just another activity update). So how can I identify an activity as a group post?
Regards,
LeeHi Lee,
Thank you for posting.
We can write a function like below to do check for ourself.function lee_is_group_activity( $activity = null ) { global $activities_template; if ( ! $activity ) { $activity = $activities_template->activity; } if ( $activity && $activity->component == 'groups' && $activity->type == 'activity_update' ) { return true; } return false; }
Hope that helps.
Hi Lee,
for @mention, There is no direct way to identify. It is possible to do a search on the activity_content usingbp_activity_find_mentions( $content)
This function will return an array of mentioned user names or false if none found.
Hope you can take from there.
PS: Doing an search for mention on all activity will not be very efficient, I will recommed another approach(Like when the activity is created, check for mention and store a meta, then use this meta later).
Hope that helps.
The topic ‘ [Resolved] How to Identify a Group Post’ is closed to new replies.