Opened 9 years ago
Closed 8 years ago
#6937 closed defect (bug) (fixed)
fatal error when trashing emails
Reported by: | DJPaul | Owned by: | r-a-y |
---|---|---|---|
Milestone: | 2.6 | Priority: | normal |
Severity: | normal | Version: | 2.5.0 |
Component: | Blogs | Keywords: | has-patch commit |
Cc: | imath |
Description
When clicking “rebuild emails…” and clicking “empty trash” in Emails -> All emails -> Trash
i get error:
Fatal error: Call to undefined function bp_blogs_delete_activity() in ..../public_html/wp-content/plugins/buddypress/bp-blogs/bp-blogs-functions.php on line 914
Attachments (2)
Change History (30)
#2
follow-up:
↓ 6
@
9 years ago
I'm guessing this was introduced possibly by the post type comment tracking change.
#3
follow-up:
↓ 5
@
9 years ago
See also https://buddypress.org/support/topic/php-fatal-error-possible-bug/ for similar but maybe the same root cause.
#5
in reply to:
↑ 3
@
9 years ago
Replying to DJPaul:
See also https://buddypress.org/support/topic/php-fatal-error-possible-bug/ for similar but maybe the same root cause.
The activity streams component is disabled on the site where that error occurred.
#6
in reply to:
↑ 2
;
follow-up:
↓ 7
@
9 years ago
Thanks a lot for your comments @mi423 I'm currently working on a patch.
What i'm amazed of is : how come you didn't noticed it in previous versions of BuddyPress ?
I'm pretty sure this could happen with BuddyPress 2.4.3 having the same components activated.
I mean in the end bp_blogs_delete_activity()
is using bp_activity_delete_by_item_id()
which is located in the Activity component.
I'm guessing this was introduced possibly by the post type comment tracking change.
@DJPaul The only change that could have caused this (although i think it's there for quite a while) is the fact we include /bp-blogs/bp-blogs-activity.php
only if the Activity component is active. The function bp_blogs_remove_post()
wasn't touched during 2.5.0 dev cycle.
#7
in reply to:
↑ 6
@
9 years ago
Replying to imath:
What i'm amazed of is : how come you didn't noticed it in previous versions of BuddyPress ?
I'm pretty sure this could happen with BuddyPress 2.4.3 having the same components activated.
I have no idea :) I do not remember if I've seen this error before.
#8
@
9 years ago
@DJPaul @mi423
Sorry I spoke too quick.
I see now what caused this. A bunch of if ( ! bp_is_active( 'activity' ) ) {
checks were removed inside functions such as bp_blogs_delete_activity()
because the whole file is now loaded only if the activity component is active.
I now see it was a really bad idea.
#9
@
9 years ago
- Keywords has-patch needs-testing added
Here's a first patch. I'm going to run some tests and will add a new comment to explain my choice once done.
#10
@
9 years ago
- Keywords needs-testing removed
So here's a detailled explanation
In r10544 we did two things:
- Only load
bp-blogs/bp-blogs-activity.php
if the Activity Component was active - Remove the
bp_is_active( 'activity' )
checks insidebp_blogs_record_activity()
andbp_blogs_delete_activity()
This means before this commit, the file was loaded and the checks were making sure the activity component was active before using an Activity component function. Reason why this trouble appeared in 2.5.0 and not before.
I keep on thinking only loading the bp-blogs/bp-blogs-activity.php
if the Activity Component is active is a good improvement as it avoids loading a bunch of code that is not used anyway. But this means we now need to do the bp_is_active( 'activity' )
before using bp_blogs_record_activity()
or bp_blogs_delete_activity()
.
That's what is doing 6937.patch. I've tested it having the Blogs component active and the Activity one deactivated on multisite/non multisite and it's fixing the issue.
#11
@
9 years ago
6937.patchworks for me.
No error on empting trash ;)
cheers
GJ
#12
follow-up:
↓ 13
@
9 years ago
I keep on thinking only loading the bp-blogs/bp-blogs-activity.php if the Activity Component is active is a good improvement as it avoids loading a bunch of code that is not used anyway.
Darn it! This was my fault! :(
Here's an alternate patch that moves the activity function calls from bp-blogs-functions.php
to bp-blogs-activity.php
.
Benefits are no more bp_is_active()
checks and code is hooked. The code changes may be too extreme for v2.5.1, so I'm thinking we roll with imath's fix for v2.5.1 and look at my patch for v2.6.0 instead.
To whomever commits, feel free to give me anti-props! :)
#13
in reply to:
↑ 12
@
9 years ago
Replying to r-a-y:
Darn it! This was my fault! :(
I should have checked too, so we're on the same boat :)
I really like 6937.activity.patch 's approach. Thanks for adding it.
This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.
9 years ago
#16
@
9 years ago
- Keywords commit added
What's the proposed plan? imath's patch for 2.5.1, r-a-y's for 2.6, or what?
I have not tested either patch but both patches look good, so please proceed.
#17
@
9 years ago
I think it's safest to go with 6937.patch for 2.5.1 as @mi423 confirmed it was fixing the issue.
Once committed, i'll leave this ticket open so that we can improve it the way @r-a-y suggested in his patch.
#22
@
9 years ago
- Keywords needs-patch added; has-patch removed
Let's refresh Ray's patch and get it in.
#23
@
9 years ago
- Keywords has-patch added; needs-patch removed
activity.patch
is refreshed.
Before committing, this patch does introduce three new functions for hook purposes:
bp_blogs_record_activity_on_site_creation()
bp_blogs_delete_new_blog_activity_for_site()
bp_blogs_delete_activity_for_site()
Let me know if any of these functions should be renamed to something more palatable.
#25
@
8 years ago
See what I wrote in comment:23. I just need a quick check on the names of the new functions before committing.
This might be if the activity component is disabled (bp-blogs-activity.php is only loaded then). Have asked reporter to confirm.