Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 7 years ago

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

Function bp_activity_delete() is being called on Add New Post in the Dashboard

Reported by: gagan0123 Owned by: boonebgorges
Milestone: 1.9 Priority: normal
Severity: normal Version:
Component: Activity Keywords: needs-patch
Cc:

Description

This function is being on Add New Post which isn't even provided with any arguments in the version 1.6.2.

For testing I just wrote an echo statement in the function and it was printed on Add New Post.

This is breaking some functionality in the plugin I am making(BuddyPress Media).

Also, I cannot find version 1.6.2 in the dropdown below, so not selecting any version instead of selecting an incorrect one.

Change History (9)

#1 follow-up: @r-a-y
8 years ago

  • Keywords reporter-feedback added

Thanks for posting.

Can you provide a list of steps so we can duplicate the issue?

#2 in reply to: ↑ 1 @gagan0123
8 years ago

Replying to r-a-y:

Thanks for posting.

Can you provide a list of steps so we can duplicate the issue?

Most welcome :)

You can re-create the issue with this dummy probe:

function probe($args){
    echo 'This is what I am talking about';
}
add_action('bp_before_activity_delete','probe');

Since the action bp_before_activity_delete is being called only once in the entire BuddyPress code(the above mentioned function), printing of my echo message in the New Post page will confirm that this function is being called even where there is no reason for it to run.
I hope it helps :)

#3 @gagan0123
8 years ago

  • Keywords reporter-feedback removed

#4 @boonebgorges
8 years ago

I can confirm that this is happening. It's because of an annoying check done in bp_blogs_record_post().

Fixing this issue is potentially problematic, though, as it's likely to break other stuff if done wrong. What is this "breaking" in your plugin? You can work around it by just checking the arguments passed to the bp_before_activity_delete hook to make sure that the activity item actually exists.

#5 @gagan0123
8 years ago

I've already updated my plugin for additional error handling so no worries and its working fine now but still it feels odd that this function is being called where it's not supposed to be so reported it.

#6 @DJPaul
8 years ago

  • Keywords reporter-feedback added

#7 @boonebgorges
8 years ago

  • Keywords needs-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to 1.8

This is an annoying issue I would like to fix early in the 1.8 cycle, so there's plenty of time for testing.

#8 @boonebgorges
7 years ago

  • Milestone changed from 1.8 to 1.9
  • Owner set to boonebgorges
  • Status changed from new to assigned

#9 @boonebgorges
7 years ago

  • Resolution set to invalid
  • Status changed from assigned to closed

This problem should be solved by [7577], which switches bp_blogs_record_post() away from the generic 'save_post' action. In other words, it should no longer run when creating the auto-draft on Add New Post. Closing as invalid for this reason.

Note: See TracTickets for help on using tickets.