Massive post edition

21 views
Skip to first unread message

Xavi Ivars

unread,
Sep 29, 2009, 2:18:17 PM9/29/09
to Magic Fields
Hi.

I have a Wordpress installed, and I had some custom fields on some
posts to simulate what this plugin does (I didn't know something like
that existed. It's great!)

Is there any option to mass add posts with some custom fields to a
post-type?

Hunk

unread,
Sep 29, 2009, 9:59:30 PM9/29/09
to Magic Fields
Hi
in the options of Magic fields (settings-> magic fields) enable the
option Editing Prompt.

this does that when editing post or page and not this relating to
write panel shows a page asking if you wish to relate it to some write
panel.

Xavi Ivars

unread,
Sep 30, 2009, 5:08:10 AM9/30/09
to Magic Fields
And if you have hundreds of posts published, is there any way to
assign them to a write panel? I've tried to configure Magic Fields
with an empty wordpress installation, and import all posts, but it
seems it does not work.

Any help? Thanks!

Xavi Ivars

unread,
Sep 30, 2009, 6:45:53 AM9/30/09
to Magic Fields
I got it!

After looking the source, I found this function : function
SetCustomWritePanel($postId); [1] that did the trick.

When saving a post, this function is invoked (this is the way
assigning a writepanel to a created-before-installing-magic_fields
post works).

So what I did was change my WXR files (Wordpress XML exported files)
and added to each item by hand (well, using a simple script) the
following tags:

<wp:postmeta>
<wp:meta_key><?php echo CUSTOM_PANEL_KEY ;?></wp:meta_key>
<wp:meta_value><?php echo CUSTOM_ITEM_TYPE ;?></
wp:meta_value>
</wp:postmeta>

where CUSTOM_PANEL_KEY is "_mf_write_panel_id" and CUSTOM_ITEM_TYPE
the id of the custom panel I want to add to this type.

So if anyone needs to massive add previous items to Magic Fields, you
can do it that way :D


[1] http://github.com/hunk/Magic-Fields/blob/master/RCCWP_Post.php#L24

Thanks for your great plugin!

Karl Kevilus

unread,
Sep 30, 2009, 9:32:32 AM9/30/09
to magic-...@googlegroups.com
This is fantastic!  I've got a lot of old posts that died with Flutter upgrades and the users have no ability to edit or change the older posts because of their limited role capabilities.  This will help a lot!

Thank you!
Karl

Xavi Ivars

unread,
Sep 30, 2009, 11:03:44 AM9/30/09
to Magic Fields
Ups, it's not complete. After that, you still need to update plugin
tables with function SetMetaValues [1].

I'll try to make a simple script that updates everything, and paste it
here.


http://github.com/hunk/Magic-Fields/blob/master/RCCWP_Post.php#L52

Xavi Ivars

unread,
Oct 2, 2009, 4:54:32 AM10/2/09
to Magic Fields

Finally, I managed to add my data to MagicFields using a (maybe too
much) customised script.

I'm sure you can optimise it but, as it is now, it works :D

No that I included in my WXR a custom field to assign a custom-write-
panel to each one of my posts, so this script should be used after
that. I'm sure it will be easy modified to include custom-write-panel
assign on it ;)

It has a little bit of verbose code (to show what are you doing at
each time).

http://gist.github.com/199568

Reply all
Reply to author
Forward
0 new messages