OpenID Authentication Plugin for vBulletin 4

Recently I volunteered to help fix an existing project or develop an OpenID authentication plugin for the vBulletin platform. The group in need was UbuntuForums.org and I would have never known if it hadn’t been for Jorge Castro’s public request for help.

The Story

The existing plugin had been developed specifically for vBulletin 3.x, however, they are (as of writing this) in the process of upgrading their forums to vBulletin 4 especially wanted OpenID to be available when they make the upgrade. That’s where I came in.

Canonical, the company behind Ubuntu, provided me with necessary software licenses for vBulletin 4 and from there it was a lot of late nights attempting to simply get a successful OpenID process to occur.

Working a full time job doesn’t make projects like this as easy as I remember them once being… Nonetheless I was able to successful port the plugin to vB4 where there were several significant differences that took me some time to address and to be honest, the previous code was a bit more complicated to follow than it should have been.

One major change from vB3 to vB4 was the way templates work. I’d never worked with vBulletin before, but I’ve had an extensive amount of experience with phpBB and bbPress in the past. After getting over the frustration of how vBulletin prefers to store ALL template information (in the database rather than pull from template files) I was ready to begin the repair process.

One major annoyance was that vBulletin 4 kept a “deprecated” method intact for vb3 templates that haven’t yet been ported and the deprecated method would printout a warning on the live page letting you know that you should update your templates. That’s not a problem, but vBulletin likes to only release helpful information to License holding, account proving customers. I had a license yes, but was not the owner and unfortunately I was unable to get much of a response from the Ubuntu mailing list about getting access to vBulletin’s online support section.

For anyone having similar issues, I’ve posted the error message that I first came across below. If you got here, then you probably found the vBulletin post regarding this, but if you don’t have access like I didn’t then you’re still in luck…

Warning: fetch_template() calls should be replaced by the vB_Template class in [path]/includes/functions.php on line

While it was pretty clear that fetch_template() was deprecated, I was unable to get a clear usage example of how to use the new vB_Template class. I finally came across a post on StackOverflow that was exactly what I needed. Other issues that I had with fixing the plugin were some issues with SQL queries and were much more critical.

I wrote an article recently on how to debug PHP in real time as you’re using/executing a page or function… all through the very well known Eclipse IDE. If you’re interested in PHP development then you should certainly take a look at that post as it walks you through the setup and will make your life much easier. After tracing through the code over and over, each time finding new little issues and having to walk through the entire log in process again each time… I’d finally managed to get a successful authentication. So, I took a screenshot of my development environment…

vBulletin OpenID Plugin First Success

It wasn’t long after the first success that I was able to pin point other problematic spots faster and then from there everything just fell into place. In fact I had “full functionality” only about an hour after the first success. That didn’t mean that I was finished.

There were still a lot of minor issues that I’d found with the code. Array index out of bounds, corrupt query results in some situations causing a critical database error page to appear, unhandled invalid urls would take the plugin for a ride and ultimately crash, etc.

I’ve now worked out all of the issues that I came across from my own testing. Hopefully Ubuntu and Canonical won’t find any either and the upgrade can occur soon!

Download for Free

If you’re here for this plugin then I’m sure you’ve seen that there aren’t many (dare I say any) that are working, free or at least reasonably priced. Fortunately this plugin is based on an open source PHP OpenID library and Canonical apparently plans to maintain it from here on out in their source control service.

Before you download: I’ve posted a direct download the vanilla release that I first pushed to Canonical, however, its in your best interest to check for a newer version on their source control page for this plugin. That being said, feel free to continue on to download!

Download from me (last updated 2012-09-29)

Download from Canonical

Installation

This plugin contains a README and INSTALL file that should go into plenty of detail to help you install and get going in no time at all. The only thing that is left for you is to optionally improve on the simplistic log in form as seen below.

vBulletin Simplistic OpenID Login Form

While I do indeed love web design and development, I left the OpenID log-in form simplistic for one reason: Every web designer designs differently and its a waste of my time to put much effort into this when people who use it will likely want to use it in a way I never considered. The good news is that, it doesn’t appear in the header by default, so you can actually place this little form ANYWHERE you want. However, due to obvious reasons, you’ll likely find the header as I’ve done to be easiest as it automatically disappears one the user is logged in.

Conclusion

It’s been a fun month or month and a half that I’ve spent dabbling on this plugin. I’m always happy to contribute where I can to communities that I’m interested in or proud of and I consider this volunteer effort to be no different.

I’m also a little excited to see how the vBulletin community accepts this plugin. Will it be a boom or a bust? Only time will tell, but until then hopefully UbuntuForums.org will be enjoying OpenID functionality!

Solution To WordPress getimagesize() Error

If you’ve for whatever reason noticed that your WordPress website is generating errors similar to the following then I may have a solution for you.

Warning: getimagesize(/home/.some-dir/example.com/folder/httpd.www/wp-content/uploads/some-image.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/.some-dir/example.com/folder/httpd.www/wp-content/blah/blah/blah.php on line 123

I noticed that some pages that generated image information were printing errors out on my pages with private server file structures included. Generally you don’t want to see this printed out to the public. ;)

I’m not guaranteeing a fix for you, but rather what worked for me.

If you are getting an error link the one that I’ve listed above, more specifically the “failed to open stream: No such file or directory,” then you may be about to fix it in only a few minor steps.

Things you will need:

  • FTP (I use FileZilla)
  • phpMyAdmin
  • Ability to add a new plugin to your site
  • Patience

Procedure

Single quotes must be the normal ascii quotes. Chances are, if you copy and paste from my blog, they will be the wrong type so double check that as it could give you problems. ;)

  1. First and foremost, make sure to backup your entire database to a safe place. I’m not liable in the case that you don’t backup your database and this procedure borks your blog (or any other case for that matter). ;)
  2. Create a new file named “abstest.php” and upload it to your blog’s root directory after entering the following code into it:
    <?php define('ABSPATH', dirname(__FILE__).'/'); echo ABSPATH; ?>
  3. Open a new browser tab and navigate to “http://www.your-website.com/abstest.php“. You should find a short page with the printout of your servers absolute path.
  4. Check that the path provided by this test file matches the base path printed out by the getimagesize() error exactly. In my case, my server had changed slightly so the differences were similar to the following:
    /home/.some-dir/example.com/folder/httpd.www/
    /home/example.com/folder/httpd.www/
  5. If you find a mismatch, then you’ve found your problem and the rest is simple. If not, then my tips will most likely not solve your particular WordPress error(s).
  6. If you’ve found a mismatch, then continue: Open a new browser tab and navigate to your phpMyAdmin interface. Select your WordPress database, then click Search. I searched all tables for a match of the path that was different, in my case it was “.some-dir/“.
  7. If there are matches found then you need to click the SQL tab at the top (preferably in a new tab) and paste the following (making sure to edit it to match the table and fields you need) and run it to find and replace that changed part of the path.
    update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);
    For more information on SQL find and replace, either search Google or read this.
  8. After replacing all of the affected tables and strings, your images should be properly address. You’re not done yet though.
  9. Open WordPress Plugins and add/install a plugin named “Regenerate Thumbnails“. After installing it, make sure to activate it. ;)
  10. In your Admin panel, find the Tools menu and expand it. You should see a menu item labeled “Regen. Thumbnails”…click it. This will open a page with a start button. Clicking this button will begin the process of correcting your thumbnail dimensions as well as other metadata. It will take some time depending on the number of thumbnails you have accumulated.
  11. After the progress bar reaches 100% it will notify you that it is complete. You’re all done! You may need to clear your cache to refresh any pages that still generate the previous error message.

If you had any problems with the above mentioned procedure, I would suggest restoring your database using your backup copy and either trying again, paying someone to do it for you or just forgetting about it. ;)

If it works then great! If not then sorry you’ve wasted your time. It worked for me, so maybe it will work for you as well. :D

NC State ACM/AITP Website Update

acm-aitp-site-upgrade-2009

I just finished (or reached the publishing or pushing live step) the update to the NC State ACM/AITP website.

The improvements over the previous design are pretty drastic when it comes to user interface and ease of use.

I ended up going with a K2 theme for Drupal since I’m such a big fan, but it just didn’t seem right for the site at first. I ended up going through and modifying a great deal of a barely and poorly done version that I came across online so I had to finish up most of it myself, but that just allowed for making it suit my (read ‘our’…for the club) needs.

acm-aitp-site-upgrade-2009

After working with the html and tweaking it hardcore until I got it clean so it passes HTML Validation inspection it was time to tweak the CSS.

This became a breeze with Opera’s Dragonfly developer tools. I was able to select an element and tweak the style sheet live so I could see real-time results. After making an adjustment it’s as simple as updating the actual stylesheet.

After tweaking the style almost obsessively for hours the first day I decided it was time for a break. It wasn’t long before I got back into the groove the next day and finished it up (for the time being).

I really have to say that I am in love with Dragonfly now. I’ve used Firebug in the past and to be honest I’ve never been a Firefox fanboy…it’s a good browser, but it’s not pushing standards support at the rate that I want and Opera is just better at a lot of the things that I use and need from a browser… anyways, I got used to Firebug a while back and Dragonfly vs. Firebug isn’t a fair competition because the both are still very different, but I find Dragonfly being easier to use ever second compared to Firebug.

After getting the code working it was time to push the update. As a result, the NC State ACM/AITP club now has a much friendlier outlet on the web!

Now I have the pleasure of tackling any smaller issues such as stylesheet problems. :D Updating the content will now be much less of a pain now that it can be updated directly from the browser for most everything.

Drupal < WordPress

druplicon

After a lot of work..and research..and back and forth communication with an ITEC member here at NC State, I was finally able to get Drupal installed and running on the EOS web server.

Unfortunately they have disabled many very useful features in the Apache server settings in order to eliminate potential security hazards.

As it turned out, all that I needed to do the whole time to get Drupal working (other than some permission modifications, creating new folders since Open Base Directory usage was restricted and a few others) was to temporarily rename or remove the .htaccess file.

After that the setup completed, the .htaccess file was restored and everything seems to be fine.

Now that Drupal is running I’ve had time to inspect the control panel and I really must say that Drupal is far from user friendly when compared to WordPress.

It was actually a little frustrating to navigate through and content posting tools were in my opinion less than useful. I expected to find a nice text editor similar to the one found in WordPress for posts or pages (TinyMCE), but as it turns out there is only a text area (resizable, woot).

Anyhoo, I now get to finish migrating content from the ACM/AITP web site into Drupal so it can be managed more efficiently and kept up-to-date.

Drupal offers a lot of modules which are basically like plug-ins and add new functionality and features to your site such as a calendar or whatever you need.

I haven’t really started working on the theme yet and probably won’t until I get all of the content migrated and general usability of the site complete, but I really hope that the themes are as simple to modify for Drupal as they are for WordPress.

I’ll post some pictures when I complete the site update…or something geeky. :P

Coding: Online Alarm

online-alarm-clock-log-in-2

I’ve been working on my Online Alarm clock that I start writing more than a year ago! Really, I’ve just been going back to try to finish more of the user interface and clean up more of the code.

The work that I’ve been doing to the user interface includes bringing the design into the years of Web 2.0 with cleaner, larger and simpler layouts.

Just take a look at the difference between the original log-in page (top) compared to the log-in page after I completed functionality and updated the styling to make it a little more Web 2.0 friendly!

It’s amazing to me how you can have a functional web application, but if you don’t make it look nice then it seems like it’s so much more difficult to navigate and use. User interfaces really help sell a product as well, so hopefully I can get this one setup nicely.

I had planned on uploading the source code to the Google Code page that I made for it, but I’m still waiting to work out some kinks.

Mainly, I’m waiting until I get the GUI finished a little more so I will know which MySQL fields are needed and should be installed by an installation script.

The script itself shouldn’t be too difficult, but I really need to map out the process before I start coding it so I can make the installation as simple as possible at the same time.

I’m thinking it will be as simple as uploading all of the files to your server and completing a setup form that just requires server credentials (of course) and an initial Admin username and password. That should be quick and easy and get everything ready to start using!

There is also the issue of completing the admin control panel. If I don’t complete it then the admin will have little control over the service unless they choose to edit everything via phpMyAdmin or something like that.

It shouldn’t be too long before I can bring this project to a version 0.1 level, haha. Then you’ll be able to download the source and do what you wish with it for free (hopefully submit bug reports and patches :P )!

What’s New..

Well, I think you’ll all find this useful at one point or another. I’ve implemented editing for user comments, finally. I’ve been meaning to do this for a while and correcting some errors here and there, but now you can correct your own or add more to your comment. However, there are just a few things you will need to know:

  1. You will not have the option to edit your comment unless your ip address is the same one that was used when you posted the comment. It is best to edit the comment soon after originally posting it since ip addresses do change frequently for some.
  2. You cannot edit your comment after a specific time period from originally posting it. I will use a 48 hour interval to start out with. This interval may change, but I’ll keep you up to date.

Off to finish F.R.I.E.N.D.S. on TBS!

UPDATE:
Quoting is also an option now! Both of these features rely on javascript and will be improved greatly in the near future. They are just kind of 1.0 versions I guess, or maybe alpha. ;) Enjoy.

New site design under way..

I’ve been working on redesigning the site a bit so it doesn’t feel so cluttered. I’m not finished yet and still have a bit of cleaning up to do. However, I wanted to get some comments, feedback and constructive criticism. Please let me know the goods and the bads. If you can..please give a suggestion or 20. :D

I don’t want to officially launch the design yet, so I’m waiting for reviews. I’m curious if it’s better or worse and what is better or worse about it. I haven’t gone as far as setting up cookies or passing the css tag, so the style sheet will only apply on pages with css=2 appended to them. If you view another page and would like to see how it looks with the style sheet then just add ?css=2 at the end and press enter. Here are some links to get started..

http://www.kyleabaker.com/?css=2
http://www.kyleabaker.com/archive.php?css=2
http://www.kyleabaker.com/news.php?news=71&css=2

Check them while their hot! I’ll be removing this feature/option soon and these links will be disabled. ;)

UPDATE:
New design is up. I’m still tweaking it and working in the comments and suggestions. Thanks for the feedback!

Screenshots now use on-the-fly thumbnails

phpI finally got around to implementing thumbnails for the screenshots to the right and in the gallery! Basically, instead of loading full screen images (which take ages to load on a slow internet connection) you are now loading images that have been shrunk from the originals down to the size that you see so no bandwidth is wasted and you see them load much faster!

Here is how it works:
The script that I’m using takes a src param and a width param. [You’ll see this if you’re viewing the source of the images. ;) ] The src (or source) param is the path to the original full size image. Once the source or path to the image has been established, the script shrinks and caches (saves or stores) the image on the server and then sends it to you. This makes my job of maintaining screenshots much easier!

Just thought you ought to know. ;) You most likely would never have known that these images were served to you on-the-fly and are not actually stored on the server in the sizes that you see. Just a neat little php trick!

If you’re interested in the script that I used you can find it at phpthumb.sourceforge.net/. It’s open source and updated fairly often (just enough so it’s not out of date, lol).

Enjoy the faster page loads!

Online Alarm Clock

Hey all,
I’ve been spending some of my bored time working on a small ‘fun’ project that I had been wanting to get started. I made an Alarm Clock that you can create an account/password for and setup your very own list of alarms to wake you up in the morning. It is very easy to use and it works! If you by chance do have any questions or comments then please feel free to ask away! Comments can be left here for this blog entry..or you can send me an email if you wish (look at the contact me page). I’m always open for suggestions and constructive criticism.

As always..I’ve tried my best to make it follow webstandards and w3 standards, haha. I’m always coding by standards, but that’s what us Opera fanatics do, lol. We don’t force people to use Opera, we already know it’s the best. :P

Back on topic, I hope you all find the Online Alarm Clock useful!