Archive | Web 2.0  

Integrating bit.ly with WordPress 3.0 Shortlinks Support

2 Jul

The official release of WordPress 3.0 being a bit recent, I’ve had a hell of a time trying to find bit.ly plugin that supports WordPress 3.0. The idea is to get your bit.ly short URL instead of the WordPress 3.0 short URL that uses your own domain name when you press the “Get Shortlink” button of a post editor.

bit.ly support in WordPress 3.0

I found the “WP Bit.ly” plugin which looks pretty good but does not yet support WordPress 3.0.

So what does an unsatisfied geek do on a Friday evening instead of having dinner? He finds a solution.

1. Download the WP Bit.ly plugin

2. Fix the plugin code

In file wp.bitly.php, put lines 47-48 in comment:

/*add_action( 'wp',      'wpbitly_shortlink_header' );
add_action( 'wp_head', 'wpbitly_shortlink_wp_head' ); */

If you too are a geek and you need to know, this will make sure WordPress 3.0 continues to take care itself of the HTML response header and the Web page HTML header as per the rel=”shortlink” proposed standard. Otherwise, the WP Bit.ly plugin would add these twice to a page which wouldn’t be clean.

3. Modify your theme’s function.php

Add the following code to your theme’s functions.php file:

/* bit.ly shortlink */

function get_bitly_shortlink($shortlink, $id, $context, $allow_slugs) {
   if (function_exists('wpbitly_get_shortlink')) {
      $slink = wpbitly_get_shortlink($id);
      if (empty($slink)) {
         wpbitly_generate_shortlink($id);
         $slink = wpbitly_get_shortlink($id);
         }
      return !empty($slink) ? $slink : $shortlink;
      }
   return $shortlink;
}
add_filter( 'get_shortlink', 'get_bitly_shortlink',10,4);

This code links the plugin code to the new WP 3.0 shortlink feature. It also makes sure that WordPress 3.0 will continue to operate as before if you do not enable the WP bit.ly plugin or you disable it.

Generate the bit.ly links from the plugin

So that the “Get Shortlink” button gets you a bit.ly link (instead of the default permalink), these should be generated once from the plugin’s settings. For new posts new bit.ly links should be created automatically.

Be aware that visits and crawls to your site will generate bit.ly links for each visited posts if no link already existed for each visited post. This is due to the fact that the short links are included in the code of each of your page to support new standards.

Fix for Facebook URL Linter / Open Graph Protocol Bug with WordPress 3.0

2 Jul

I’ve been helping At Home with Kim Vallee support the Open Graph Protocol promoted by Facebook. It’s easy to implement and great research that we’ll be adding immediately to Shwowp. If you want to learn a bit more why it’s important for your site to implement the Open Graph Protocol, read this article: “Facebook Unleashes Open Graph Search Engine, Declares War On Google”.

URL Linter is a handy Facebook Developer tool that allows you to analyze a Web page meta data to see how Facebook understands it.

The problem is that URL Linter was working for the home page but not for the article pages. After much lost sleep and a call for help on Facebook Developer Forums, Paul from Facebook confirmed it was a bug:

  • WordPress 3.0 added a shortlink feature
  • If you changed your WordPress permalinks to friendly names instead of the default, it adds an HTTP header variable in the form
    • Link    <http://domain.com/?p=12345>; rel=shortlink
    • This new header variable is part of a proposed microformat standard.
    • The Facebook URL Linter and crawler currently has trouble parsing the page when it sees this HTTP header

The Fix

The bug should be fixed by Facebook in about a week. In the meanwhile, if you run WordPress 3.0 and are implementing Open Graph Protocol support to your site, you can add the following code in your theme’s functions.php to disable the shortlink in the HTTP header output:


/* Remove WP 3.0 shortlink */
function empty_shortlink($shortlink, $id, $context, $allow_slugs) {
return NULL;
}
add_filter( 'get_shortlink', 'empty_shortlink',10,4);

Twitter allows to follow Facebook friends, Facebook blocks feature

23 Jun

In their recent Mashable article, HUGE: Twitter Lets You Automatically Follow Your Facebook Friends, we learn that we can now use Twitter’s Facebook Application to find friends to follow in Twitter.

It looks like it was short lived because minutes after this article was published, it seems that Facebook blocked that capability:

Really wondering what game is being played right now! The Twitter Facebook app allow you (as an option) to publish your tweets to Facebook and it now seems that you can’t find new friends through Facebook so you can follow them on Twitter (and optionally post back to Facebook!). Strange!

Facebook was really quick in blocking Twitter and I’m wondering which Term of Service Facebook thinks Twitter did not respect.

UPDATE: on Techcrunch, there’s now an update article from MG Siegler which says this might be an issue on Facebook’s end. Maybe a coding error or, more probable: a) an API problem on Facebook’s end or b) Facebook really blocked Twitter.

UPDATE 2: it seems it is not intentional. Facebook is working with Twitter to solve the problem.

How to fix the WordPress plugin WP-SpamFree to avoid the “Your location has been identified as part of a reported spam network” error

11 Mar

My wife Kim is the successful editor behind At Home with Kim Vallee. She uses the WordPress platform.

With success and a popular platform, problems with comment and contact form spam becomes quickly a pain to manage. That’s why you need a good toolset to keep your sanity intact. Good WordPress plugins to protect against spamming and keep your installation secure include:

  • Akismet – protects against spam
  • Login LockDown – adds extra security to your login form
  • WP Security Scan – security
  • WP-SpamFree – extra spam protection

WP-SpamFree is quite invaluable against robots and contact form spam. However, it came to our attention that some people would see the following message instead of the contact form:

Your location has been identified as part of a reported spam network. Contact form has been disabled to prevent spam.

See the message when it would appear instead of Kim’s contact form:

image

This was really annoying. People were telling Kim they couldn’t send comments.

By chance, one PC at our office had this bug. The unique IP address assigned to our network by Videotron seemed clean. So I dug further and looked at the plugin code to understand and debug what’s happening. It seems some browsers in some configurations (in our case a particular Firefox installation on Windows XP) do not transmit the HTTP_ACCEPT_LANGUAGE variable to servers. There is a check in the WP-SpamFree plugin that identifies the visitor as a spammer if this variable is empty.

Once the problem identified, the fix is easy: simply disable this verification. The quick fix to the plugin is to modify the wp-spamfree.php file in the plugin directory to put this condition in comment. See my changes in red:

/*
            $user_http_accept_language = trim($_SERVER['HTTP_ACCEPT_LANGUAGE']);
            if ( !$user_http_accept_language ) {
                $contact_form_blacklist_status = ’2′;
                $spamfree_error_code .= ‘ CF-HAL1001′;
                }
*/
            // Add blacklist check – IP’s only though.

            if ( $contact_form_blacklist_status ) {
                $spamfree_contact_form_content = ‘<strong>Your location has been identified as part of a reported spam network. Contact form has been disabled to prevent spam.</strong>’;
                }
            $content_new = str_replace(‘<!–spamfree-contact–>’, $spamfree_contact_form_content, $content);

That’s it. No more false positives for Kim’s visitors!

I’ll send this issues to the WP-SpamFree devs.

My predictions for 2010

4 Jan

So, I decided to join the bandwagon and give my predictions for 2010 in technology and social media.450px-Glaskugel_CrystalBall

1. We’ll see a new breed of social media curating

As we are more than ever overloaded with information, implicit filtering becomes a must. Are you able to keep up with your RSS feed? I can’t! Do you feel like you’re missing on a lot of interesting conversations shared across your networks? I sure do!
We’ve already seen a bunch of aggregators in the social media landscape as destination sites. The next wave, which will happen this year, will focus on personalized our social media streams based on our social interactions and preferences. We’ll see a lot of innovation in this space.

2. Telcos start adopting a single Android platform

Google’s upcoming Nexus One Android phone proves that Google can’t afford to have a platform where it does not better control the experience in its fight against Apple’s iPhone. I predict we will see many telcos start adopting a unified Android which will be a packaged version of the Nexus One and thelcos will start dropping other Android implementations.

3. It will be the year of BuddyPress

As more and more bloggers become media empires and as different brands want to embrace social media, we’ll see an impressive number of mainstream sites adopt BuddyPress to build their own communities.

4. Bing will integrate social shopping features

As innovation in e-commerce is stagnating outside of Amazon, social shopping will continue to boom. We’ll see major players such as Google, Microsoft and even Apple jump into social shopping. Bing, which already has some focus on shopping, will integrate social features in its search engine.

5. There will be at least one high profile lawsuit against Apple

Losers love their lawyers and success breads jealousy. A major company will have a major lawsuit against Apple. Easy prediction. There probably will be more than one high profile lawsuit against Apple. As a bonus, Apple will fend these off.

6. 2010: the year of the tablet

Another easy prediction. Everyone’s making it. I had to.

The real questions are: Will Windows 7 stand of the crowd with its multi-touch features? Will Android be majorly used? Will Apple’s tablet be great enough? As a side prediction it is sure that Apple fans will drink to cool-aid.

7. More anti-trust investigations against Google

The American Department of Justice and the European Union will open both new probes and investigations into Google’s activities. At least another high profile acquisition will be blocked. It a rite a passage Microsoft had to go through and its Google turn.

8. Facebook to become the next Paypal

In 2010, Facebook will finally launch a payment platform that can be used as a virtual currency. Eventually, users can exchange credits.

9. Facebook e-commerce applications

We will see adoption of Facebook’s payment platform outside of social gaming and we will see it adopted on Facebook Connect sites too. Want to make a donation through Facebook?

10. We’ll see innovation in e-commerce outside of Amazon

I had to make this prediction because I feel e-commerce is still at the 1.0 stage. It’s a matter of time before we begin to see innovation outside of Amazon. I’m making this prediction because you’ll have to stay tuned to Shwowp a new startup from Tara Hunt and yours truly. If others don’t start to innovate, at least there will be us! In any case, it will become true if #9 becomes true.

Image copyright: http://commons.wikimedia.org/wiki/File:Glaskugel_CrystalBall.jpg