New WPMU Snapshot

An all-new, all-singing snapshot is now available. The mu website is going through some updating so you can download the files from here instead:

Hold off on downloading for a while. The SVN repository is down right now and the archives above are corrupted. I’ll post fixed files later. They’re fine now.

Changes:
I rolled in a big patch by Dasher, including Derek Ditch’s wpmu manager. It also included BAStats so you have yet another way of telling where people come to your site from!
Lots of other fixes and additional features, check the change log for more.
Post questions to the support forum if you have problems.

WPMU Asides

After quite a bit of debugging and hacking I have “asides” working in WPMU now. Hopefully I can publish a new release early next week , so send your patches to me at donncha @ linux.ie if you want them included.
I also noticed a spelling typo – edit your post.html and change {the_category seperator=", "} to {the_category separator=", "} – otherwise your category separator will be ignored!

Update – I created a Smarty plugin that checks the category array for “Asides”. This means you can have an asides-format post that’s also in your humour category. Wait for the new release of WPMU for the plugin!

If you want to update your install so you can post asides do the following:

Create a category called “Asides”.

Edit wp-inst/index.php and look for the following line:
$content .= $wpsmarty->fetch( 'post.html' );
Insert two lines before that one:

$category = get_the_category();
$wpsmarty->assign( “category”, $category[0]->cat_name );

Edit your post.html so it looks like this:

{the_date d=” before='<p class=”date”>’ after='</p>’}
{if $category != ‘Asides’}
{is_aside}
{if $is_aside == false}
…..
…..
most of the body of the comments template goes here.
…..
…..
{else}
<div class=”storyContent”><p>{get_the_content} {comments_popup_link zero='(0)’ one='(1)’ more='(%)’}</p></div>
{/if}

{link_pages before='<br />Pages: ‘ after='<br />’ next_or_number=’number’}

The code I added is in italics. Note that asides won’t be filtered by the automatic filters. Is there a way of getting the post content without “echo”ing it out? I need to replace the last </p> of the content because it pushes the comments link down way too much! That means returning it and feeding it into a Smarty modifier. (ie. {the_content|regex_replace:”/^<\/p>$/”:””} doesn’t work because nothing is returned.)
(If WordPress mangles the code above, take a look at my post.html for a clearer explanation.
(If you’re wondering, I’m using the “KDE About” star as an icon for aside entries.)

Bye bye Referer Spammers!

Take a quick look at your logfiles any time and you’re likely to see referer spam in there somewhere. Not only do those requests pollute your log files and stats pages, but they also consume resources on your server when you serve them pages that aren’t even going to be viewed by anyone. Here’s one way of stopping the spammers eating into your server resources:

  • Look through your logfiles and examine the referers. Here’s a quick bit of code to do that. (Remove the backslashes (“\”) from before double quotes. WP is putting them in on me!) :
    awk '{print $11}' < /var/log/apache2/access_log| sort|uniq -c|sort -r|grep -v "mydomain.com"|less
  • Copy and paste any likely looking referer spam sites somewhere else for safe keeping. The ones that use most of your resources will be at the top of the list.
  • Add this code to some page that every page on your site loads, it should be included before main execution of the page occurs. Fill in the array of referer sites with the list your assembled from your log file. I’ve added a few from this morning’s log file.
    if( isset( $_SERVER["HTTP_REFERER"]  ) )
    {
        $referers_to_avoid = array(
                "ttp://texas-holdem.andrewsaluk.com",
                "ttp://www.highprofitclub.com/",
                "ttp://www.sex4singles.com/",
                "ttp://www.parishillton.com/",
                "ttp://www.moneylinebet.com/",
                "ttp://www.free-hentai-anime-sex.com",
                "ttp://www.bondage-bdsm.us",
                "ttp://www.handjob-movies.us",
                "ttp://www.zoothumbnails.com",
                "ttp://www.bestiality-animal-sex-stories.com",
                "ttp://www.gay-men-sex-movies.com",
                "ttp://russ-darrow-kia.gq.nu/",
                "ttp://nissan-xterra.sbn.bz/",
                "ttp://nissan-thermos.gq.nu/",
                "ttp://folding-chair.wol.bz/",
                "ttp://www.xcites-0-cost-interracial-cum-teen-sex-movie.com"
        );
        while( list( $key, $val ) = each( $referers_to_avoid ) )
        {
            if( strpos( $_SERVER["HTTP_REFERER"], $val ) )
            {
                die();
            }
    
        }
    }
  • Add an error_log() to the “if” condition to spot when a spammer visits.
  • Add this to index.php of a WordPress installation to protect your blog and make your legitimate requests go that much faster!

WordPress Multiuser, WP1.5 Sync

There’s a new snapshot available now! In brief, changes include increased use of PEAR Cache, updated Smarty install, referer listings hide direct and internal requests by default. Updated Kitten’s Spaminator and WordPress code of course!
Go download it now and use the support forums if you have a question!
Later… I updated and packaged my collection of WPMU themes again and they’re available from the download page!

What's the GPL? WordPress and PEAR Cache Problems

Ben Ramsey explores some of the issues when you write GPLed code that uses code from the PEAR library.
I had forgotten about the differing licenses used by PEAR and WordPress. They’re unfortunately incompatible and you can’t ship PHP licensed code in a GPL project without an “exception clause” in your GPL license. A change to the license of WordPress would require the agreement of *all* copyright holders of code in the project AFAIK.
Thankfully, I don’t ship PEAR Cache with WordPress MU. I use it if it’s installed already, WPMU isn’t dependant on PEAR Cache being available to work.
I think that gets around the incompatibility. Doesn’t it?