Wordpress Plugin: CR-Post2Pingfm

Hi there, this is my second attemp at creating wordpress plugin. In this one, I create a plugin that will automatically send a short update to ping.fm for each time you hit the Publish button. To use it, you will need a ping.fm Application Key. This little plugin utilize PHPingFM API by Dmitri Gaskin.

To use it, first download the plugin and upload it to your /wp-content/plugins/. Enable it from your wordpress administration panel. Then, enter the Application Key in Settings » CR Post2Pingfm

That’s it, now, everytime you hit Publish, this little plugin will automatically post an update to ping.fm. But do remember, that once the post is published, it will never submit to ping.fm again and again. Because, you don’t want to annoy your follower right?


UPDATE:

  • 2009-04-09 01:23:59: Download now handled by wordpress plugin repository
  • 2009-06-11 15:27:30: Version 0.7 released with main feature is the ability to republish and setting another republish template
  • Hi,

    I just installed this on wp 2.9.2 and it doesn't seem to be working. If it was working I should be seeing my new submission in the "Recent Posts" in Ping.fm, right?

    I can't find one script that works for Ping.fm. Can it be my theme or a conflict with another plugin?
  • Hi Gwyneth,

    Is it working on WP MU 2.9.2?
  • I'm testing cr-post2pingfm 0.9 on WP MU 2.9.2 — and I surely hope you're right, Arief, and that with WP 3.0 or so there is no further differences between WP and WP MU! The differences are already very small. The major one is that WP MU doesn't care much about "legacy access" to plugin options — you have to use the new functions for that (which actually make more sense!). It's possible that WP 3.0 drops the support for legacy access to the options. I have no idea, and I haven't checked :)
  • Sorry to say this, but I think your plug-in stopped working after the upgrade.

    I use this on several sites and upgraded each one and they stopped working.
  • Are you sure?
    Because, I too used it on several sites and there's no problem after upgrading.
  • Is this working with the latest version of wordpress ? (2.91)
  • Confirmed. My plugin worked on wp 2.9.1.
    I just test it on this blog.
  • Hi,

    I'll try to test in tonight on my 2.9.1 installation. I'll report it back soon.
  • Hey I got your plugin working on Wordpress MU 2.8.4 by modifying how options are used, following this guide: http://planetozh.com/blog/2009/05/handling-plug...

    You should update it! (took me all of 10 minutes)
  • It would be nice if you could post your code, Stefan :)
  • Well, here goes the changed cr-post-2-pingfm.php — for me, it works fine under WordPress MU 2.8.4, using these guidelines:


    cat_ID;
    $categories[] = $cats->category_nicename;
    }
    $continue = isCategoriesAllowedToPing($postId, $categories);
    }

    if($continue)
    {
    update_option('cr_post_2_pingfm_submit_post_submitted_'.$postId, true);
    submitPingFM($postId, $republish);
    }
    }
    }


    function cr_post_2_pingfm_submit_config_admin()
    {
    add_options_page('CR Post2Pingfm', 'CR Post2Pingfm', 8, __FILE__, 'cr_post_2_pingfm_submit_config_form');
    }

    function cr_post_2_pingfm_submit_config_form() {
    ?>
    CR Post2Pingfm








    Ping.fm Application Key
    <input type="text" size="45" name="cr_post_2_pingfm_options[cl_post_pingfm_api_key]" value="" />



    Ping Template
    <input type="text" size="45" name="cr_post_2_pingfm_options[cl_post_pingfm_message_template]" value="" />
    Template Tags: {title} for Post Title and {url} for Permalink URL
    eg: I just post {title} on {url}



    Ping mode

    Allow submit new post to ping.fm:
    <input type="radio" name="cr_post_2_pingfm_options[cl_post_pingfm_ping_mode]" value="all" />For all categories (all)
    <input type="radio" name="cr_post_2_pingfm_options[cl_post_pingfm_ping_mode]" value="allow" />For this categories (allow)
    <input type="radio" name="cr_post_2_pingfm_options[cl_post_pingfm_ping_mode]" value="deny" />For categories except this one (deny)
    Category list (category ID and slug is supported)<input type="text" name="cr_post_2_pingfm_options[cl_post_pingfm_ping_mode_category]" value="" />(comma separated, eg: 1,23,random-caregory,10,rants)
    Category list is ignored if mode all is selected.




    Publish mode

    Allow submit to ping.fm on the following condition:
    <input type="radio" name="cr_post_2_pingfm_options[cl_post_pingfm_publish_mode]" value="once" />Only submit for the first time(once)
    <input type="radio" name="cr_post_2_pingfm_options[cl_post_pingfm_publish_mode]" value="all" />For everytime you push publish button(all)




    Re-Publish template

    This option only used if you choose all in publish mode.
    <input type="radio" name="cr_post_2_pingfm_options[cl_post_pingfm_republish_template]" value="above" />Use Ping Template above
    <input type="radio" name="cr_post_2_pingfm_options[cl_post_pingfm_republish_template]" value="this" />Use this template
    <input type="text" size="45" name="cr_post_2_pingfm_options[cl_post_pingfm_ping_republish_template_text]" value="" />
    The above template tags, apply.








    <input type="submit" class="button-primary" value="" />



    $post->post_title,
    '{url}' => get_permalink($postId),
    );

    foreach($arrTemplate as $template => $template_data)
    {
    $ping_template = str_replace($template, $template_data, $ping_template);
    }
    $result = $pfm->post("status", $ping_template);
    }

    function isCategoriesAllowedToPing($postId, $categories)
    {
    $pingMode = get_option('cl_post_pingfm_ping_mode');
    $pingCats = get_option('cl_post_pingfm_ping_mode_category');
    $pingCats = array_map("trim", explode(",", $pingCats));
    if(!is_array($pingCats)) $pingCats = array();

    if("allow" == $pingMode)
    {
    foreach($categories as $cats)
    {
    if(in_array($cats, $pingCats))
    {
    return true;
    }
    }
    }
    else if("deny" == $pingMode)
    {
    foreach($categories as $cats)
    {
    if(in_array($cats, $pingCats))
    {
    return false;
    }
    }
    return true;
    }
    else
    {
    return true;
    }
    }
  • Marcus Cudd noticed that this tweak of mine wasn't working properly. Since I have problems posting code here, I've added it to my own blog. The fix was in the way options are read on WordPress MU.

    Here is the tweaked code for the plugin. Please test it and see if it works well for you :)
  • Awesome work! But, sorry, I can't confirm it, I don't have wp-mu installed.
    For now, whenever people need it to work on wp-mu, I'll direct it to your post. Because, based on recent blog post on wordpress.org, they intended to integrate wp & wp-mu on single source.
  • How can I post an excerpt of blogpost when submitting to Ping? I'd like to still use {title} on {url} in addition. Any help would be appreciated.
  • Can you be more specific?
    Some example maybe? so that I can get your idea.
  • The plugin completely stopped working for me since yesterday morning.

    I changed hosting last week and at first it worked like a charm, much better than my previous host (I used to have to click 'update' 3 times before it'd get propagated). Now it completely stopped working and I'm not really sure why. I've done a test updating the post after enabling debugging but it's not showing anything anywhere that I can see :/
  • This plugin has stopped working for me in the last few days.
  • Hmm... is it because of the downtime twitter suffered few days ago? I should do some test.
  • Yea i am getting blank posts as well...
    <div>silent:</div>

    Please, when you have problem, mail me your server status (php_info() output) so that I can investigate what goes wrong.

  • I'm getting absolutely nothing. Nothing is posting to my ping.fm account at all. with basically the same specs as the guy above.
    <div>silent:</div>

    For you and the guy above. Can you provide me with the php_info() output on your server? just mail me the result at ariefbayu@gmail.com be sure to remove or mask any identifiable information (IP or domain name)

  • Hi,

    I have installed the plugin without any errors. I publish a post and nothing happens--not even an error.

    I waited 24 hours and still nothing has gone to ping.fm.

    Any thoughts?

    1. My Ping.fm API key is correct (double-checked)
    2. PHP version: 5.2.9
    3. Server: IIS 6.0

    <div>silent:</div>

    Maybe, enabling the debug mode in PHPingFm will help. Go, test it, and tell me the result.

  • Love the update, thanks so much!! :)
    <div>silent:</div>

    Your welcome, Nicki

  • Great Plugin! Thank you.

    Issue:
    I'm looking into an issue where it seems that about 80% of the posts are making it to ping.fm .
    I'm testing to see if this is happening due to publish scheduling and/or publishing from 'press this' although the 'publish_post' add_action should be hearing all of these events shouldn't they?
    <div>silent:</div>

    Yeah, publish_post should be hearing all of these events.
    Tell me what you find out after testing. I'll test it too by my self.
    so, 3 parameter right. Post from normal post page, press this, and schedule.

    BTW, I'm in the middle on rolling out the new version. It will add re-publish feature. Incase you have changed the content and want to annouce it again.
    Should be up in an hour.

  • After complaining to my host, they told me that I *could* have PHP5 and switched me to a new server. YAY! :)

    Although now I have a feature request. Could you please add an option to choose when to have it ping Ping.fm? (as in when posting new posts only, or just updates, or both?)

    Thanks! :)
    <div>silent:</div>

    ah, great idea!

  • ARGH! Having same problem as Kate. Seems all Ping.fm apps require PHP5 (my host currently has PHP4, I cannot change this!).

    It would have been really helpful to have known this ~before~ installing. :(

    <div>silent:</div>

    Aw, I'm sorry. I'll try to rewrite it to be compatible with PHP4. But, I didn't promise it to be finished within this week.

  • This is a great little plugin and I was so excited! However, I have installed this but when I publish the post, I get this error =(

    Any ideas? Many thanks =)

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /nfs/c04/h03/mnt/66134/domains/blog.spudaroo.com/html/wp-content/plugins/cr-post2pingfm/PHPingFM.php on line 20
    <div>silent:</div>

    Sorry, PHPingFM class required you to use PHP5

  • Works great, thank you
    <div>silent:</div>

    your welcome

blog comments powered by Disqus