Serendipity to WordPress

I’ve moved a couple of my blogs from Serendipity to WordPress (mostly because I’ve discovered that Serendipity has some issues with newer PHP setups, but also because I’m getting lazy and WordPress’ admin panel is nicer than s9y’s ;-)).

Luckily someone else did already write a s9y->WP importer plugin. Sadly it didn’t support nested categories, so I changed a couple of things and here’s my Serendipity (S9Y) importer for WordPress 1.5 (hoping that noone else has already used that version number… the history of the plugin contains several authors :))

One snag: after the import, you’ll need to edit one of the categories (just open and save it) to fix the hierarchy. I don’t know why and honestly I don’t care :-P Worked for me, your mileage might vary.

Refer to this article for other useful migration tips.

This entry was posted in Software, SysAdmin and tagged , . Bookmark the permalink.

37 Responses to Serendipity to WordPress

  1. Jon says:

    Hey, saw your updated the code (1.5 is probably free, no one else has “claimed” it). Though your link to the source code does not work. Speaking of, would you mind if I took yours and checked it into the SVN repo I’ve got mine in? That way we have a continuing source of functioning code.

  2. Pingback: Hallo Welt … – RC505

  3. Pingback: Serendipity to WordPress – Importer version 1.5 | Snowulf

  4. AdamCO says:

    this plugin definitely does not work with wordpress 3.x — the install fails because of a lack of valid header and the even if you write in a valid header (which I did), this error message is thrown

    Fatal error: Call to undefined function register_importer() in [watever]/wp-content/plugins/s9y2wp/serendipity.php on line 706

    Anyone have better luck than me?

  5. Pingback: Serendipty auf Wordpress migriert | Cogito Ergo Blog

  6. AdamCO says:

    i just installed 2.9.2 and followed the instructions…worked great. since everything is in, i can just upgrade to 3.x whenever. thanks for your work on this plugin.

  7. rack says:

    Sorry to barge in. I am trying to use the serendipity.php file 1.4 but cannot follow the directions “put .php file in /import directory” because there is no import directory in 3.x.
    Does anyone know how to get that file into the IMPORT link in the ADMIN screen?
    Thank you
    Rack

    • rack says:

      oops…
      Logistic problem.
      I recently found that most themes, widgets, plugins ect do not work with older 2.x versions.
      I cannot design and layout a new site with an older version.
      I need to leave the Serendipity blog up and running. which has 8000 articles and about 10 new a day.
      I expect it to take me a month or so to layout, design, tweak, seo, server and such before I do the DB move and start it up.
      300 articles in the meantime will not make it to the WP blog.
      Cant have dat! :)
      Any ideas to rise out of my dilemma?

  8. rack says:

    I have installed 2.9, I assumed the .php file would work as there is a proper place to put it.

    My problem is kind of hard to explain. As you can see from the explanation above! :)
    It’s a process issue.
    To try and make it short.
    I need a way to get the serendipity.php file working in 3.3.

    • Simone Simone says:

      I’ve made a minor change to the plugin so that it can be installed as a normal plugin in WP 3.x. It also appears in the Import menu.

      I haven’t actually tested whether it works or not, though :-)

      If you want to give it a try (at your own risk! ;), it’s available at http://files.tellini.info/s9y2wp3.zip

      • rack says:

        WOw! Thanx. I have it in a special folder ready to go.
        It could be some time before I am ready to give it a try.
        I will be sure to let you know!
        Thanx again!!

      • rack says:

        Where should I put this newer serendipity.php file?

        • Simone Simone says:

          in the standard plugins directory: wp-content/plugins/

          Then you’ll have to activate it in the plugins section of the control panel and finally it’ll appear in the Tools->Import page

          • rack says:

            I get this when after I put serendipity.php into the /plugin directory in WP 3.3.1

            Fatal error: Call to undefined function register_importer() in /home/kick/public_html/kick/wp-content/plugins/serendipity.php on line 698

  9. rack says:

    Wow THANKS! I will let you know how it turns out… Thanks again rack

    • Simone Simone says:

      about the error above, are you sure you used the new version? (the one linked in the previous comment)

      There should be this line near the beginning of the serendipity.php file:

      require_once ABSPATH . ‘wp-admin/includes/import.php’;

      which is required to use the register_importer() function…

      • rack says:

        Me bag of hammers… :( I did get the serendipity files messed up and used the old one. Sorry. And thanx for bearing with me. Ok, it did the categories and then for users it stopped with this…

        Catchable fatal error: Object of class WP_Error could not be converted to string in /home/kick/public_html/kick/wp-includes/capabilities.php on line 497

        I am still ADMIN if that matters.

        • Simone Simone says:

          I was afraid it wouldn’t have been so easy :-)

          There must have been other API changes that require more work on the plugin. Unfortunately, at the moment I don’t have enough time to do it…

  10. Kevin says:

    I just tried the importer at http://files.tellini.info/s9y2wp3.zip

    I ran into an error importing users. I commented out that section, so that 0 users were imported, and everything worked from there.

    I have a small inconsequential blog that no one reads, so losing users was not a big deal to me.

  11. rack says:

    Abdussamad has update the import phps and I just used them. Pretty much the same instructions regarding the DB.
    I had 9200 articles so I set changed the 9000s to 12000.

    It went great except for one failure.
    This is the error:

    Error
    SQL query:

    UPDATE `wp_posts` SET `ID` = `menu_order` ,
    `guid` = CONCAT( “http://rackjite.COM/kick/?p=”, `menu_order` ) ,
    `menu_order` = NULL

    MySQL said:

    #1062 – Duplicate entry ’0′ for key ‘PRIMARY’

    My problem now is that though all the posts did move over, when you click on a category (which in some cases is a menu link) it seems to ignore the first 5000 articles and begins around Sept 2009 and then goes back to the beginning from there.
    I have left the WP permalinks at default, I saved edited categories and they link correctly it seems. If I change anything in the permalinks area all the categories lose their links and fall back to a link to the root.
    Not quite sure what to do? Any advice? Thanks Rack

    • Simone Simone says:

      that SQL error means you were trying to assign the same ID to two different posts, which of course cannot happen. The whole ID shuffling business is tricky and should be done only if really needed, otherwise you might get this kind of problems.

      If you can live with old incoming links to specific posts becoming invalid, you can simply avoid all that and just import the articles.

  12. rack says:

    Thanx!
    The traffic on my site is almost completely GOOGLE SEARCH. And they come for articles often 5 years old.
    Is that what you mean? That when they click on the search results they will get the root link and not the old article link?

    Think there is any benefit in doing the import over again?
    rackjite.com/kick

    • Simone Simone says:

      Yes, I meant that (in order to properly redirect users, though, you would also need to be able to configure mod_rewrite on the server, as described where you found those sql commands).

      Google will reindex your site, so after a while it’ll send users only to the right addresses.

      When I migrated my sites I didn’t really care about old links, so I didn’t even bother messing with the DB. As to your case, I think you’re the only one who should decide whether it’s worth it or not ;-)

  13. rack says:

    Well Thanx… I am going to give it another shot at importing. I did go into the S9y and repaired some overheads. One of the issues that puzzled doing the DB stuff after the import (9000 articles) was the two where it said put the number generated by this query in the next one. Both for articles and comments. The numbers generated were 5 digits. One was like 18,000 an the other 21000. And now I look at a new article or comment and its permalink number starts at those numbers, that seem strange.

    The big issue I must get past is the Categories which now all begin on Sept 7 2010 and go backwards. It skips the last 5000 articles or so. BTW, search this site does work properly. So I think I have it narrowed down to category permalink issues.
    The comment goofs I can live with, but lots of traffic come to my categories. And what they see is only Sept 2010 and older. I wonder if there are any REWRITES I can do in .htaccess to fix that?
    Thank you for your patience which is an old and forgotten matter to you! :)
    RJ

  14. rack says:

    Sorry to bother you again… I did the import over again using Abudsman three serendipity plugins. I did the pre import SQL queries to the WP database.
    When it was done. I checked it out before I did all those secondary queries and everything seems to work just fine. Been working it out and cant seem to get anything to fail. I have 9050 articles and 7500 comments, the all seem to be their and working.

    How important is that list of after import queries? Any that are a MUST DO?
    Thanx
    rack

  15. rack says:

    Thanx! One more general question if you will. :)

    I as advised to put the following in SETTINGS PERMALINK CUSTOM STRING

    /archives/%post_id%-%postname%.html

    And “categories” in category base.

    Everything now has /archive/ in the link. Is that a problem with SEO, or should I leave the /ARCHIVE out or is that what helped make it all work? Ya think? :)

    • Simone Simone says:

      they suggest to use that permalink structure only because it’s easier to maintain the same URLs as the old s9y blog, if you also perform all the ID-fixing SQL steps, otherwise feel free to use other permalink settings.

      As to SEO, having the post name in the URL is good, the “archive” bit is not a problem (nor a bonus).

  16. rack says:

    Up and running in WP but I have a permalink problem I can’t seem to fix. Too late now to go back and do it ever I am afraid.

    WP is making no changes to .htaccess. Permission is 666 which I can’t change from FTP.

    I am using default in permalink settings. http://rackjite.com/?p=123
    Anything else and I get the WP WHOOPS FILE NOT FOUND.

    It all works well internally and outside coming into the domain url.
    But Google results seem to have an /archive in the URL of all 9000 articles making 404s. (but I noticed today a day later that google has TWO results now for a string to me one works and one does not. Will the search engine bots fix this as the crawl?

    So I guess I need help with a custom structure string. I would like to include the postname.
    Do I need an .htaccesss code line to do or undo ARCHIVES.
    And do I need to go SSH to change the CHOD of the .htaccess file so maybe WP can do all this automatically?

    Traffic is poor!

    Troubles at… rackjite.com

    Thanx Simone, been a few days and I can’t seem to get any help anywhere else on this.

  17. Carl says:

    Thank you so much for this, you’ve helped me enormously. Converting from Serendipity 1.4.1 to WordPress 2.9.2 worked a charm after I changed the name of the s9y tables to remove the underscore in the table names. Really great work :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>