Counting Hits and Referers – now there's two ways

b2++ and WPMU have long been able to record hits and referers. Now you can do it in two different ways!
The original way to record hits in WPMU was by adding this code to your index.html template:

{insert name='getreferer'}

but if you’re not sure that the web page is refreshed every time your blog is loaded you can insert the following html instead:

<script type="text/javascript" language="JavaScript1.2" src="{$siteurl}/wp-counter.php"></script>
<noscript>
<img src="{$siteurl}/wp-counter.php?page=img&loc={$smarty.server.SERVER_NAME}/{$smarty.server.REQUEST_URI}" alt="Stat Counter" border=0>
</noscript>

As usual, replace the quotes in the code above with regular shift-2 characters.

Here’s what the referers listing looks like in your backend:

Enclosures in WordPress

This is test post. There’s an enclosure attached to this post so take a look at my rss2 feed to find it!

Add the URL of the enclosed media file by pasting it into the “Enclosures” text field. WordPress will figure out how big the file is, and the type of file automatically and save that data in a custom field. You can edit that data later through the usual custom field interface.
Because a remote server has to be contacted, it may take longer than usual to save posts with enclosures! This is normal, so wait until the page has completed loading!

Read more on enclosures to find out why they’re useful.

Currently, you have to add the enclosure in the “Enclosures” text field in the following format:
url_length_type or as an example: http://blogs.linux.ie/download/referers.gif_126007_image/gif

Thanks Matt for pointing out I had a problem with the “Host” line of my code – I left out the “:”

As an exercise I created an “enclosure” custom field handler. It returns the details of the custom field in an array which I print using the following Smarty code in post.html under the call to {custom_fields}:

{if $enclosure != ''}
<blockquote><b>Attached Enclosure</b><br />
File: <a href="{$enclosure.0}">{$enclosure.0}</a><br />
Length: {$enclosure.1} bytes<br />
Type: {$enclosure.2}<br /></blockquote>
{assign var='enclosure' value=''} <!-- reset enclosure variable again! -->
{/if}

LiveSearch – Search Results As You Type

Now, this is a bit of a downer. LiveSearch looks like an excellent way to search because, as you type search results pop up magically!
Unfortunately it’s licensed under the Apache 2.0 License which is incompatible with the GPL, the license uner which WordPress is distributed. It would be legal to use it here without distributing those modifications, but that’s of no use to anyone else and I don’t want to maintain yet another source tree! Time to talk to the author…
I just noticed, CollyLogic has a “Live Preview” of your comment as you type it. That’s nice!
Here’s what it looks like in action! (via the support forum.)

WPMU 0.1.2

Here’s another minor release, but with a few changes:

  • Installer is slightly friendlier.
  • I added code to detect incorrect permissions on directories and files left over after the install – instructions included on fixing!
  • Themes support revamped – 10 themes are packaged in a seperate package.
  • Updates to the WordPress core. Some to fix the XSS holes found a few days ago.
  • Static Page support. Create a static page via Options->Pages and call it by adding /pages/name where “name” is the name of your page.
  • Other stuff, minor bugs..

Download it from here: http://mu.wordpress.org/download/
From a question in the comments on adding new blogs, here’s how to do it:

1. Say your new blog will be called “test”, create a directory in wp-inst/wp-blogs/ called test. Fill that directory with the follow directories: templates, template_c, smartycache. All should be writeable by the webserver. Also copy the wp-config.php from ../main/ and customize to your needs (ie. the database table prefix should be changed to “wp_test_”)
2. Create a symlink to that “test” directory in the “blogs” directory that’s in the same directory as wp-inst. (I need to remove this requirement real soon!)
3. Open up http://yourhost/path/test/wp-admin/install.php to configure and setup the database.
4. You’ll probably have to compare the “options” tables of the new blog and your “main” blog as some entries there will have to be updated.

WPMU Static Pages

Ryan Boren has created an excellent “Pages” interface for WP 1.3 but up until now it was useless for WPMU.
This afternoon I built on top of that work by adding support for displaying those pages.
Simply create a page, give it a name and then call your blog, appending “/pages/name” to the end of the URL, where “name” is the title of the page. Here’s a simple test page to test out.

Expect a new release on Friday sometime with this lot included!

WordPress Multiuser 0.1

The very first release of WPMU, WordPress Multi User, is out now and is available for download!
It’s the software the runs this site. It’s a version of WordPress that uses Smarty for templating support and multiple blogs can be runs from the same install!
This version does not have any kind of registration page to create new blogs, but if you pay attention it should be relatively easy to create new blogs.
Play with it, break it, tell me about it!

XSS Security Holes in WordPress Blogging Tool

This Netcraft security alert should be read by anyone who runs a WordPress blog. When you access the admin section of your blog you may be redirected elsewhere.

“We are disappointed that we were not given the opportunity to release fixes for the problems before the information was made public, as is the usual courtesy in the security community,” said a post on the WordPress forum. “However, that’s water under the bridge at this point. Expect a WordPress 1.2.1 release soon, which will address these issues.”