Opened 8 years ago
Closed 8 years ago
#7329 closed defect (bug) (fixed)
Notice: Trying to get property of non-object
Reported by: | slaFFik | Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.7 |
Component: | Administration | Keywords: | has-patch |
Cc: |
Description (last modified by )
Posted a comment to post, after that opened Activity management page in wp-admin area - saw this notice:
Notice: Trying to get property of non-object in \wp-content\plugins\buddypress\src\bp-activity\bp-activity-template.php on line 2254
Current BuddyPress trunk
Attachments (3)
Change History (22)
#2
@
8 years ago
#5
@
8 years ago
@DJPaul
I was not able to replicate on WordPress 4.5.x and 4.6.x and BP 2.6.x.
Once I updated to BuddyPress 2.7.2 on Plugins page - instantly got this notice.
So yes, this is a regression in 2.7.
#6
@
8 years ago
In future patches, try to keep unrelated code improvements (all the spacing) outside of bug fixes.
#7
@
8 years ago
I did some git bisect
(best tool on the planet) and discovered this was caused in 2.7 by r10947. @r-a-y do you have time to look at this patch and see if it's a good fix?
This ticket was mentioned in Slack in #buddypress by djpaul. View the logs.
8 years ago
This ticket was mentioned in Slack in #buddypress by tw2113. View the logs.
8 years ago
This ticket was mentioned in Slack in #buddypress by slaffik. View the logs.
8 years ago
#12
@
8 years ago
- Version set to 2.7
Thanks @slaFFik for discovering this bug and sorry for getting to this kinda late.
The main thing we need to address here is finding the current activity comment depth when we're not in the activity comment loop.
02.patch
is an attempt at this.
This is what is happening in the patch:
- When we pass
$comment
tobp_activity_get_comment_depth()
, we pull up the root activity update and the entire activity comment tree. - Next, we try to iterate over the entire tree to find the current comment. Once we've found the comment, we use the calculated depth from
BP_Activity_Activity:get_activity_comments()
. This can be kind of intensive depending on how many comments are in the tree. - Lastly, since activity items in the Activity dashboard are displayed in stream mode, we need to iterate the depth number so
bp_blogs_can_comment_reply()
knows when to disable activity comment replies. This is a little bit of a hack, but if we want to avoid this, we can add a conditional so this is only done in the WP admin dashboard. Or, we can also iterate the depth inbp_blogs_can_comment_reply()
. I think this makes more sense.
This ticket was mentioned in Slack in #buddypress by slaffik. View the logs.
8 years ago
#16
@
8 years ago
- Keywords 2nd-opinion removed
03.patch
includes unit tests and cleans up the code a bit.
Patch also fixes an issue in the admin area with activity comments not being restricted by depth for regular activity types like 'activity_update'
. See the code in /bp-activity/classes/class-bp-activity-list-table.php
. This part of the code could be cleaned up a bit due to the check for the Blogs component since regular activity updates are not reliant on the Blogs component, but I'm going to leave it as-is for now.
That's because
$activities_template
global inbp_activity_get_comment_depth()
is empty.