Updated Facebook Comments TNG

We use the Facebook Comments TNG wordpress plugin here to keep comments on Facebook coming into the Blog.  If you’ve ever noticed a comment you’ve made on one of my notes in Facebook that showed up here… this is how we do it.

Anyway, a short time ago Facebook changed their website layout and as a result the Facebook Comments TNG plugin was broken.  Unfortunately the developer has not had time to update it to match the new Facebook layout, but as it’s breaking some functionality I depend upon (here and elsewhere)  I did a little digging to see if I could fix it.

WARNING

I’m fairly certain this plugin breaks the ToS with Facebook so if you’re not comfortable with that, Don’t use it!

The results are less than spectacular, but it seems to work (mostly) with the following caveats:

  • It requires you to enter a profile ID in the options window
  • It is limited to only examining the most recent 10 posts (regardless of your setting)
  • It may or may not handle multiple pages of comments (untested)
  • Somehow the copy I started with was an older version, so some of the newer features are unavailable

NOTE: I do not warranty anything this plugin will do and I will NOT be keeping this up to date.  I’m simply providing a temporary location for the fixes I implemented.

If you’re good with that list and can’t wait for an official update, feel free to download my version (in TEXT form).

If the list is too much for you, feel free to wait for an official version here.

Decoding Nested gz base64 code

Whenever I first install any theme, I make my own modifications.  Sometimes  it’s removing extraneous code that I won’t be using, or changing the size of certain sections, or adding in some calls that I do need.  Whenever I do this I always modify the footer to say ‘Modified by Randy Aldrich.’

Recently After modifying the theme to my liking I went to add my own footer only to find the Author had used gz compression and base64 encoding on the footer.  All I found was the following code:

eval(gzinflate(base64_decode(“rVVtb5RAEP6sif9hJEbORMCX6AfL0bTaqlGTpr7UxJgG2LljU9jF3eEQf73D2/XacDZ6foFln5nnmZldZvaj8K7nQYJLqWChNaEBz4vu3L5zOxRyBVLMnX7bmdrMcUEtcCvMnkSnmKKivIEzI4lQhQFvMnYrrPIo3C+zEpZI57FJM7lCO3NLbSlp2qf7EB4/erAH+1EYsPFA+EErypjvYPCYIKzL86uc1JQ4L3pHd5MxDDj0qRwKKUSO6ywOc700Os9HsXCIZx1/LtWFnXmPH4Ib5jJy23cwLMCDXrT1uEHXyGV2WbxjqQS8pUEVADjLhTZF52CxTbD9dKBAyjTvcSgOxClJreZOHx2mmYZ75x+PTr8cnX5zT96c8Pr9sfu9jcjpKydVWRF0VXIIfzKHigteW6dXcsDKX/z95JkDqzivcFQHyqRlkND3fSfgsrbxdKRDCgeikGqybHxKhm+Y5axn6/JwydYo11wqXdFsODHGRpMYMoOLuZMRlS+CoK5rv9ZGlAat9bVZBk50Nn6HQXzpPHJzweKrqtcoOU0pYtLGr592jGmG6cV+ZeSczdC0d//rm08f3l+hH+7pkPvZCXzKsLi8o2P+W1JIjIzVMjZCofFTXQTUeQftga5iQm+do9chfkaFEx0M6JVA/lIh4fsr5FJPKxwO6C4K2GAaK9FMKxw1CC9beBcJgaQrMy3wqsN2YV8Y/FGhSrdkcDzCu2iYWDCQbjno0wHdRWGFhrae85ce/B/89kcVGxR/1IGPvdEuerVWgicOX51pqbM1vk3F3VBhR9IK7dPnjzqRxOjaYnAhxS8v0aXHCxu4QJJynLudqRu9YxQOdQm8sNPdYGz319q+pYZ5nDTnXvoi0ZTtOdHa9CaDjdGRchEl2X5slNH9VJfNHrzkZzdOYF3QjYnQDi2LRFIteUBmusB+RnHn7K2Srv0u9MxtZ8E4NeMI7idVnu/Bia65CwpIGrixHV/rxiPFZ8vqk97/8IvDxj8O3TZwXbgvbg3xughTHLZb8Lrfa5n8MCj7Yl+WvSuP0Of9nJ25PE764T1O+dY60aLpTpxjy6Pf”)));

This was obviously an attempt to protect the author’s copyright on the theme.  However; as I heavily modified the original results, I felt the need to protect my own and so I found a solution to decode the footer.

If you run into this same problem, just place the eval code you found into a file called coded.txt.  Then all you need to do is run this decrypt.php PHP script from the same directory and decoded.txt will be created in the same directory and will contain the decoded code.

NOTE: This solution is not mine, it was found on the web at Taree Internet

Gravatar

Gravatar LogoI generally like the idea of consolidation. I’m tired of all the logins I have all across the web. I try to use a very small list of identical names and e-mail addresses but with the shear number of sites out there and the different security requirements it’s very difficult to keep them all up to date. I’m a fan of openID although I don’t think they quite get it yet. I love the concept I’m just not sure about the execution. Using a website address as your one unique login is awkward.

In general there’s just too much clutter on the web. Too many things that accomplish the same task. Too much information being generated by every individual. I wrote before about consolidating the feeds I generate into 3 main categories.

Today I consolidated my avatars. An avatar is what people see of you. It’s often the first image they’ll get of you, or perhaps even their first impression. It’s a drag to update these avatars on every site you use. I myself hardly used to use them simply because I don’t like searching for a photo to use and trimming it down to size etc.

Gravatar makes it very easy. Essentially you attach an image with an e-mail address and thats it. Any website which is Gravatar-enabled will display your Gravatar wherever it detects your E-mail address. Your Gravatars also have ratings so that certain sites can say they only want to allow ‘G’ or ‘PG’ Gravatars for example. The only Gravatar I have is this:

I have now enabled Gravatars on RandyAldrich.net and RandyandRachel.com. I’ll probably do so on any website I administer in the future as I think its a great way to build community.

If you hate seeing the Gravatar logo, Create yours today!

If you’d like to enable Gravatars on your wordpress blog simply download and install this plugin and then add the following line of code in comments.php wherever you’d like them displayed:

<?php if (function_exists(‘gravatar’)) { ?><img src=”<?php gravatar(“X”, 80, “”); ?>” class=”gravatar” alt=”Gravatar Icon” /><?php } ?>

As a sidenote… I may create an updated version of the plugin myself (or send the needed changes to the original author) which inserts the above for you when I get a chance.

Bug Fixes

I have fixed several annoying bugs in ZippyPhotos one of which caused directories to be displayed in the wrong order. It amazes me how easy PHP is to work with every time I make a fix or add a feature.

I also added the ability to specify the number of items currently displayed in the RSS feed. Right now the default is set to 10 but like everything else in Zippy, it’s configurable via settings.php.

Filesystem Photo Gallery

I’ve been looking for a good filesystem-based Gallery system for a while. I haven’t been able to come up with one that has the features and is as lightweight as I’d like it. Therefor I decided I’d write my own. I implemented the first version in .NET but have since ceased development and decided to move away from IIS/windows and begin using linux/apache and an external host (powweb). I also want the Gallery system to work seamlessly with WordPress and any other PHP based content management system (or blog engine). Therefor I decided to scratch the .NET version and start on a PHP based version.

I started working on my new PHP filesystem based Gallery system last night. It’s intended to be extremely lightweight with no database interaction. It will assume the first image in a directory should be the ‘thumbnail’ for that directory. It will dynamically generate thumbnails for images which do not yet have a thumbnails. This is so that they are only created once.

I’m very surprised at how fast the The system is coming together. I suspect that in a few days I’ll have a working version with most if not all of the features I’m looking for.

The only problem is I have no Idea what to call it. If anyone has any suggestions I’d love to hear them.

As soon as I come up with the name I’ll publish a google code site with all the documentation and downloading goodness.

Widget Trouble

I had some trouble finding examples on how to Widgetize your WordPress Theme. I found plenty of links but all were dead. I figured I’d mirror a how-to guide here to make it easier for people to find out how to make their Theme work with WordPress widgets.

First of all you’ll want to put some code in your sidebar.php file to have a default sidebar as well as a dynamic sidebar when available. to do this use something like the following:

<ul id="sidebar">
    <?php if ( !function_exists('dynamic_sidebar')|| !dynamic_sidebar() ) : ?>
    <li id="about">
        <h2>About</h2>
        <p>This is my blog.</p>
    </li>
    <li id="links">
        <h2>Links</h2>
        <ul>
            <li><a href="http://example.com">Example</a></li>
        </ul>
    </li>
    <?php endif; ?>
</ul>

This will enable your site to use a dynamically generated sidebar. Next we need the ability to implement a dynamic sidebar. To do this simply add the following to your functions.php file:

<?php
if ( function_exists('register_sidebar') )
    register_sidebar();
?>

Provided you have the Widgets plug-in installed and activated, you should now see a ‘Sidebar Widgets’ section under Presentation in the Admin section of your site.

I am not the original author of this tutorial nor am I a contributor in any way to the Widgets plug-in. If you have questions about the plug-in itself, or this method is not working please contact the author or see the plugin website.