Where is my Winter Olympic streaming video coverage?

February 15th, 2010

I find it hard to believe that it is 2010 and we are still not able to watch live cov­er­age of the Olympics online.  With the tech­nol­ogy we have avail­able today, this idea seems like a no-brainer.  I don’t care much for the Sum­mer Olympics, but I am hop­ing that some­one has this fig­ured out for the 2014 Win­ter Olympics in Russia.

Figuring out page vs. post in Wordpress development

January 26th, 2010

I’ve had a Word­press plu­gin in its infancy for about a year now and I’ve slowly been adding func­tion­al­ity.  I recently added a fea­ture where I needed to be able to tell whether the con­tent I was look­ing at was a page or a post — from inside the code.

The is_page() func­tion sounded like it would work, but that seemed to return true for both posts and pages.  What worked for me was the get_post_type() func­tion.  This will return ‘post’ or ‘page’ depend­ing on what con­tent you are deal­ing with.

I know that I have spent far too much time search­ing for this func­tion­al­ity in the past, so here’s to remem­ber­ing it for next time!

The Word­press func­tion ref­er­ence for get_post_type() is here.

Post Thumbnails in Wordpress 2.9

January 6th, 2010

Here is a nice write-up on using post thumb­nails, a fea­ture new to Word­press 2.9.

New in Word­Press 2.9: Post Thumbnail Images

Pretty sim­ple to use if you are used to cre­at­ing your own themes, and not a bad rea­son to update to 2.9 if you haven’t already.

Blog Freshness Wordpress plug-in

December 28th, 2009

I have always been bad at main­tain­ing a blog.  Maybe I am just not meant to blog, but maybe, just maybe, what I really needed was a lit­tle nudge to keep me post­ing.  That lit­tle nudge has come in the form of pub­lic shame.  I’ve cre­ated a Word­press plug-in that dis­plays a badge in the cor­ner of my site let­ting every­one know just how ‘fresh’ the blog is.

FRESH - Less than 7 days since last post

STALE - 7–30 days since last post

MOLDY - 30–60 days since last post

DEAD - 60+ days since last post

This is just a test to see if it helps keep me moti­vated, but I thought I would include the plug-in any­way.  Maybe some­one else will be moti­vated too.

Blog Fresh­ness Word­press plug-in

Hey, look!  It is already working.

Great article on tweaking the Wordpress back-end

December 18th, 2009

There is an arti­cle over at Smash­ing Mag­a­zine, called Advanced Power Tips for Word­press Tem­plate Devel­op­ers: Reloaded

It includes a num­ber of tips rang­ing from mod­i­fy­ing the logo on the dash­board, to hid­ing fields from dif­fer­ent users.  My favorite tip is ‘Adding a Cus­tom Meta Box,’ which allows you to cre­ate a friend­lier input box for cus­tom fields.  I cre­ated a plu­gin for Word­press that does some­thing sim­i­lar to this, just not nearly as ele­gantly.  Mine had a cou­ple of extra fea­tures, but I think a rewrite is in order.

Permissions and Input Formats

November 25th, 2009

This is prob­a­bly some­thing that inter­me­di­ate to advanced Dru­pal users will already know, but I ran into some issues with per­mis­sions and Input For­mats today.

There was a con­tent type that a spec­i­fied role had per­mis­sion to edit, but for some rea­son, when that user would attempt to edit the page, they would get a ‘per­mis­sion denied’ mes­sage.  The prob­lem was that the con­tent type was using the Full HTML input for­mat, and the role did not have per­mis­sion to use that format.

In order to give the role per­mis­sion, you nav­i­gate to Admin -> Site Con­fig­u­ra­tion -> Input For­mats, and con­fig­ure the appro­pri­ate for­mat.  You can also give the role the per­mis­sion, “admin­is­ter fil­ters” in Admin -> User Man­age­ment -> Per­mis­sions if you want a sure fire way of over­rid­ing the issue altogether.

Creating and using Drupal user profile fields

November 14th, 2009

I needed to add a new field, loca­tion, to the user pro­file on a Dru­pal site, and the value set in the loca­tion field needed to be dis­played when the user made a com­ment on the site — like “Brian Dart | Seat­tle, WA”.

I found two great arti­cles online that helped guide me to a solution:

Dru­pal: use user pro­file field in comment

Pro­file: extend­ing user account information

These arti­cles walked me through the steps of con­fig­ur­ing the pro­file mod­ule in Dru­pal and then helped me under­stand how I could access the value from the code.  Unfor­tu­nately, I could not get the code to work prop­erly using the phptemplate_comment_submitted func­tion.  There was already a phptemplate_preprocess_comment func­tion in the template.php file, so I added the fol­low­ing code — slightly mod­i­fied due to the dif­fer­ence in vari­ables that were available.

function phptemplate_preprocess_comment(&$variables) {
  $user = user_load(array('uid' => $variables['comment']->uid));
  profile_load_profile($user);
  $location = $user->profile_location;
  $comment = $variables['comment'];
  if ( !module_exists('profile') || !$location) {
    $variables['author'] = theme('username', $comment);
  } else {
    $variables['author'] = theme('username', $comment) . ' | ' . $location;
  }
}

The loca­tion field I set up was called ‘profile_location’, and I am sim­ply adding that on to the author vari­able, which is already being dis­played on the com­ment.  Not the most ele­gant solu­tion, I am sure, but it served my pur­poses well.

Creating form templates in Drupal

October 28th, 2009

Look­ing for a way to con­trol your Dru­pal theme’s form out­put?  I needed a way to con­trol how the forms, more specif­i­cally the user forms (log in, reg­is­ter, etc.), were out­putting onto the page.

This arti­cle helped me through the steps I needed to cre­ate tem­plates for the forms and then style them accord­ingly.  And, despite the article’s title, the same can be accom­plished for any form in the Dru­pal sys­tem (edit: with the excep­tion of Uber­cart, but that isn’t Dru­pal core…). Great stuff.

Them­ing the reg­is­ter form in Dru­pal 6

Welcome

October 20th, 2009

Wel­come to my blog.

In the future, I plan on updat­ing this site with my thoughts and expe­ri­ences nav­i­gat­ing the treach­er­ous seas of work and life.  Well, mostly work, but it is some­times hard to sep­a­rate the two.  But I hope to keep it as acces­si­ble as possible.

Stay tuned and enjoy.