My Blog

My First WordPress Plugin

With great delight, I have contributed my first official piece of code to the WordPress repository!

http://wordpress.org/extend/plugins/stack-overflow-activity-feed-widget/

I was always eager to be a part of the WordPress community, for WordPress is something that I have heavily used for almost a couple of years now, and is something that I am very passionate about. A lot of websites, experiments, hacks, and a lot of fun. It has been a training ground for me to learn PHP, and web development.

And finally, there is something official, in the form of a simple plugin, but this, I believe is only a start to what I think I could be doing for the community.

Comment

Exploits of a Mom

Found this on xkcd. :D. Definitely worth sharing.

Exploits of a Mom

Comment

Google and Special Characters

It must not be one programmer’s frustration that Google does not consider special characters in its search field to return results. Now if I can’t search for resources on what is the difference between @ and \@ in Perl when assigning arrays, where else am I to head to?

“What is the difference between an ocean and a sea?” That is absolutely what I wanted.

Google Search Result

Edit: Thanks to Carl’s comment. You can check out the results for the same from SymbolHound here.

Comment

Amazon

I write now, at the milestone of my first code being pushed into the Amazon production servers, reflecting across a million Kindle devices. Just a few lines of code. But such an amazing feeling.

Working for a company that I believe has one of the best build systems ever, you wouldn’t imagine the pace at which development happens, and how soon you actually impact customers, and the company.

I really look forward to do the great work that people around me do.

Comment

A Good Year

It was. :). I’ll remember you, 2012.

Comment

Fixing The Twitter Widget

Twitter has been giving too much problems to a lot of people lately, ever since they updated their API to v1.1 making their Developer Rules of the Road more stringent. While it did affect developers in specific, with quite a number of them having to update their existing applications to stay consistent with the API guidelines, a lot of innocent bloggers were also affected by the new API, to suddenly see their Twitter widgets stop working.

Well I have a Twitter widget on my site too, and it for months has been just dead. But not anymore. There is a simple fix which if you haven’t done yet will bring it back alive.

Regardless of what platform you were on, you basically need to find this piece of code in the widget:

And replace it with this:

And you’re done!

Comment

Open Sourcing WordPress on SMS

How would it be if you could blog through your phone? Even without the Internet?

Well now you can, using #WordPress. Honestly, the application should be in its beta stage, but I have versioned it as 1.0. :D. And yes, it is open sourced here. Finally some piece of code that I decided to open source without worrying much over how people would evaluate me after reading through it.

You’re welcome to get in touch with me if you would like to suggest any changes in its features. Or the code. :)

Comment

Yet Another WordPress Hack

I do not very well remember how much I’ve screwed around with WordPress and its plugins, but here is one of my latest mods to an existing plugin that I believe will be very useful for users wanting to import all photos from their photo albums of a particular Facebook page. I had been searching around for plugins, and could never find one that could actually do the job. Either if a plugin could display all photos from all albums it didn’t have the feature to read from a Facebook page and was rather limited to just Facebook users, like the Fotobook plugin. Or if it could read from pages, then I had to specify each and every album ID separately in the shortcode, and add as many shortcodes as there are albums in that Facebook page. And moreover, updates in the gallery page to include the new shortcodes for newly added albums on Facebook had to be done manually. It fit in only if I wanted to display selected albums. But then I had to just display all of them, and there were more than ten albums that could possibly keep increasing every month or sooner.

And fetching the album IDs of each of those ten albums was trouble again. Say you open an album and read the URL on the address bar. You would see something like this: https://www.facebook.com/media/set/?set=a.10151028573106217.485132.286244581216&type=3. The number in between the first dot after ‘a’ and in between second dot becomes your album ID. And would I like to manually read each of those album IDs, and that too every time a new album is added? And then manually add it to the page in the website? No!

So I found this plugin Facebook Page Photo Gallery, but which like I said could only display based on the album ID in specific, and it required me to add each album ID manually as a shortcode:

[fbphotos id=albumid]

I liked the overall feel of the plugin, and the thumbnail style and the jQuery effects that the developer had used in his plugin. And then it was time for me to start digging into the code. I narrowed down to this function, where in he generates a string containing the HTML to be printed, which again is generated by calling the fppg_get_photos() function by passing the album ID. Here is the original piece of code from facebook-page-photo-gallery.php, starting from line 34.

Great. What I needed to change was to loop over the piece of code generating the HTML for each and every album rather than just the one album. So here is what I did. This was the page of my interest: https://www.facebook.com/pages/Sunshine-Foundation/286244581216, and its ID was 286244581216. And then I went to https://graph.facebook.com/286244581216/albums to get the details of all albums of that particular page in JSON format.

Just a small note here, if suppose a page has a registered username and does not have its ID in the page URL, say like https://www.facebook.com/CocaCola, then go to https://graph.facebook.com/CocaCola to retrieve its ID as one of the JSON objects.

Now that I had details of all the albums of a particular page in JSON format, the next thing that I needed to do was parse the JSON and retrieve the IDs of all the albums from the JSON, and run these album IDs in a loop through the previous code. The modified code is here, with the function fppg_embed_photos() replaced by mine.

There we go, and this is how it looks on site, here. You can find the edited source code for download here. Download the original plugin, and replace the facebook-page-photo-gallery.php with the new downloaded file after extraction. And then now, your shortcode will have to be called only once, with the page ID of the Facebook page, rather than with some album ID.

[fbphotos id=pageid]

That does it! :). And don’t mind coming back to your photo gallery page ever again to update or add anything. The albums will automatically update as they are fetched from the Facebook page. Just keep those albums and photos rolling on in Facebook, and see them spring up there.

Comment

Code Ninja


Apparently Amazon hires only ‘Code Ninjas‘. And so, I am one! ;-)

Here, you integer, take this! Hoo! Hah! :D

Comment

Launching TweetBytes

Proudly announcing my very own Twitter client, TweetBytes! Bursts of short spans of coding over four nights. Built using PHP, TweetBytes uses OAuth to connect users to Twitter, whereby the user need not reveal his password to the application.

TweetBytes facilitates Twitter access through text messages, and is a complete SMS based Twitter client. But I’ve put in enough effort to make sure it isn’t largely inferior to the web and smartphone clients. And well, it surely beats their ass up in the sense that it requires no Internet! Just carry it along in your phone, and access it from anywhere through text messages, thanks to txtWeb.

The front end development and the code for OAuth authentication took as much time as developing the back end features of the client. Check it out here.

 

Well, that was my first tweet from TweetBytes, and tweeting here gets as simple as sending @tweetbytes This is my tweet to txtWeb. Update: A few more tweets here from some of my friends using it!

 

 

 

Update: TweetBytes has expanded to newer horizons after being published on the 55444.in platform on 20th September 2012. Access it here.

I might have missed a couple of them, but I’m trying to archive tweets from others regarding the application. Thanks everyone!!






Comment
Copyright © Bits and Bytes | Arjun Abhynav. Powered by WordPress.