Skip to:
Content

Opened 5 years ago

Closed 4 years ago

#2669 closed defect (fixed)

Repair tool bbp_admin_repair_forum_meta() incorrectly adding _bbp_forum_id meta keys to forums

Reported by: netweb Owned by: netweb
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5
Component: Tools Keywords: has-patch commit
Cc:

Description

Any forum that currently includes a forum _bbp_forum_id post meta key is due to either:

  • 1. Running the repair tool "Recalculate parent forum for each reply" (bbp_admin_repair_forum_meta())
  • 2. The forums were imported as the imports include the _bbp_forum_id meta key

Attached patch removes this from the bbp_admin_repair_forum_meta() repair tool

Existing forums with _bbp_forum_id should be removed as part of #2654 bbPress 2.6 Database upgrade.

Attachments (1)

2669.diff (3.5 KB) - added by netweb 5 years ago.

Download all attachments as: .zip

Change History (5)

@netweb
5 years ago

#1 @netweb
4 years ago

Theoretically what this part of the bbp_admin_repair_forum_meta() repair tool was trying to achieve was to add a meta key _bbp_forum_id to each forum with the forum ID of the parent forum.

SELECT  forum.ID ,  '_bbp_forum_id',  forum.post_parent 
FROM  wp_posts AS  forum 
WHERE  forum.post_type =  'forum'
GROUP BY  forum.ID 

When a new forum is created with bbp_insert_forum() the following forum meta is created:
https://bbpress.trac.wordpress.org/browser/trunk/src/includes/forums/functions.php#L52

	// Forum meta
	$forum_meta = bbp_parse_args( $forum_meta, array(
		'reply_count'          => 0,
		'topic_count'          => 0,
		'topic_count_hidden'   => 0,
		'total_reply_count'    => 0,
		'total_topic_count'    => 0,
		'last_topic_id'        => 0,
		'last_reply_id'        => 0,
		'last_active_id'       => 0,
		'last_active_time'     => 0,
		'forum_subforum_count' => 0,
	), 'insert_forum_meta' );

#2 @netweb
4 years ago

  • Keywords commit added

#3 @netweb
4 years ago

In 5782:

Tests: Add admin tools test test_bbp_admin_repair_forum_meta() for bbp_admin_repair_forum_meta()

Props netweb. See #2669

#4 @netweb
4 years ago

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

In 5783:

Tools: Forums should not include forum meta key _bbp_forum_id, forums with this meta key were due to either:
1) Incorrectly added by the bbp_admin_repair_forum_meta() repair tool
2) Incorrectly added by an old version of one of the included bbPress importers, these were fixed in r5526

Props netweb. Fixes #2669

Note: See TracTickets for help on using tickets.