Project:Wordpress Import
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:lavamind
Status:needs review

Issue Summary

Relationship parent/child of pages isn't imported.

To be imported would be good make a menu called Wordpress pages linking to with all pages as child

Comments

#1

I'd like to second this. I'm trying to import over 100 pages with a deep hierarchy and not retaining the structure would be horrible.

#2

Status:active» closed (fixed)

Branch 5.x is no longer supported.

But for the record, this is fixed in 6.x-2.x-dev.

#3

Version:5.x-1.x-dev» 6.x-2.x-dev
Status:closed (fixed)» active

Hi, is this actually fixed in 6.x-2.x? In the .module file, I don't see any reference to the wp:post_parent tag, which you would need to use to retain the menu hierarchy.

It would be additionally useful if you could target a particular menu and menu level to import into. We are going to try to use this module to import our client's content exported in the WXR format from Jumpchart, and this is useful if the Jumpchart content is only specific to one section of the website.

#4

I have started working on this feature. I can choose a menu to import into and then it creates its own root called "Wordpress import" and creates menu items for everything beneath that. It's very hacky at the moment but it works. I will post a patch when I'm happy with it...

#5

Version:6.x-2.x-dev» 6.x-2.0

So, risking embarrassment, here is what I have so far. Nobody commented on this post yet, so I just want to make sure I'm not wasting time/energy on this. This work was done against release 6.x-2.0. There are a lot of log messages made in this code that I didn't remove because I'm still finding them useful.

It is clunky because of where the menu is imported — I hacked it onto the end of the last batch, but there must be a better way. Also, it uses recursion, which might be frowned upon. This is my first real foray into helping out with an existing module. I didn't know how one would create the menu structure in batches, since you can't be sure a menu item's parent has been created yet or not. All the nodes must already be created because you need the nid to create the menu items. Any suggestions on a better way to do this are incredibly welcome.

Also, it creates a root "Wordpress import" item that you can move after the import — it would be better if you could choose to either create a new menu item as the root, or choose your own menu item to import beneath.

And most importantly, I haven't actually tested this with any real Wordpress WXRs, only those exported from Jumpchart. I don't think this should make much of a difference, but it might.

I used svn to create the patch. I don't know if that makes a difference either. Can you tell I'm new here?

AttachmentSize
import_menu.diff 7.31 KB

#6

I was confused about how the batch process worked... it's perfect for this. If you want to be sure all the nodes are created, do the menu items in the second batch. I've added a second operation for the menu and got rid of the hacky code in the _process_blog function. I've also evaluated that this correctly patches 2.0 and 2.x-dev.

AttachmentSize
import_menu.diff 6.96 KB

#7

Version:6.x-2.0» 6.x-2.x-dev
Assigned to:Anonymous» lavamind
Status:active» needs review

I think this issue was closed by mistake, thanks for reopening it.

I looked quickly through the patch, and at first sight it looks very nice. However I will need more time to test it against the latest dev version with real WXRs generated by Wordpress. I must admit though I'm unfamiliar with page hierarchies in Wordpress.

If anyone else is willing to help test this patch, it would certainly speed up things.

#8

Really I've switched all websites to drupal ... I'm not longer wordpressed till now ... .. ;)
But I hope someone could help. I could run a testing installation on localhost, but no time for now. Sorry!

#9

I think I discovered a kind of obscure bug with this patch. I was using Views Bulk Operations to delete all nodes under a certain menu parent, and it couldn't find any nodes that hadn't been saved after the import. I don't think this code does a full menu insert somehow. I'm looking into it (because I'm using this module again after 5 months...)

nobody click here