Opened 10 years ago
Closed 8 years ago
#2690 closed defect (bug) (fixed)
topic and reply edits generate multiple activity stream items
Reported by: | shanebp | Owned by: | johnjamesjacoby |
---|---|---|---|
Milestone: | 2.5.13 | Priority: | high |
Severity: | normal | Version: | 2.5.4 |
Component: | Extend - BuddyPress | Keywords: | has-patch |
Cc: | shane@… |
Description
WP 4.0, BP 2.1, bbPress 2.5.4, 2013 theme
Editing a topic or reply results in a separate Activity post for each edit.
per: https://buddypress.org/support/topic/bbpress-post-edit-causes-multiple-activity-entries/
I believe this is a bbPress bug - maybe in
includes\extend\buddypress\activity.php
The edit_post hooks to topic_update which calls $this->topic_create which calls record_activity which calls bp_activity_add()
Ditto for the edit_post hooks to reply_update.
If, in public function topic_update, I comment out...
$this->topic_create( $topic_id, $forum_id, array(), $topic_author_id );
...a duplicate entry is not created when I edit a topic.
But perhaps that introduces other problems?
Attachments (3)
Change History (17)
#1
@
10 years ago
In includes\extend\buddypress\activity.php
If I don't comment out $this->topic_create in public function topic_update
And then comment out the following in function get_activity_id()
// Get the activity stream item, bail if it doesn't exist // $existing = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'show_hidden' => true, 'spam' => 'all') ); // if ( empty( $existing['total'] ) || ( 1 !== (int) $existing['total'] ) ) // return null;
Duplicate entries are not created. And the body of the activity item is updated.
Otherwise, $existing[total'] is always empty, so null is returned and a new Activity item is created.
I also tried, without success, adding 'count_total' => true to the bp_activity_get_specific call.
This issue may be due to a change in BP's bp_activity_get_specific() or BP_Activity_Activity::get
But I'm unclear as to why you're calling bp_activity_get_specific.
Why not do this?
$existing = bp_activity_get_activity_id( array( 'item_id' => $post_id ) ); if( $existing == NULL ) return null;
#2
@
10 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 2.6
The changes to activity queries to remove the count by default in BP 2.1 affected this ticket.
I've attached a patch that is more foolproof than relying on bp_activity_get_specific()
or bp_activity_get_activity_id()
by just calling the BP_Activity_Activity
class directly and then checking if the component is empty or not. If the component is empty, then the activity item doesn't exist any more.
#3
@
10 years ago
Thank you for the patch @r-a-y and @shanebp !
... but i got a parse error:
syntax error, unexpected 'public' (T_PUBLIC) in ../wp-content/plugins/bbpress/includes/extend/buddypress/activity.php on line 279
Removing { after if ( empty( $existing->component ) ) {
solved the issue.
#4
@
10 years ago
Hi danbp, the patch is meant for trunk, which has a different version of /extend/buddypress/activity.php
and needs the {
character:
https://bbpress.trac.wordpress.org/browser/trunk/src/includes/extend/buddypress/activity.php#L279
v2.5.4 doesn't need the brace:
https://bbpress.trac.wordpress.org/browser/tags/2.5.4/includes/extend/buddypress/activity.php#L278
Sorry for not mentioning this in my previous comment!
#5
@
10 years ago
- Owner set to johnjamesjacoby
- Resolution set to fixed
- Status changed from new to closed
In 5857:
#6
@
9 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Hi,
this bug is still in 2.5.8-5815 ! Had again to apply the patch manually.
Compare what is in current version on SVN
https://plugins.trac.wordpress.org/browser/bbpress/tags/2.5.8/includes/extend/buddypress/activity.php
And what is mentionned as solved in 5857
Can you adjust this please ?
There is also an error between bbPress download button on bbp.org going to 2.5.7 and WP's plugin repo 2.5.8 !
#7
@
9 years ago
Just to note, I updated https://bbpress.org/download/
#8
@
9 years ago
- Resolution set to fixed
- Status changed from reopened to closed
Hi Dan,
This ticket is in the 2.6 milestone. As such, it will not be included in 2.5.x releases.
The issue is resolved for what will be bbPress 2.6, so the ticket should stay marked as "fixed."
#9
@
9 years ago
- Milestone changed from 2.6 to 2.8
- Resolution fixed deleted
- Status changed from closed to reopened
Hi,
I still see the same with current version 2.5.8. can you please make sure the patch is included on current version?
#10
@
9 years ago
- Milestone changed from 2.8 to 2.6
- Resolution set to fixed
- Status changed from reopened to closed
@paudelvinay per the comment previous to yours this is slated for the 2.6 milestone which is the next bbPress release
#11
@
8 years ago
For others who find this ticket via Google (this is my second visit here in the last 12 months), here's a workaround until [5857] is included in a release:
add_filter( 'bp_activity_get_specific', function( $found ) { $found['total'] = count( $found['activities'] ); return $found; } );
#12
@
8 years ago
- Milestone changed from 2.6 to 2.5.13
- Priority changed from normal to high
- Resolution fixed deleted
- Status changed from closed to reopened
Example of duplicate Activity entries. Action is identical. Body content reflects edit.