Skip to:
Content

bbPress.org

Opened 9 years ago

Last modified 4 years ago

#2850 new defect (bug)

Unable to move topics from one forum to another forum via admin

Reported by: netweb's profile netweb Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: Component - Topics Keywords: needs-patch
Cc:

Description

Repro:

  1. Create two forums
  2. Create a topic on the front end in one of the forums
  3. In the back end edit the topic and select the second forum to move the topic to and click update

Result:
The topic is not moved and the following error message displayed:
Are you sure you want to do this? Please try again.

Note: The Please try again includes a link to the topic post, e.g. /wp-admin/post.php?post=650&action=edit

Expected:
The topic to now be in the second forum

Workaround:
Editing the topic via the "frontend" and selecting the second forum and saving the topic correctly moves the topic to the second forum and updates both the original and the new forums with the correct topic and reply counts working as expected.

Related: #2717

Change History (7)

#1 @thebrandonallen
9 years ago

  • Keywords reporter-feedback added

This works for me on the lastest trunk. Can you test it to be sure?

#2 @netweb
9 years ago

  • Keywords reporter-feedback removed

Half way there....

The topic has indeed been moved to the destination forum with no errors shown.

Though the forum topic and post count meta has not been updated, see screenshot:

https://cldup.com/BVp1015NPv.png

Running the repair tools fixes the forum meta:

https://cldup.com/Fo4rxRNeWc.png

Edit: In both screenshots above they are the "top level" forum view, i.e. http://example.com/forums/

When viewing each of the forums the counts have been updated and are correct without running the repair tools:

Last edited 9 years ago by netweb (previous) (diff)

#3 @netweb
9 years ago

  • Milestone changed from Awaiting Review to Under Consideration

Some more testing.... This time a topic with a reply:

After moving the topic, the topics post and postmeta data in the database is perfect, the replies, not so much

Each reply's wp_postmeta _bbp_forum_id is not updated with the new forum id, it remains the old forum id.


After moving the above topic to the new forum the new forum http://example.com/forums/forum/2850-destination-forum/ now has two topics in it but still displays the following in the forum header:
This forum contains 1 topic, and was last updated by admin 19 hours, 57 minutes ago.


After moving the above topic to the new forum the old forum http://example.com/forums/forum/2850-source-forum/ now has zero topics in it but still displays the following in the forum header:
This forum contains 1 topics and 2 replies, and was last updated by admin 16 minutes ago.


So it looks like as part of bbp_move_topic_handler()

  • Replies should be updated with their new forum ID by bbp_update_reply_forum_id() here
  • $old_forum_ancestors forums should by updated by bbp_update_forum() here
  • $new_forum_ancestors forums should by updated by bbp_update_forum() here

The bbp_move_topic_handler() should be called when editing the topic by bbp_edit_topic_handler() here

It looks like we just need to check when in the back end saving the topic if the forum parent ID has changed to call bbp_move_topic_handler() in BBP_Topics_Admin::attributes_metabox_save about here similar to how bbp_edit_topic_handler() checks and calls bbp_move_topic_handler() here.

#4 @johnjamesjacoby
7 years ago

  • Milestone changed from Under Consideration to 2.6.1

Related to #1799. <3

#5 @johnjamesjacoby
5 years ago

  • Milestone changed from 2.6.1 to 2.6.2

Move these to 2.6.2.

#6 @johnjamesjacoby
5 years ago

  • Milestone changed from 2.6.2 to 2.7

#7 @johnjamesjacoby
4 years ago

#3391 was marked as a duplicate.

Note: See TracTickets for help on using tickets.