How are you getting item_id ?
You probably already have the author ID in the same object or array that is providing the item_id, especially if you’re in a loop.
You can always write a direct sql query: https://codex.wordpress.org/Class_Reference/wpdb
True that’s what I’m thinking too I’m kinda just testing my luck here hacking away at a “recent activity” plugin for BP
It uses this line to get recent activity from the DB
$recent_blogs = $wpdb->get_results( "SELECT user_id, content, item_id, id, date_recorded FROM {$wpdb->prefix}bp_activity WHERE TYPE = 'activity_comment' ORDER BY date_recorded DESC LIMIT $number_blogs" );
Of course it gives the SELECTed stuff: user_id, content, item_id, id, date_recorded
However that user_id
is that of this particular activity (a comment, perhaps) whereas I’d like also the user_id
of the activity being commented on (if that’s the case).
I guess I was just thinking there was a bp_get_activity($item_id)->author,content,date etc type of function
In this context, item_id
is related to the component.
For example, if the component is ‘groups’, then the item_id
is a group id.
And secondary_item_id
is kinda like another filter, maybe a comment_id
.
But custom-rolling an activity list is going to lead you, at some point, into a dead end.
A much better approach is to use the many parameters of bp_has_activities
.
And maybe write some custom sql to gather data arrays to feed into that function.
Thanks, yeah I’m going to look into some SQL action to get what I want, I think I’m just thinking about it wrong