石锅拌饭

How to make ecto work with Ultimate Tag Warrior - Part II

by Robin Lu on Mar.19, 2006, about , , , , , ,

[update: I have updated downloadable xmlrpc.php example for wordpress 2.1. It also fixes the wordpress 2.1 bug when getting category via xmlrpc. Check the end of the post. 2007-02-20]

I once wrote about “How to make ecto work with Ultimate Tag Warrior”. In that article, I discussed how to make the wordpress with UTW plugin recognize tag information sent by ecto. It works well except that some friends reported after the post is published, the tag information can not be stored in ecto. It means you lose track of all the tag information in ecto. When you edit a post, you have to set the tags again, which is very inconvenient.

From a post in the ecto forum, I knew that ecto recognizes mt_keywords. After some more hacking of xmlrpc.php, I fixed the problem. Now, you can not only use ecto to publish your post with tag information but also get tag information from your post. Here’s how (UPDATE: be sure to follow the steps in Part I before applying following steps. Thank Bruce for your reminding and all the helps):

First, you need to add one function in xmlrpc.php before the class wp_xmlrpc_server is defined:

/* ROBIN LU HACK get keywords */
function ecto_get_keywords($postid) {
$utw = new UltimateTagWarriorCore();
$tags = $utw->GetTagsForPost($postid);
$postkeywords = '';
if (is_array($tags)) {
foreach($tags as $data) {
if(!empty($data) &&
!empty($postkeywords))
$postkeywords .= ", ";
$postkeywords .= $data->tag;
}
}
return ($postkeywords);
}

Then, add this line

'mt_keywords' => ecto_get_keywords($postdata['ID']),

in function mw_getPost at where $resp is set:

$resp = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $postdata['post_author'],
'postid' => $postdata['ID'],
'description' => $post['main'],
'title' => $postdata['post_title'],
'link' => $link,
'permaLink' => $link,
// commented out because no other tool seems to use this
//	      'content' => $entry['post_content'],
'categories' => $categories,
'mt_excerpt' => $postdata['post_excerpt'],
'mt_text_more' => $post['extended'],
'mt_allow_comments' => $allow_comments,
//ROBIN LU HACK
'mt_keywords' => ecto_get_keywords($postdata['ID']),
'mt_allow_pings' => $allow_pings
);

Then add this line:

'mt_keywords' => ecto_get_keywords($entry['ID']),

in function mw_getRecentPosts() at where $struct[] is assigned like this:

$struct[] = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'],
'postid' => $entry['ID'],
'description' => $post['main'],
'title' => $entry['post_title'],
'link' => $link,
'permaLink' => $link,
// commented out because no other tool seems to use this
//	      'content' => $entry['post_content'],
'categories' => $categories,
'mt_excerpt' => $entry['post_excerpt'],
'mt_text_more' => $post['extended'],
'mt_allow_comments' => $allow_comments,
//ROBIN LU HACK
'mt_keywords' => ecto_get_keywords($entry['ID']),
'mt_allow_pings' => $allow_pings
);

Save your xmlrpc.php and refresh in ecto. You will get all the tag information back to you.
There are xmlrpc.php files for different wordpress version:

:, , , , , ,

35 Comments for this entry

  • Bruce

    Thanks Robin; it works sweet :-)

    Just to clarify for visitors who land on this page: you need to read and follow Part 1 first.

    Also, I can verify the (5 in total) edits work with the xmlrpc.php file from WordPress 2.0.2.

    Cheers, Bruce

  • Jeremy

    Wow, I’m impressed. I like Ecto, but once I started using UTW I thought there was no way I could use it. You’ve solved that problem. Great work, and thanks.

  • Adam Rice

    Hmm, I’ve installed your hacked xmlrpc on a vanilla WP 2.01 install, and I can use the keywords field to create tags, but the tags do not come back into Ecto when I edit an entry in it. Any ideas?

  • Robin Lu

    which version of ecto are you using? You may want to use the ecto console to see what happens

  • Adam Rice

    I’m using Mac Ecto 2.4.1 (current). I’m pretty sure I’ve got everything set up according to your instructions. It doesn’t look like there’s any transaction requesting the keywords–I’d be happy to e-mail you a copy of the console transcript, if you’re interested.

  • Adam Rice

    You know what? I’m an idiot. Ecto *is* retrieving the tags. I was looking for them in the “keywords” field, not the “tags” pane.

    That said…I’m guessing there would be a way to hack the xmlrpc file to return those tags to the keywords field.

  • David Evans

    I made the changes and Ecto is displaying the tags. Now, the notification options of ping or email are greyed out. Any ideas what is causing this?

  • Robin Lu

    David, it could be an ecto issue. You can go to ecto support forum to have a try.

  • Robin Lu

    David, I found the notification options are only greyed out when I edit the blog after it has already been posted. I think it is reasonable feature of ecto. what do you think?

  • Ralph

    Robin, before i start messing around with the xmlrpc file and wonder why something is broken, is the hack also supposed to work with WordPress 2.0.4?

  • Robin Lu

    I didn’t test it on WordPress 2.0.4. Use this hack on your own risk.

  • Dan Bruno

    I just tested this hack on WordPress 2.0.4, and it worked fine.

  • mois

    similar problem: i would like to do have tagging with SharpMT PocketPC, too. this blogging software uses movable type as i know and offers a keywords field as well. it nicely works with the wordpress standard xmlrpc.php which writes the movable type posting into the worpress database. but xmlrpc.php seems to dump the keywords data. i installed Robin Lus xmlrpc and played around with it but couldn’t get tags out of it…
    any ideas?

  • David Evans

    Any word on whether or not this works with Wordpress version 2.0.5? I just reinstalled Ecto and now tags aren’t being retrieved, even though I changed the tags template setting to use the keywords field.

  • joonhwan

    Does it work with WP 2.1? I tried the modification, and now I can post tags with ecto, but cannot retrieve tag list from the server.

  • Paul

    Same problem here with WP 2.1. The MOD works, however two things happen:

    • the tags that I assocciated with specific posts using Ecto come back unchecked in Ecto after posting

    • Ecto does not pick up the tags that I incorporated in the WP admin panel before the MOD

    As noted, the tags show up in the blog posts correctly.

    Any news on this?

    thanks for the MOD …

    -ptfigg.

  • Robin Lu

    Thanks for reporting the problem. I will check it soon.

  • Ulrich

    Hi.. Brilliant Hack… I really need this and I’m trying to make your guide available in Danish.. Unfortunatly I allso have troubble making it work in WP 2.1

  • Dave Evans

    I’m having same issue. It would be great to have a link to an edited xmlrpc file for the various versions of WP, saves many people lots of time, just download and drop in folder.

  • Vincent

    Any update on this Mr. Lu? Ecto-Tags effectively broken with WP 2.1 :(

  • Dave Evans

    1) The xmlrpc file you provided needs to be updated for WP 2.1.1.

    2)Why in the world did you change the code in the Main WP trunk to fix the categoryId string problem from string to strval? Is this why it’s broken again? Man I am tired of chasing these UTW issues down, spending hours a day, ugh. I’m ready to go back to Movable Type. /end rant.

  • Robin Lu

    Dave:
    That’s why your suggestion doesn’t work. I don’t provide xmlrpc file for each version of WP. I’ve already provided how. I don’t owe you the fix and don’t care which blog system you are using.

  • Dave Evans

    You don’t care which system your users are using? That’s not the the most appropriate comment to make judging by all the problems we are encountering. You’re right, you don’t owe us anything, a telling statement about your ongoing maintenance of UTW. You still didn’t answer my question about rewriting the code.

  • Robin Lu

    Dave:
    You are not my user. I am a user of wordpress, ecto and UTW myselft just as you. I just happened to scratch my own itch and shared how I scratched. If you choose to use my fix, you are on your own risk.
    When I was fixing the categoryId bug, wordpress 2.1.1 is not releasing and I didn’t check how they fixed it. I used strval and it works for me. That’s it.

  • Dave Evans

    I confused you with the UTW creator, my bad. Your page is a great resource. I wish we could delete the 100 blog posts that address stale UTW/WP/Ecto issues which is what is confusing everyone. One page, one description, one solution, for various configurations and setups. Would save hundreds of lost hours.

  • Vincent

    So has anyone managed to get this working with WP 2.1.1? I upgraded just before I saw this fix, and I think the WP-people changed/broke something again.

  • David Evans

    I can’t get tags to be set with with 2.1.2. Older posts’ tags are downloading into Ecto just fine, but new posts don’t get tags set.

  • miklb

    Just a FYI for UTW/ecto users, you can use the built in feature of UTW to add tags to your posts by using [tags]foo, bar[/tags]. The only issue I’ve seen so far is that though that won’t show in the post, it will show in your RSS feed.

  • Adam Rice

    I’m having the same experience that David Evans reports.

    I’ve tried using both the hacked xmlrpc file you provide here, and manually adding your code into the standard xmlrpc file.

  • Kay

    I tried the hack and the tags from my posts show up in ecto, but it doesn’t work with posting with tags :-(

    Using 2.2 with the latest UTW.

    Any help?

  • AltaGid

    Hello! Help solve the problem.
    Very often try to enter the site, but says that the password is not correct.
    Regrettably use of remembering. Give like to be?
    Thank you!

  • mark paulsen

    what is the coding for the posting tag like this???

18 Trackbacks / Pingbacks for this entry

Archives

Browse by tags