Running WordPress on SourceForge

Running WordPress under SourceForge project web hosting service can be frustrating.  It just doesn’t work as seamlessly as it WordPress normally does.  When I first installed WordPress, the Akismet anti-spam plugin wouldn’t work (still doesn’t) because SourceForge doesn’t allow remote connections.  Yesterday I wanted to include an image in a post only to find that I couldn’t upload an image due to a permissions problem.

It took a while to figure it out and with the reorganiztion of SourceForge, a lot of their documentation is either wrong or missing.  SourceForge allows a “persistent” directory for uploads but it isn’t in the htdocs tree – it is in a different area of the file system.  To get uploads working I had to create a uploads directory in the persistent file system space for my project and then create a symbolic link from wp-contents/uploads to the uploads directory in the persistent directory.  Certainly not real striaight forward but at least it is now working.  It shouldn’t be this hard.  I did all of this with sftp, I couldn’t figure out a way to get a shell open via SSH.

While I was at it I also  updated WordPress to the latest (2.6.2) version.

WordPress 2.7 Thoughts

If you haven’t seen it yet, WordPress 2.7 changes the Admin interface again.  While it seems many people don’t care for it, I like it a lot better than the existing interface.  I don’t care for the terminology they used for the main headers on the side bar though.

I was on the road this week so spent some airplane time working on my wp-SwimTeam plugin and decided to see how it would work under WordPress 2.7.  I have actually started moving my development around a bit and I think it will turn out to be a good thing.  Yesterday and today I was running 2.7 under Linux with PHP 4.4.9.  Last week I was running under Windows with PHP 5.2.6.

2.7 exposed a few things in my plugin which I have fixed but like I said, I am not happy with the new terminology being used.  I had changed my implementation recently so the end user chose the Swim Team menu off the Users menu in the Dashboard and the Admin would choose Swim Team from the Manage menu.  In 2.7, the Users menu doesn’t exist so there isn’t a logical place to put the functionality exposed to the end users.  I’ll figure something out, in the meantime, there is plenty of work to do on the plugin itself.

UI Change for wp-SwimTeam

As the Swim Team Dashboard menu has grown I have been thinking of changing how I present the various choices to both the Admin as well as a Subscriber.  While I have thought about it from time to time, I haven’t done anything about it.  I was recently looking for something in the WordPress plugin directory and found something called Lighter Menus.

Lighter Menus changes the Dashboard menus into a set of drop down menus.  It is very similar to Andy Staines’ Admin Dropdown Menus.  Unfortunately, Admin Dropdown Menus really changed with the WP 2.5 release and the author has subsequently stated he will no longer support it.  Lighter Menus looked like it might be a suitable replacement so I decided to give it a try.

I really liked the way Lighter Menus works except for one thing:  The custom Swim Team menu didn’t work right.  The URLs weren’t constructed correctly.  Bummer.  But I really liked the way it looked.  Was this the compelling event to fix the growing Swim Team menu?  The Swim Team menu was really unwieldy when using the standard Dashboard as well.

As I worked on phpHtmlLib I tested all of the examples and I kept coming back to the TabControlWidget thinking it might be a good solution for wp-SwimTeam.  The TabControlWidget is a CSS based solution which presents different content based on which tab is selected.

Earlier this week, I decided to try it and see if it would work.  The implementation turned out to be really simple and I was able to use all of individual page code almost verbatim.  I like this implementation much better and I think it is much, much easier to use.  This decision also let me clean up some of the code which had been duplicated between the Admin and User side and resulted in the elimination of a half a dozen PHP file.

phpHtmlLib is now a WordPress plugin

The overhaul of phpHtmlLib is largely complete, I just need to validate a few more things before I call it done.  One of the things I did during the overhaul was to add some things to the library so it will load as a WordPress plugin.  This will make installation and configutation much easier.  The changes to phpHtmlLib made the migration from PEAR to the WordPress database abstraction class much easier.

Significant change to the Database Class

Getting a demo up and running on a new host has been very enlightening.  I have used the PEAR DB class for years because it works well and is usually available.  The host which is being used for the demo site doesn’t appear to have the PEAR DB class installed so this has motivated me to migrate the SwimTeamDBI class to make use of the builtin WordPress database access class instead of depending on PEAR.  I have considered doing this for a while but have put it off but it looks like it is time to deal with it.

My intial impression is it should not be to much of a change as my current database class abstracts the PEAR aspect away from the rest of wp-SwimTeam.  The bigger concern is the phpHtmlLib widgets which also depend on PEAR.   Those will need attention and I suspect I will end up implementing a new database abstraction class for WordPress as part of phpHtmlLib.

I have been doing a lot of work on phpHtmlLib over the last week and for the most part, it appears to be done.  All of the changes allow phpHtmlLib to now be loaded as a WordPress plugin which is much easier to support.


I have been putting some cycles into phpHtmlLib as part of getting my wp-SwimTeam WordPress plugin in shape for other people to use it.  I found that PHP5 and GoDaddy’s PHP configuration, phpHtmlLib wasn’t very happy.  After a couple days work I have it put back together so it will work with both PHP4 and PHP5 and can deal with GoDaddy’s PHP configuration.  Now I need to commit all the changes and get back to work on wp-SwimTeam.

Demo Site

I have had a couple ask recently about a demo site for wp-SwimTeam so I think I am going to set one up that people can play with.  The plugin is current live on the MacDolphins web site but since that is a real team and real data, it isn’t a suitable sandbox for people to explore.

If I can set up another instance of WordPress underneath this one to demonstrate the plugin, I will make it available for play with.  I am not sure how to assign new users the necessary permission to admin the demo site since that would provide them a fair amount of control over the actual WordPress install itself.  Hmmm … need to think that through before I turn it on!

Busy with Swim Team

It seems like most of my free time has been consumed with swim team lately.  I volunteered to help bring the MacDolphins into the 21st century this year and it has taken quite a bit more time than I expected it would.  A lot of that is because it is fun working a technical problem and doing it right.

We had some goals for the season.

  1. Report results in a timely manner.
  2. Capture times and keep a history so swimmers and parents could monitor their progress.
  3. Electronic registration to minimize data entry errors.
  4. Communicate quickly and effectively.

After searching the internet for an existing swim team solution I determined there really wasn’t anything suitable do I decided to write my own WordPress plugin to address part of the problem.  I had no aspirations to build a complete solution but I did want to offer something which addressed goals 1, 3, and 4 above.  I started working on the plugin early this year and for the most part, it is working out pretty well.  I wish I had a few more things done but I am happy with what I have been able to do.

For actual meet management, our team (actually me) ended up choosing WinSwim over the industry standard Hy-Tek solution.  I went with WinSwim mostly because their support was excellent and their ability to import our roster electronically.  For whatever reason, Hy-Tek has made doing this difficult if not impossible to do.  (Read more on my wp-swimteam plugin blog regarding my dealings with Hy-Tek.)

WinSwim is easy to use but it hasn’t been without some problems.  Fortunately they don’t seem to mind the volume of e-mail and issues I am sending them and they turn around solutions really quickly.  To distribute the data our parents and swimmers want to see (mostly their times), I have learned quite a bit about Crystal Reports.  It is pretty powerful once you get the hang of it but the learning curve is non-trivial.  This weekend I think I had the “ah-ha” moment because now I am able to edit and create new reports pretty quickly.

The season is coming to a close and I still have a few things to do.  I need to get end of season reports done for our banquet.  I think this will be pretty straight forward now that I think I have a handle on Crystal Reports!

FireBug: Indepensible for theme development

I have yet to code a WordPress theme from scratch.  I have found something I like and started from there.  For the MacDolphins web site, I had found something simple a while back and it served it’s intended purpose but it wasn’t without issues.

As the site has grown, the need to tweak the side bar in particular has increased.  I found an extension to FireFox called FireBug which has made this process significantly easier.  I am using FireBug to chase down CSS conflicts and oddities but it does much more than I realized.

My theme now works correctly even if it isn’t visually very exciting.  The mouse overs no longer overflow the sidebar for 3rd and 4th level deep menus.  I was able to resize the sidebar and the overall content area without things ending up in the wrong spot.  If you dink with themes, FireBug is really helpful.

More on Short Codes

I had posted a question on Short Codes to the wp-hackers mailing list and got a pointed to an article on the Codex which explained the process of coding up a short code.  I expected it to be more involved than it was and I was pleasantly surprised to find it was really straight forward.  I have already implemented one short code for the wp-SwimTeam plugin and expect I’ll have half a dozen more done by the end of the week.

What I implemented for Flickr was pretty simple – it allows the insertion of a Flickr slideshow in a post or page using the Flickr UserId value (which is different than the username) and the Set Id.  Here is the snippet of code:

 * wpst_flickr_slideshow shortcode handler
 * Build a short code handler to display a Flickr slide show.
 * [wpst_flickr_slideshow userid="id" slideshowid="id"
 *     frameborder="pixels" *     width="pixels" height="pixels"
 *     scrolling="yes|no" align="left|center|right" view="yes|y"]
 * To show this Flickr slide show:
 * Use this shortcode:
 * [wpst_flickr_slideshow userid="27604893@N04" slideshowid="72157605764227907"]
 * This is the resulting IFRAME tag which is returned to the caller.
 * <iframe align=center src=
 *     user_id=27604893@N04&set_id=72157605761943480 frameBorder=0
 *     width=500 scrolling=no height=500></iframe>
 * If the 'view="yes"' or 'view="y"' attribute is include, a linl to the
 * Flickr slideshow will be placed under the IFRAME.
 * @param array - shortcode attributes
 * @return string -  HTML code
function wpst_flickr_slideshow_sc_handler($atts)
    $c = container() ;
    //  Parse the shortcode
        'userid' => '',
        'slideshowid' => '',
        'frameborder' => 'default 0',
        'width' => '500',
        'height' => '500',
        'scrolling' => 'no',
        'align' => 'center',
        'view' => 'no',
    ), $atts)) ;
    //  If either the userid or slideshowid are missing then
    //  we have a problem and can't do anything meaningful.
    if (empty($userid) || empty($slideshowid))
            html_b("wpst_flickr_slideshow::Invalid Shortcode Syntax"),
            html_br(2)) ;
        return $c->render() ;
    $if_src = "" .
        sprintf("user_id=%s&set_id=%s frameBorder=%s align=%s",
            $userid, $slideshowid, $frameborder, $align) ;
    $c->add(html_iframe($if_src, $width, $height, $scrolling)) ;
    if (($view == 'yes') || ($view == 'y'))
        $link = "" .
        sprintf("user_id=%s&set_id=%s", $userid, $slideshowid) ;
        $c->add(html_br(2), html_a($link, "View this slideshow on Flickr."), html_br(2)) ;
 return $c->render() ;

The code above makes use of the phpHtmlLib to generate HTML code but the general intent should be pretty obvious.