Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5592 closed defect (bug) (no action required)

Can not retrieve a specific activity comment.

Reported by: godavid33's profile godavid33 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Activity Keywords:
Cc:

Description

When using bp_activity_get_specific( array( 'activity_ids' => ACTIVITY_ID ) ) with the ID of an activity_comment, a blank array is returned as the results. When using with the ID of an activity_update (or essentially anything excluding activity_comment) the correct results are returned.

This gets in the way of trying to custom create notifications front-end displays particularly.

Change History (4)

#1 @godavid33
10 years ago

The following works as a temporary fix to get the parent thread ID of an activity comment

$act_item = $wpdb->get_results("SELECT * FROM wp_bp_activity WHERE id = ACTIVITY_COMMENT_ID")
$act_item[0]->item_id

#2 @r-a-y
10 years ago

  • Component changed from Core to Activity
  • Milestone Awaiting Review deleted
  • Priority changed from high to normal
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 2.0 deleted

By default, activity comments are not fetched. To fetch activity comments, use the 'display_comments' parameter set to true and then pass the activity comment ID.

$act_item = bp_activity_get_specific( array(
    'display_comments' => true,
    'activity_ids' => ACTIVITY_COMMENT_ID
) );

#3 @boonebgorges
10 years ago

Dangit r-a-y, beat me to it for a second time today.

Just to add: Ideally, we would not require you to pass the 'display_comments=true' param, but it would require rewriting much of the activity query infrastructure to make it work. (More specifically, we'd have to do a pre-query to see if you are requesting activity_comments, and to flip display_comments to true in those cases.) But this is not in the works at the moment, so please go with r-a-y's suggestion. Thanks.

#4 @godavid33
10 years ago

Aw okay, actually that makes perfect sense given users have the option to disable comments (and assuming they allowed them briefly and some were populated, wouldn't want those be pulled now ;] )!

Thanks y'all

Note: See TracTickets for help on using tickets.