WordPress: Fixing the broken links from Jetpack top stats

I use the upgraded awesome plugin Jetpack by WordPress.com to show the ‘Top Posts’ is the sidebar. I recently noticed that the links for these post were broken, even though I wasn’t doing anything wrong at all. I queried the plugin for top 5 posts using:

$top_posts = stats_get_csv('postviews', 'days=-1&limit=6&summarize');
echo '<ul class="most-viewed">';
  foreach ( $top_posts as $p ) {
      echo '<li><a href="'. $p['post_permalink'] .'" title="'.
        $p['post_title']. '">'. $p['post_title'] .'</a> - <strong>'. $p['views'] . '</strong> views</li>';
echo '</ul>';

But somehow, the value at post_permalink key was wrong. Instead of pulling out my hair, I downloaded the Jetpack plugin’s source code, opened the file stats.php and copied a few lines and now the following works awesomely well.

if ( function_exists('stats_get_csv') && $top_posts = stats_get_csv('postviews', 'days=-1&limit=6&summarize')) {
  echo '<ul class="most-viewed">';
  foreach ( $top_posts as $p ) {
    if($p['post_id'] && get_post($p['post_id']))
      echo '<li><a href="' . get_permalink( $p['post_id'] ) . '">' .
          get_the_title( $p['post_id'] ) . '</a>', number_format_i18n( $p['views'] ) </li>';
  echo '</ul>';

I hope this helps people looking for a quick fix to this problem.

Drupal: Facebook-style Micropublisher v1.1 released

After four months of relatively slow development of Facebook-style Micropublisher (FBSMP), I am happy to tag the branch with 6.x-1.1 release. It might be the last release for this branch, as I would now be upgrading FBSMP to support the latest 6.x-3.x branch of Facebook-style Statuses.

A lot of cool features are coming up with this release especially in the beloved link plugin,

  1. link plugin: allow users to share links to audio sharing sites such as soundcloud, 8tracks.
  2. Repost the attachments along with status (similar to re-share and re-tweet functionality), supported by link and photo plugin.
  3. link plugin: inline editing of title and description, cool JS.
  4. link plugin: edit the title and description field of the attachment.
  5. Support for processing GET parameters in the URL.
  6. link plugin now allows to share the URL using the flink GET parameter. More…

The complete list of features and bug fixes can be found in the release notes.

I hope you enjoy creating amazing sites using the new features and share them here for the world to know how cool this module is šŸ˜‰

Google Summer of Code 2011 Announced

Do you feel passionate about any open source technology? Or you want to explore one during your summer vacations? On the top of it, if you get a mentor to guide you all along and a stipend of 5000 USD, would you beĀ interested? Yeah! Keep reading then.

GSoC 2011

GSoC 2011

Google announced its consecutive 7th year for Summer of Code program on January 24, 2011. Google Summer of Code program encourages students from all over the world to engage in open source project development of their choice for 3 months.

Look out for the details of the program here: http://socghop.appspot.com/ and the timeline: http://www.google-melange.com/document/show/gsoc_program/google/gsoc2011/timeline

Continue reading

shared thoughts

a few videos and images for all of you this holiday season, few to giggle, few to laugh and other to ponder over. merry christmas and a happy new year.

  1. 300 years of fossil fuel in 300 seconds

  2. google shit

  3. revenge of the spider

    i remember too.


for those of you wondering where the heck uppercase letters went, google killed them.

Drupal: Facebook-style Micropublisher

After months of hard work and support from Isaac and Thomas, I am proud to announce the first stable release of Facebook-style Micropublisher (FBSMP). FBSMP allows user to share content such as links, videos, photos and documents along with their Facebook-style Statuses. It allows you to create a social networking site similar to Twitter, Facebook, Google Buzz and others out-of-the-box. On the top, it integrates with a lot of other Drupal modules (as Activity, Trigger, Rules, Heartbeat, ImageCache, EmVideo, UserPoints, and more) which lets you do a lot more things with your website.

What’s in the box
As of today, FBSMP supports the following features:

  • Attaches content using AHAH which keeps everything smooth.
  • Publishes links, photos, videos, documents (ppt, doc, pptx, odt, etc) out of the box.
  • Extensible to publish any kind of content.
  • Integration with Activity 2, Rules, Heartbeat, Triggers/Actions, Input Filters, Views, ImageCache, Token, Application Toolbar(Appbar), Emvideo, Userpoints (through Rules), SlideShare.net API and more.
  • Extensive developer API (including hooks) and theming methods.

It is difficult for me to elaborate on all the plugins (a plugin allows to publish one kind of content, for example Link plugin allows you to share your favorite links, Photo plugin allows you to share images on your site.), so you will have to explore them yourself. You can look at the documentation here: http://drupal.org/node/876500

How to get involved

Enjoy it with your holidays, wish you all a Merry Christmas and a great year ahead.

Note: Feature and Support requests should be made through the Facebook-style Micropublisher Forum. I may not be able to answer them here.

Drupal: Facebook-style Micropublisher Preview

I worked on the module Facebook-style Micropublisher (FBSMP) for Drupal, this summer as part of the Google Summer of Code program mentored by Isaac Sukin. This module lets users publish content (links, images, videos and documents) in a stream, along with their Facebook-style Statuses (like on Facebook, or Twitter). When I say that I worked on it as part of GSoC, it would be only partly true. I started working on it around March 2010, when I was contacted by Thomas to create a Drupal module for his site which would imitate the link share feature from Facebook, Google Buzz. I wrote the small module Facebook-style Links, which worked quite well but it was then this occurred to me, “why not create a module which can publish any content, which is extensible to publish any kind of content like images, links, videos, documents, audio, etc”.

Today, I am happy to say that Drupal now has a complete Micropublisher which can be used to create any kind of microblogging platform such as Facebook, Google Buzz, Twitter, etc. I will be posting the first release of the module soon, but before here is the small list of features and a few screenshots. Continue reading