Skip to:
Content

bbPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 5 years ago

#2668 closed enhancement (fixed)

Importers: Include Subscribed Forums, Subscribed Topics and Favourite Topics

Reported by: douglsmith's profile douglsmith Owned by:
Milestone: 2.6 Priority: normal
Severity: normal Version:
Component: API - Importers Keywords:
Cc: doug@…

Description

In doing a large bbPress 1.x conversion I noticed that user's favorites were not converted and that there is currently no code in the converters to do so. Is this something that should be included? I know at least in this case it's very important to the users.

Change History (21)

#1 @netweb
9 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect to enhancement

Sounds reasonable enough and I've wanted to look at this for sometime so I just took a quick look.

Adding the following to the users section of bbPress1.php nearly does the trick, the issue is because we import the users before topics we do not yet have the new topic ID.

(I tried adding similar code to the topics section to get around the above but the way favorites are stored in the bb_usermeta table we cannot map a key field to based on each topic id as they are imported.)

The goal with the following would be to then after the topics are imported to go through each _bbp_old_favorites_id field and create a new meta field in wp_usermeta.wp__bbp_favorites with each user id and new topic id.

This however all falls over if you are only importing BuddyPress Group Forums to upgrade to bbPress 2.x forums as there is no need to import the users, so in a bbPress 1.x to 2.x import this will kind of work.

// User favorites (Stored in usermeta)
$this->field_map[] = array(
	'from_tablename'  => 'usermeta',
	'from_fieldname'  => 'meta_value',
	'join_tablename'  => 'users',
	'join_type'       => 'LEFT',
	'join_expression' => 'ON usermeta.user_id = users.ID AND usermeta.meta_key = "bb_favorites"',
	'to_type'         => 'user',
	'to_fieldname'    => '_bbp_old_favorites_id'
);

Then when I look to add something similar for some of other importers it gets bad pretty quickly.

I'm going to put this ticket in 'Future Release' for now until some fresh ideas arise.

#2 follow-up: @douglsmith
9 years ago

I have my WordPress and bbPress 1.2 integrated so my users IDs don't change on import. I see that the importer stores a "_bbp_old_topic_id" meta_key in postmeta to map old and new post IDs. That's not too bad in my case for looking up and building a new favorites meta for bbPress 2.

Is there anything saved that maps the old user id to the new one that could be used when users are imported? If so, would the favorites conversion be better to do using those things in its own pass after everything else is done?

#3 @douglsmith
9 years ago

  • Cc doug@… added

#4 in reply to: ↑ 2 @netweb
9 years ago

Replying to douglsmith:

I have my WordPress and bbPress 1.2 integrated so my users IDs don't change on import. I see that the importer stores a "_bbp_old_topic_id" meta_key in postmeta to map old and new post IDs. That's not too bad in my case for looking up and building a new favorites meta for bbPress 2.

Yes _bbp_old_topic_id should be able to remap the old bb_favorites topics to the new wp__bbp_favorites topics.

Is there anything saved that maps the old user id to the new one that could be used when users are imported? If so, would the favorites conversion be better to do using those things in its own pass after everything else is done?

I have a pretty big update for all of bbPress importers and the main converter.php file that I will be adding in the next day or so. Primarily the changes ensure that we have an 'old' forum, topic, reply, user ID's so we can do exactly the type of thing you are looking to do here.

In fact, if you have already have performed an import and look at the wp_usermeta table you will see an entry for _bbp_user_id and this is in fact is the old user ID, the updates will rename that field to _bbp_old_user_id and update the logic in converter.php

I'll post an update to this ticket after I upload the changes and you can take a look and we can go from there.

#5 @netweb
9 years ago

  • Milestone changed from Future Release to 2.6

Moving to 2.6, will add a patch and commit next week.

Related #2716

#6 @netweb
9 years ago

In 5571:

Add support to converter.php to allow importing Subscribed Forums, Subscribed Topics and Favourite Topics
Props netweb. See #2668

#7 @netweb
9 years ago

In 5572:

bbPress 1.x importer: Include Subscribed Topics and Favourite Topics
Props netweb. See #2668

#8 @netweb
9 years ago

In 5573:

FluxBB importer: Include Subscribed Forums and Subscribed Topics
Props netweb. See #2668

#9 @netweb
9 years ago

In 5574:

Phorum importer: Include Subscribed Topics
Props netweb. See #2668

#10 @netweb
9 years ago

In 5575:

PunBB importer: Include Subscribed Forums and Subscribed Topics
Props netweb. See #2668

#11 @netweb
9 years ago

In 5576:

SMF importer: Include Subscribed Forums and Subscribed Topics
Props netweb. See #2668

#12 @netweb
9 years ago

In 5577:

vBulletin 4 importer: Include Subscribed Forums and Subscribed Topics
Props netweb. See #2668

#13 @netweb
9 years ago

In 5578:

vBulletin 3 importer: Include Subscribed Forums and Subscribed Topics
Props netweb. See #2668

#14 @netweb
9 years ago

In 5579:

XenForo importer: Include Subscribed Forums and Subscribed Topics
Props netweb. See #2668

#15 @netweb
9 years ago

In 5580:

Example importer: Include Subscribed Forums, Subscribed Topics and Favourite Topics
Props netweb. See #2668

#16 @netweb
9 years ago

  • Resolution set to fixed
  • Status changed from new to closed
  • Summary changed from Importing from bbPress 1.x does not import favorites to Importers: Include Subscribed Forums, Subscribed Topics and Favourite Topics

Pretty sure this is all done now, marking as fixed.

#17 @douglsmith
9 years ago

Thanks, @netweb. I just ran a pretty good size bbPress 1.x forum through the new converter. I'll add some feedback once I get a chance to examine the results more closely.

#18 @netweb
9 years ago

Thanks Doug, a second set of eyes would be appreciated :)

#19 @netweb
9 years ago

In 5796:

phpBB importer: Include Subscribed Forums, Subscribed Topics and Favourite Topics
Props netweb. See #2668

#20 @johnjamesjacoby
7 years ago

In 6184:

Converter: Convert favorites & subscriptions to postmeta vs. usermeta.

  • Update table names
  • Support for comma-separated string values
  • Use strict comparisons where it makes sense to

See #2959, #2668.

#21 @johnjamesjacoby
5 years ago

Assigning all closed & unassigned tickets in the 2.6 milestone to myself.

Note: See TracTickets for help on using tickets.