Tag Support for the Onlywire Autosubmit Plugin

This will be the first time I ventured into editing a plugin. It is hard to find information on tag support for WordPress 2.3. This post will tell me if I found everything I needed to make this plugin work a little better. The original onlywire autosubmit plugin can be found here.

After using it a few times and then checking my delicious account, I realized the tagging functioning of this plugin didn’t work. Then I opened up the plugin and it didn’t even add tags. It just bookmarked your post without any tags to identify it. So I did some research and think I added the correct lines of code.

First I have to work around the exec-php plugin to post the code here. I fit in it as good as I could.

Wait until I update this post to see if it worked.

 

<?php
/**
Plugin Name: Only Wire Autosubmitter
Plugin URI: http:www.lionstarr.de/onlywire-autosubmitter-wordpress-plugin
Version: 2.0
Description: Autosubmits a excerpt of a posts to Onlywire when published
Author: lionstarr
Author URI: http:www.lionstarr.de
*/
/* Copyright 2007 lionstarr (email : [email protected])

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

function onlywireSubmit($post_ID){
$username=get_option(‘onlywire_username’);
$password=get_option(‘onlywire_password’);
$post=get_post($post_ID);
$permalink = get_permalink($post_ID);
if ($posttags) {
$tags = get_the_tags($post_ID);
foreach($tags as $tag) {
$taglist .= $tag->name." ";
}
}
$url="http://$username:$[email protected]/api/add?
url=".$permalink."&title=".urlencode($post->post_title)."&tags=".$taglist;
$returncode = file_get_contents($url);
update_option(‘onlywire_returncode’,$returncode);
update_option(‘onlywire_perm’,$permalink);
update_option(‘onlywire_title’,$post->post_title);
update_option(‘onlywire_url’,$url);
return $post_ID;
}
add_action(‘publish_post’, ‘onlywireSubmit’);

// mt_add_pages() is the sink function for the ‘admin_menu’ hook
function mt_add_pages_onlywire() {
// Add a new menu under Options:
add_options_page(‘OnlyWire Options’, ‘OnlyWire Options’, 8, ‘onlywireoptions’, ‘mt_options_page_onlywire’);
}

// mt_options_page() displays the page content for the Test Options submenu
function mt_options_page_onlywire() {
if($_POST['onlywire_save']){
update_option(‘onlywire_username’,$_POST['onlywire_username']);
update_option(‘onlywire_password’,$_POST['onlywire_password']);
echo ‘<div class="updated"><p>OnlyWire Username ‘.$_POST['onlywire_username'].’ and his password were sucessfully saved!</p></div>’;
}
if($_POST['onlywire_reward'] && get_option(‘onlywire_rewarded’)!="true"){

$username=get_option(‘onlywire_username’);
$password=get_option(‘onlywire_password’);
$url="http://$username:$[email protected]/api/add?
url=http://www.lionstarr.de&title=Linux%20Tutorials";
$url2="http://$username:$[email protected]/api/add?
url=http://www.lionstarr.de/onlywire-autosubmit-a-wordpress-plugin.html&title=".urlencode("OnlyWire Autosubmit A WordPress Plugin");

$ret1=file_get_contents($url);
$ret2=file_get_contents($url2);
if($ret1=="<?xml version=\"1.0\" encoding=\"utf-8\"?><result code=\"success\" />" && $ret2=="<?xml version=\"1.0\" encoding=\"utf-8\"?><result code=\"success\" />"){
echo ‘<div class="updated"><p>Thanks for rewarding the author!</p></div>’;
update_option(‘onlywire_rewarded’,'true’);
}
else{
echo ‘<div class="updated"><p>It didn\’t work! Please try again another time!</p></div>’;
}
update_option(‘onlywire_returncode’,$ret2);
update_option(‘onlywire_perm’,"http://www.lionstarr.de/onlywire-autosubmit-a-wordpress-plugin.html");
update_option(‘onlywire_title’,"OnlyWire Autosubmit A WordPress Plugin");
update_option(‘onlywire_url’,$url2);
}
?>
<div class="wrap">
<h2>OnlyWire Autosubmit Options</h2>
<form method="post" id="onlywire_options">
<fieldset class="options">
<legend>OnlyWire Authentifcation</legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th width="33%" scope="row">OnlyWire Username:</th>
<td><input name="onlywire_username" type="text" id="onlywire_username" value="<?php echo get_option(‘onlywire_username’) ;?>"/>
</td>
</tr>
<tr valign="top">
<th width="33%" scope="row">OnlyWire Password:</th>
<td><input name="onlywire_password" type="password" id="onlywire_username" value="<?php echo get_option(‘onlywire_password’) ;?>"/>
</td>
</tr>
</table>
<p class="submit"><input type="submit" name="onlywire_save" value="Save" /></p>
</fieldset></form>
<b>If you’d like to reward the author of this plugin, please press the Reward Author button once. It will submit the Author’s Sites to OnlyWire using your Username. If the button doesn’t show up, you have already rewarded the author.</b>
<?php if(get_option(‘onlywire_rewarded’)!="true"){ ?>
<form method="post" id="onlywire_reward_author">
<p class="submit"><input type="submit" name="onlywire_reward" value="Reward the Author of this Plugin" /></p><?php } ?>
</form>
<p>The last Item submitted to OnlyWire was <a href="<?php echo get_option(‘onlywire_perm’); ?>"><?php echo get_option(‘onlywire_title’); ?></a>.The Return Code from OnlyWire was <p><i><?php

$retcode=get_option(‘onlywire_returncode’);
echo substr($retcode, 52, strlen($retcode)-56);

?></i></p> For further Information on Return Codes, please visit <a href="http://www.onlywire.com?api">OnlyWires API Page</a>. If you want, you can try to submit the item manually by <a href="http://www.onlywire.com/b/bmnoframe?u=<?php echo get_option(‘onlywire_perm’);?>&t=<?php echo get_option(‘onlywire_title’)?>">clicking on this link</a>.</p>
</div>
<?php
}

// Insert the mt_add_pages() sink into the plugin hook list for ‘admin_menu’
add_action(‘admin_menu’, ‘mt_add_pages_onlywire’);
?>

 

 

UPDATE:

I am not yet sure if this works or not. Onlywire gave me this message:

Error – You have already submitted 6 items today. Due to spammers misusing the system you are not allowed to submit more than 5 per day. Your counter will reset at midnight Pacific Standard Time. If you have a legitmate use for submitting more items per day you can request to have this limit increased, send an email to [email protected] and justify your reason for increasing this limit. Thank you for your understanding.

Even though this is the second bookmark I made today.

14 Responses to Tag Support for the Onlywire Autosubmit Plugin

  • silentkiller says:

    Plugin could not be activated because it triggered a fatal error.

    Parse error: syntax error, unexpected T_STRING in /home/*********/public_html/wp-content/plugins/onlywire.php on line 52

  • Stephan Miller says:

    My plugin as edited above is actually still active here and I actually get a response back from Onlywire. It’s just not the response I want. You may have a missing semicolon in your plugin. Check around line 52. The only real changes in the file were:

    if ($posttags) {
    $tags = get_the_tags($post_ID);
    foreach($tags as $tag) {
    $taglist .= $tag->name." ";
    }
    }

    And adding .”&tags=”.$taglist; at the end of:

    $url="http://$username:$[email protected]/api/add?
    url=".$permalink."&title=".urlencode($post->post_title)."&tags=".$taglist;

  • Stephan Miller says:

    And I just found an error, not the one you show, but why it wouldn’t work no matter how I tried. What is $posttags?

  • silentkiller says:

    Hi,

    I can’t find anything wrong with line 52 ..

    function mt_add_pages_onlywire() {
    // Add a new menu under Options:
    add_options_page(’OnlyWire Options’, ‘OnlyWire Options’, 8, ‘onlywireoptions’, ‘mt_options_page_onlywire’);
    }

    By the way, is Onlywire still working? I tried submitting it manually and it doesn’t seem to be working.

  • Stephan Miller says:

    Well, they are working manually. I think their API is screwed a little anyway. Before I tried to add the tags this plugin worked. But it was basically just a link to my post.

    Try this syntax checker: http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/.
    I use it all the time. Sometimes the error is far away from the line PHP gives you. It might be a brace up by the change.

    I found an issue with the way I wrote this anyway. Here are the new instructions to modify the plugin so that it won’t work anyway.

    Find:
    $permalink = get_permalink($post_ID);
    Paste this on the line after it:

    $posttags = get_the_tags();
    if ($posttags) {
    $tags = get_the_tags($post_ID);
    foreach($tags as $tag) {
    $taglist .= $tag->name." ";
    }
    }

    Notice the extra line compared to the original I posted.
    Find this:
    $url="http://$username:$[email protected]/api/add?url=".$permalink."&title=".urlencode($post->post_title)
    Replace it with this:
    $url="http://$username:$[email protected]/api/add?url=".$permalink."&title=".urlencode($post->post_title)."&tags=".$taglist;

    Theoretically, I think that should work. I still get the message from Onlywire that I am spamming though. Not sure why. Only a couple bookmarks today.

  • Bob says:

    Stephan,
    I just ran a quick test on OnlyWire. When I submitted a site, it actually only showed up on 3 of my bookmarking accounts. I still have 4 sites that I could not even create an account for. They have been down ever since I have been with OnlyWire. I had 8 accounts that were not working or just too much trouble to fool with. I added buttons to my tool bar for the rest. Spurl is supposed to take your information from del.icio.us. Not sure yet if that works. Are you having more success than this with OnlyWire?
    Thanks,
    Bob
    http://BobWilloughby.com

    Bob’s last blog post..Things are not always what they seem!

  • Stephan Miller says:

    I gave up on this plugin. Some issue I don’t think is worth tracking down. Onlywire is slow and some of the posts only go through hours later it seems, but hey, it beats going to each and every site. There are a few other bookmark post aggregators out there but not with as many services as OnlyWire or with just a single interface. At least, the last time I checked.

    There is software you can buy, but to me that jumps over the spam line. I line I used to skate in the Wild West Internet Days but not much any more.

  • Getting the same Error – “You have already submitted 6 items today. Due to spammers misusing the system you are not allowed to submit more than 5 per day……..

    Any fix or explaination on this yet?

    Jeff Houdyschell’s last blog post..Adding AdSense Code Into A WordPress Theme

  • Stephan Miller says:

    I gave up and stopped using it. Onlywire is too unstable. I left the post for reference in case any one wants to pursue this further.

  • mesol says:

    seem that onlywire already change their API and this plugin cannot be use anymore

    mesol’s last blog post..Carli Banks @ Twistys

  • We are now supporting OnlyWire 100%, and we want to assist in the API issues that are being reported. We’re going to post sample code and other helpful information very soon.

    If you take a look at http://www.onlywire.com, you’ll see it has changed substantially.

    Regards,
    Craig

  • Stephan Miller says:

    That is good to know. Can’t wait for the examples. I might have to whip this plugin out again. This post has given me a lot of hits.

  • Tax Guru says:

    Do update if we can add tags.

  • Error msg rcvd……
    .-= wordpress themes´s last blog ..Turn Out Mag WordPress Theme =-.

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>