Skip to:
Content

BuddyPress.org

Opened 2 months ago

Closed 5 weeks ago

#8579 closed defect (bug) (fixed)

Post Author Changed, but Activity & Post pages come out wrong

Reported by: rigsbyx Owned by: imath
Milestone: 10.0.0 Priority: normal
Severity: normal Version: 2.2
Component: Activity Keywords: has-patch commit
Cc:

Description

I posted the same question here https://buddydev.com/support/forums/topic/post-author-changed-but-activity-post-pages-come-out-wrong/ and someone suggested I report the bug to you instead, but surely this is something that should have already been noticed and fixed. Since this post, in trying to solve the issue, I deleted the entire website AND the domain name and started again from scratch because I was going around in circles and could not find a solution. Yes, I have backups, but I didn’t want to use them in case my DB was acting up. Had I known it was a bug, I wouldn’t have put myself out like this. It took me seven days from then until now, and I’m rather quite upset about it all. Here is what I said on the BuddyDev website…

This is such a strange one.

I can change the author for multiple posts by using the Quick Edit feature on the Posts page, but something weird happens on the Activity & Post pages.

FYI: I have two users – it’s a new site not yet launched
Admin
Connie

I switched all 196 posts from Admin to Connie using Quick Edit. It worked.

  1. On Connie’s /activity page, where I was expecting to see a long page of all 196 posts, it only shows 1 post (ONE!)
  1. On Connie’s /posts page it shows all 196, but one on each page. Great, but who wants to click through 196 pages?

So, it looks like all posts did get assigned to Connie, great, but…

  1. On Admin’s /activity page, all 196 posts are visible on one long page, if you scroll far enough. They all say “Admin wrote a new post”. Why? I changed them all to Connie, and they shouldn’t even be visible in this activity feed; this page should be empty
  1. On Admin’s /posts page it is empty (as it should be)
  1. In phpMyAdmin, I even bulk-changed the post_author ID from 1 to 8, and that worked both ways, too. I was hoping it would flush out the bad seed, but there’s still no change on the frontend.

Thanks in advance for all of your replies and suggestions 🙂

Attachments (2)

8579.patch (691 bytes) - added by imath 2 months ago.
8579.2.patch (3.5 KB) - added by imath 5 weeks ago.

Download all attachments as: .zip

Change History (7)

#1 @imath
2 months ago

  • Component changed from Core to Activity
  • Keywords has-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to 10.0.0
  • Version set to 2.2

Hi @rigsbyx

Thanks for your report. I was able to replicate and I confirm the issue. Let's fix this during 10.0.0.

Here's a first patch that fixed the issue on my setup. I'll work on unit tests about it. asap.

@imath
2 months ago

#2 @rigsbyx
2 months ago

Hi @imath

Thanks for your fast response. Amazing. I don't know php except to drop it into a specific region, but what you sent me doesn't look the same in my php file. I am guessing they were supposed to for the white regions?

These are lines 2303 - 2313 in plugins/buddypress/bp-activity-functions.php:

	 * @param WP_Post              $post                 Post object.
	 * @param BP_Activity_Activity $activity             Activity object.
	 * @param object               $activity_post_object The post type tracking args object.
	 */
	do_action( 'bp_activity_post_type_updated', $post, $activity, $activity_post_object );

	return $updated;
}

/**
 * Unpublish an activity for the custom post type.

Needless to say, I didn't add it in just yet, and there's no hurry for me anyway :)

Cheers

Last edited 2 months ago by imath (previous) (diff)

#3 @imath
2 months ago

That's probably because the file evolved since 9.0.0. Testing patches needs the development version. The best way to contribute with testing patches is to follow this tutorial:
https://codex.buddypress.org/participate-and-contribute/contribute-with-code/

@imath
5 weeks ago

#4 @imath
5 weeks ago

  • Keywords commit added; needs-unit-tests removed

8579.2.patch adds 2 tests. I will commit it shortly.

#5 @imath
5 weeks ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 13135:

Activity: make sure Activity author is synced with Post Type author

When the author of a Post has been updated, the corresponding user_id into the related Post Type Activity needs to be updated as well.

Props rigsbyx

Fixes #8579

Note: See TracTickets for help on using tickets.