chipplechipple

Blog - MT tip: How to move an entry to another blog

Technology MT tip: How to move an entry to another blog

Byrne Reese hinted me that I should write about my Movable Type hack to move an entry to another blog (within the same installation). I had found this trick in my early MT days, some 3-4 years ago, and it has been helpful many times since.

Say you've typed an entry and saved it in blog #1, but the entry was really meant for blog #2. Usually that would mean that you have to create a new entry in blog #2, copy-paste your title, body, etc., and then delete the unwanted entry from blog #1.

What I do is simply edit the mistaken entry, and in the address bar's URL I change blog_id=1 to blog_id=2.

Before: .../mt.cgi?__mode=view&_type=entry&id=4454&blog_id=1
After: .../mt.cgi?__mode=view&_type=entry&id=4454&blog_id=2

The "Go to" drop-down at the top then shows blog #2, and re-saving the entry will successfully move it there! Magic!

Beware though that if you had already published the entry in blog #1, you will have to rebuild your indexes/archives to erase its traces.


Update (2007/11/1): No, do not call shenanegans.

The "bug" allowing the above hack existed in MT 3 but was patched in MT 4. To re-enable it in MT 4, patch lib/MT/App/CMS.pm as follows.

1. Search for the word "shenanegans" (line #5147 in MT 4.01) and comment-out that if block by adding a # at the beginning of all lines.

#        # Make certain any blog-specific element matches the blog we're
#        # dealing with. If not, call shenanigans.
#        if (   defined($blog_id)
#            && ( exists $param{blog_id} )
#            && ( $blog_id != $obj->blog_id ) )
#        {
#            return $app->return_to_dashboard( redirect => 1 );
#        }

2. Find the save_entry sub (search for "sub save_entry {"), go 70 lines down (line #12171 in MT 4.01), and comment-out these 2 lines.

#        return $app->error( $app->translate("Invalid parameter") )
#          unless $obj->blog_id == $blog_id;

That's all!

Disclaimer: Be careful when editing MT system files. I'm not responsible if something goes wrong, or if the above patch doesn't work for you.

Posted on April 19, 2007 at 23:44 | Tweet |


Trackback


Comments RSS

Oh nice hack! thanks

Posted by Roy on April 20, 2007 at 00:48



« Passport renewal | Back to main page | Obey, Colette, Komaneko »