Skip to:
Content

bbPress.org

Opened 5 years ago

Closed 5 years ago

#2577 closed defect (fixed)

Imported closed/locked topics missing 'publish' postmeta `_bbp_status`

Reported by: anastis Owned by: netweb
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5.3
Component: API - Importers Keywords:
Cc:

Description

When a thread in phpBB is locked, it correctly get imported as a closed topic.

However, if you try to Open the imported topic, it's changing to draft instead of published, effectively hiding the topic's content.

Furthermore, if you hit Publish on that topic from the WP backend, it then works properly.

I think I've tracked down the issue. When imported, the locked threads/closed topics don't get a record in the wp_postmeta table, with key _bbp_status and value publish

Once I manually add this (without editing the topic), it's then working correctly.
This also gets created when I re-publish the topic from the WP backend (which I already mentioned, works properly).

Attachments (1)

2577.diff (6.6 KB) - added by netweb 5 years ago.

Download all attachments as: .zip

Change History (11)

#1 @anastis
5 years ago

  • Version set to 2.5.3

#2 @netweb
5 years ago

  • Milestone changed from Awaiting Review to 2.6
  • Summary changed from phpBB - Locked threads - Closed topics to Imported closed/locked topics missing 'publish' postmeta `_bbp_status`

Confirmed and thanks for this.

I'll work out a patch for this shortly as this affects all the importers that have support for closed or locked topics.

#3 @netweb
5 years ago

Looking at the way importer currently does it's thing and the way bbPress uses _bbp_status for topics and forums adding a new _bbp_status field in wp_postmeta for every topic is not something we want to do.

In #2347 I added a 'Post Import' repair tool for phpBB anonymous/deleted users so I think I will extend this to also add a if imported forum or topic was closed add _bbp_status = publish section to this tool. I'll try to keep in mind making this work retrospectively for people who have already performed their import.

#4 @anastis
5 years ago

Sure thing. I can't comment on the best approach for a solution, as I've only used bbPress since yesterday, so I'll need to take your word for it.

For reference, the way I fixed my installation is this:

$tmp_posts = new WP_Query(array(
	'post_type' => 'topic',
	'posts_per_page' => -1,
	'post_status' => 'closed',
));

while($tmp_posts->have_posts())
{
	$tmp_posts->the_post();
	global $post;
	
	$status = get_post_meta($post->ID, '_bbp_status', true);
	if( empty($status) )
	{
		update_post_meta($post->ID, '_bbp_status', 'publish');
	}
}
wp_reset_postdata();
unset($tmp_posts);

I hope this will shave some seconds of your load :)

@netweb
5 years ago

#5 @netweb
5 years ago

  • Keywords has-patch added

In 2577.diff:

  • Add a new repair tool "Recalculate imported closed topics."

I'm going to refresh #2347, I'll probably merge this tool with that tool so the there is only a single 'post import' repair tool.

#6 @netweb
5 years ago

  • Keywords needs-refresh added; has-patch removed
  • Owner set to netweb

This needs refreshing, this should be added to converter.php to include closed topics _bbp_status postmeta status publish during import and not just a repair tool for legacy imports.

#7 @netweb
5 years ago

Related: #2653 Closed topics missing _bbp_status post meta key

#8 @netweb
5 years ago

In 5425:

Re-factor importing closed topics to import the closed status and update the closed topic post and post meta status using bbp_close_topic(). See #2577

#9 @netweb
5 years ago

In 5426:

Update bbPress forum importers to support new closed topic import method introduced in r5425. See #2577

#10 @netweb
5 years ago

  • Keywords needs-refresh removed
  • Resolution set to fixed
  • Status changed from new to closed

Marking this as fixed per r5425 and r5426 commits:

See #2653 For the closed topics repair tool
See #2654 for bbPress 2.6 database upgrade routine

Note: See TracTickets for help on using tickets.