Beta testers wanted for Post Avatar

It’s nearly here! Post Avatar 2.0 is pretty much ready but before I release into the wild I’m looking for some beta testers to, well, test it out.

So what are the major changes?

WordPress 2.7 Baseline

When I first developed Post Avatar, WordPress 2.0 had just come out and all upgrades have been compatible with it. But lets face it, having to maintain support for that long a range of WordPress releases has been difficult. Plus I want to take advantage of newer features in WordPress that I’ve decided to benchmark development for the 2.7 release and up.

Filters and Actions

I’ve added a number of actions and filters that hook into Post Avatar to make development of add-ons (uploading capability, additional image selectors and so on) much easier.

Changes to the gkl_postavatar template tag

Yes, I have made changes here. For people who don’t feel comfortable editing their themes, the HTML/CSS options will still be available in the Post Avatar settings page. However, you will no longer be able to set HTML to display before and after an image within the template tag.

If you’re interested in beta testing, drop me a line: vix@garinungkadol.com and I’ll send you the zip file.

So how's that rewrite coming?

I’ve converted most of the Post Avatar plugin into a class and added hooks for certain areas: the options screen and the write screen. My goal for this rewrite is extensibility. This idea is coming up more and more in WordPress land, particularly in themes, so I think plugins (which extend WordPress themselves) can do more for integrating with one another.

For Post Avatar what I want from the plugin is to simply choose from a library of existing images. Last year I rewrote the plugin from scratch to take into account: image uploads, tagging and a whole slew of features. It worked but I wasn’t completely happy with it and I felt it was taking away from what I originally designed Post Avatar for.

This time when I do put in uploading capabilities, user-centric post avatars and the like I’m going to be exploring methods of taking advantage of WordPress’s table structure and api.

Going back to this rewrite. The code is mostly ready – I’ll be releasing it for beta testing in a week or so.

Playing Around With Thematic

I’ve been experimenting with Theme Frameworks and this design makes use of Ian Stewart’s Thematic. Aside from providing a number of widget-ready areas, it has a number of post and body clases that help to make a theme more unique in terms of content placement and styling. But what is most impressive are the hooks and filters that make it easier to customize themes through functions.

My goal for this exercise was to see if it was possible to create a child theme that consisted only of the images folder, a stylesheet and custom functions. Here I only added 3 template files for the following reasons:

  • archives.php ~ I wanted to include tag listing as part of the archive
  • comments.php ~ I want to customize the comment form further
  • sidebar.php ~ I want to have a different sidebars depending on the location: pages will have a different sidebar from the index pages or the archives page

But everything else was done with custom functions – the different layouts for the first post and subsequent posts as well as the category display.

I’ve still got a bit left to finish – adding more content areas, playing around with font colors and deciding what to place in the sidebars – but I’m really pleased with how everything has turned out.

Post Avatar 1.2.3

A couple of minor bugfixes and a few new features, namely:

  • Avatar selection rights for Authors, Editors and Administrators only. Use the role manager plugin to customize access rights. If you already have Post Avatar installed, deactivate and reactivate the plugin to update user rights
  • Customize HTML and CSS within the options page. Dominik added this to make it easier to change the styling of avatars. It will work with both the template tag and the automatic avatar display
  • Automatic avatar display for post excerpts is now included
  • I fixed the bug where avatars where showing up in feeds

Download now or visit the plugin page

UPDATE (Oct. 9, 2007): Discovered a bug (Thanks Paul!) – automatic avatar display causes the image to appear twice when using the_excerpt. Download the updated zip file or if you’re feeling adventurous:

Open up gkl-postavatar.php and look for this code at the end of
// Display avatar without template tag
if ($gkl_ShowInContent == 1){
add_filter('the_content', 'gkl_postavatar_filter');
add_filter('the_excerpt', 'gkl_postavatar_filter');
add_filter('wp_head', 'gkl_postavatar_showcss');
}

Just comment out or remove “add_filter(‘the_excerpt’, ‘gkl_postavatar_filter’);”.

It should look something like this:
// Display avatar without template tag
if ($gkl_ShowInContent == 1){
add_filter('the_content', 'gkl_postavatar_filter');
add_filter('wp_head', 'gkl_postavatar_showcss');
}

Moving Your WordPress Installation? Consider This!

There are some great articles and tutorials on how to move your WordPress installation for all manner of user levels. They range from the basic to the detailed or for more advanced users.

But one thing these guides have failed to mention if you use the built-in upload facility – watch your absolute server paths.

What the frak is an “Absolute Server Path”

The absolute server path is the full path to a file or folder. More about paths. For example a jpeg file name “just-a-picture.jpg” is stored here: wp-content/uploads/just-a-picture.jpg.

The absolute server path could look like this:

/home/username/public_html/wp-content/uploads/2007/03/just-a-picture.jpg

This value is what WordPress saves every time you upload an attachment inside the following post meta keys:

  • _wp_attached_file
  • _wp_attachment_metadata

While this doesn’t really affect what you see on your website, it does affect the uploads admin page. Instead of seeing a thumbnail, you’ll see the full image.
And unless you want to upload all the images again, then you’re screwed.

Okay so I am exaggerating. You just have a bit more work to do.

So what do I do?

Before transferring your database over to your new server, open your database backup in a text editor and change all instances of the old server path to the new one with the search facility.

Or you could use the tool mentioned here to do a global search and replace for the absolute server paths.

I ended up making a plugin to help fix 1000+ attachments for my friend’s website. With better than dial-up internet speed, it took about a minute each to fix thumbnails and attachments.

So I’m releasing the Fix Attachments plugin for use as a last resort in case the two options I mentioned above don’t work for you.

Remember, have an unaltered backup of your database handy in case anything goes wrong. The plugin worked fine in my case but it may not work in yours and you WILL want to restore your database.

In a mood

The WordPress Codex lists some plugins for adding moods to posts

Moody: Enter your mood in the Custom Field section of your post entry and the plugin will display in your theme below the time.
Sounds good but the plugin doesn’t work with WordPress 2.0 and up. Plus you have to do your configuration in the php file.

Mood Quote: Let’s you assign a quote for your mood. Interesting plugin though it’s not what I need.

Cricket Moods: This plugin lets you assign moods with images so whenever you put a mood in your entry. What’s good about this plugin is that each user can customize their own mood list and you have the option to automatically show the mood or position it in your template.

MyMooMus: This is a three-for-one plugin, combining the display of moods, music and tv in your posts. However it only shows the text not images.

I’ve made my own plugin that lets you set the location of your mood directory and image extension. In the Write Post screen, select a mood from the drop-down list of moods. There’s also a template tag to display the mood in your template. It’s not available to the general public because I’m still testing and adding features but if you’d like to try it out, drop me a line and I’ll send you the file.

The Quest for Userpics Continues

I’m trying to get Livejournal functionality here and one of the main features I’d like to have is userpics.

In LJ they’re used to identify the theme of an entry and I’d like to do the same here. Since I have free account I only have 6 userpics but I figure if I can have that feature here, the number of userpics I can have is unlimited!

I tried the Post Image plugin which works in tandem with WordPress’s upload capability. But this meant I would have to upload a picture for every time I made a new post. Not good since I would like to re-use certain images from time to time.

Next I tried just placing in the link to the image in the Custom Fields section of the Write Post screen but I have difficulty remembering the image names and I spent too much time checking on the different pictures.

I could have used Category Icons but this is pretty much like having 6 userpics only.

The closest plugin I could find was Multi Topic Icon but I found it cumbersome to use especially in terms of positioning the image.

So I decided to make my own plugin, Post Avatar, my first by the way.

The way it works is you upload your images to a specified folder and each time you make a post, you have a list of images to choose from. There’s also a template tag that you can place in your theme to display the picture.

I’m really pleased with the way it turned out. *Go Team ME*. In the future I’ll be adding an image preview so I know what image I’m attaching to my post.

So I decided to create a plugin that would display a list of images I had already uploaded, for me to select when adding a post.