Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#4304 closed enhancement (no action required)

Post trash management suggestion

Reported by: imath's profile imath Owned by:
Milestone: Priority: normal
Severity: minor Version: 1.6
Component: Blogs Keywords:
Cc:

Description

Hi,

(sorry 4 my english)

I was working on bp checkins and having hard times with the management of the trash of my custom post type. Then i made some test on regular posts on BP 1.5.6 and i noticed that the problem i faced with my custom post type actually exists for regular post.

I explain :
if i publish a post then this post is commented, if i trash the post, the 'new_blog_post' type activity is deleted but not the activities of the comments.
So while the post is in trash and not deleted if somebody clicks on the action of the comments activities, then we get a 404.

So my suggestion is to hook 'trashed_post_comments' to delete the 'new_blog_comment' activities of the blog post trashed.
If the admin change his mind, and remove the blog post from trash, then we can hook 'untrashed_post_comments' to recreate the 'new_blog_comment' activities we've deleted after trash.
Finally as, the recording of new_blog_post use the post_modified_gmt date, i suggest to hook 'untrash_post' to save in a global that the post is restored (in the diff i've chosen to create $bp->blogs->post_restored
then when the activity recording for this post is called, if $bp->blogs->post_restored is set it's a restored post, so we can use post_date_gmt to make sure the comments who will be restored won't be older than the post.

Attachments (1)

bp-blogs-functions.diff (3.7 KB) - added by imath 12 years ago.

Download all attachments as: .zip

Change History (8)

#1 @boonebgorges
12 years ago

  • Keywords has-patch needs-testing 1.7-early added

Cool idea. Let's look at it for 1.7.

#2 @boonebgorges
12 years ago

  • Milestone changed from Awaiting Review to Future Release

#3 @boonebgorges
12 years ago

  • Keywords 2nd-opinion added; 1.7-early removed
  • Milestone changed from Future Release to 1.7
  • Severity changed from normal to minor

I like this basic idea, but the patch needs some cleanup and discussion.

  • The bp_blogs_post_restored() trick is pretty hackish. Is there some way we can do this with wp_transition_post_status() instead (or something like that)?
  • Can we use get_comments() instead of doing direct SQL queries?
  • Are there going to be performance issues regenerating the activity items if posts have hundreds of comments?

if we can settle these issues fairly soon, let's shoot for 1.7 with this feature.

#4 @DJPaul
12 years ago

  • Keywords needs-patch added; has-patch removed

#5 @johnjamesjacoby
12 years ago

  • Keywords needs-patch removed
  • Milestone changed from 1.7 to Future Release

All of Boone's points above are valid. Since we don't have activity trash, we can't easily pull this off. I'd almost rather wait until we have activity trash than worry about regenerating an unlimited number of comments in the activity stream.

Punting to Future Release.

#6 @r-a-y
11 years ago

  • Keywords needs-testing 2nd-opinion removed
  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

Some work was done in:

  • r5328 to use the 'transition_comment_status' hook
  • r8073 to use the 'transition_post_status' hook

I think that handles the majority of imath's patch from this ticket. Going to close this one as a result.

Please open a new ticket if there are any new bugs that need fixing regarding post / comment statuses and the activity stream.


Although, JJJ is right about this:

Since we don't have activity trash, we can't easily pull this off. I'd almost rather wait until we have activity trash than worry about regenerating an unlimited number of comments in the activity stream.

We do have a ticket open for adding trash support to the activity stream - #2786.

#7 @johnjamesjacoby
10 years ago

  • Version changed from 1.6-beta to 1.6
Note: See TracTickets for help on using tickets.