Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

#5862 closed defect (bug) (fixed)

activity comment replies problem when bp_activity_current_comment returns false

Reported by: shanebp Owned by: r-a-y
Milestone: 2.1 Priority: normal
Severity: normal Version: 1.5
Component: Appearance - Template Pack Keywords: has-patch commit
Cc: shane@…

Description

BP 2.0.2, WP 3.9.2, Theme 2013, Plugins: just BP

Forum Reference:
http://buddypress.org/support/topic/in-certain-cases-comments-are-not-showing-only-replied-in-my-groups/

Steps to Recreate:

  1. Create or join a private group
  2. Create an update in that group
  3. Go the main activity stream, select 'My Groups' and comment on that update
  4. The result is that only 'replied' appears.
  5. Refresh the page - the comment now appears

If debug is on, then Step 4 will show:
'Notice: Trying to get property of non-object in .../wp-content/plugins/buddypress/bp-blogs/bp-blogs-activity.php on line 734'

The problem seems to be that in:

bp-blogs-activity.php > bp_blogs_setup_comment_loop_globals_on_ajax()
$comment  = bp_activity_current_comment();

$comment is false and is therefore a non-object.

Attachments (1)

5862.01.patch (799 bytes) - added by r-a-y 5 years ago.

Download all attachments as: .zip

Change History (10)

#1 @shanebp
5 years ago

  • Cc shane@… added

$comment is false and is therefore a non-object.

So the next line fails:

$parent_activity = new BP_Activity_Activity( $comment->item_id );

#2 @boonebgorges
5 years ago

  • Milestone changed from Awaiting Review to 2.2

Confirmed. I'm not sure why `$activities_template->activity->current_comment is ending up empty here - r-a-y, as I think this is your bit, can you take a look?

#3 @r-a-y
5 years ago

I think it has something to do with heartbeat as heartbeat changes the display_comments setting to 'stream' and I originally tested with the parameter set to default behavior of 'threaded'.

Will definitely look into it!

Appears to be an issue with hide_sitewide. Working on a fix.

Last edited 5 years ago by r-a-y (previous) (diff)

@r-a-y
5 years ago

#4 @r-a-y
5 years ago

  • Component changed from Activity to Template Pack
  • Keywords has-patch added
  • Version set to 2.0

01.patch fixes this issue. The problem is we need to explicitly set the show_hidden parameter when bp-legacy adds the activity comment via AJAX and fetches the new activity ID.

I'd prefer to add this to 2.1 as the change is pretty small and is a pretty annoying bug.

#5 @r-a-y
5 years ago

  • Version changed from 2.0 to 1.5

This is actually a very old bug. Surprised no one really brought this one up until now!

#6 @shanebp
5 years ago

Patch confirmed here.
Thanks r-a-y.

#7 @danbp
5 years ago

Thank you r-a-y !

i applied the patch to 2.0.2 where he's working correctly.

#8 @boonebgorges
5 years ago

  • Keywords commit added
  • Milestone changed from 2.2 to 2.1

Thanks, r-a-y.

#9 @r-a-y
5 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 8989:

bp-legacy: Fix notice when replying to private group activity updates via AJAX.

When a reply is made to an activity update, we have to repopulate the
$activities_template global with the new activity object.

However, when we fetch the new private activity comment, we have to add a
check for the visibility of the item as well. This currently isn't done,
which led to the notices and the non-existence of the activity object.

This commit addresses the issue by setting the show_hidden parameter to
true when fetching the new activity item, ensuring that the
$activities_template->activity object will be set.

Fixes #5862.

Note: See TracTickets for help on using tickets.