PostUpdate for Servage Referral Widget etc

July 19, 2008 – 8:57 pm
Post Image

Last night after over an hour of coding I was able to finish version 1.2, the new version is able to count how many times a user clicks the link, then report it in the Widget control panel. I might make an option later to report it under the widget, or in the Dashboard.

Google Analytics is quite a handy tool to see who reads my site and for what purpose, the Webmaster Tools is also great, however I am noticing the search ranking isn’t very accurate for some reason.

In other news I went out half way through writing this entry, the slimline sets of Mythbusters seasons appear to be slowly coming out, I got my copy of Season 1 today.

I also just bought the spamannoys.me domain, mainly for e-mail of course.

PostServage Referral Widget 1.0 Released

July 13, 2008 – 8:31 pm
Post Image

I have just released version 1.0 of the Servage Referral Widget, page located here.

PostWordpress/Servage spam IP filtering

July 13, 2008 – 3:24 am
Post Image

I have Akismet set up to keep spam out as well as keeping all comments for moderation, I initially decided to do some IP blocks seeming as there would be a few that would constantly send spam.

The only problem was that as WordPress only use

$_SERVER['REMOTE_ADDR']

to determine a user’s IP address which as most people who know PHP know it is a bad idea because it doesn’t take into account proxies etc. In my case it was actually giving Servage’s own IP for every result which wasn’t of much use unless I wanted to block comments/trackbacks altogether.

As there’s no documentation that I could find about where WordPress actually contains the code to find the IP and Google wasn’t much help I had to look manually.

I eventually found it in comments.php in the wp-includes directory.

$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );

First to add in the neccessary code a variable must be created, change the above code to this:

$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$bp_IP );

Then add the required code above that stating:

$bp_IP = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];

This allows the correct IP to be shown in most cases, most of the thanks must go to Jason for this.

Update: This piece of code also works in WordPress 2.6x.

PostGoogle Suggest/Trends, theme editing, FileZilla issue

July 12, 2008 – 8:06 pm

http://www.google.com/webhp?complete=1&hl=en
This is now my homepage, it is extremely handy, plus it’s slightly less bloated than the default Firefox search page, trends http://www.google.com/trends is quite interesting to have a look at as well.

Thanks to http://www.blogohblog.com/, http://www.dyers.org/blog/archives/2008/05/21/how-to-add-avatars-to-your-wordpress-25-theme/ and Jason I was able to fix some issues I was having with the Gravatar section of the theme which is by default not supported, the code at first didn’t work I figure because it was incorrectly detecting the WordPress version as something less than 2.5 however there was a </div> that had no starting tag which caused the theme style to get messed up also, after fixing those the Gravatars work fine now.

I have been experiencing a ‘DDE execute request failed’ error in FileZilla 3 when choosing to view/edit files regardless of the fact that it does appear to view/edit the file perfectly fine, there doesn’t appear to be any information that I can find about it when searching around.
I managed to stop it appearing by setting a default text editor, choosing ‘Always use default editor’ and unchecking ‘Inherit system’s file-type associations’, must be a Vista/FileZilla/TextPad/UAC thing.

I received my Windows Vista upgrade advisor shirt not long ago, it’s very well made but I don’t think I’ll be wearing it anywhere anytime soon.

I just found out what a post slug is…

PostUpdate

July 10, 2008 – 1:11 am

1. A simple WordPress update to version 2.5.1, everything working great, also realised (I prefer the Latin ‘ised’, you’re not going to confuse me this time spell checker!) I skipped an important file when updating last time according to the upgrade guide, no harm done though.

2. New theme by ‘Bob’, it’s very white and makes a change from the previous 2 themes, much more professional IMO, well done ‘Bob’.

3. I love Windows Live Writer, it makes this so much easier, you must try it http://windowslivewriter.spaces.live.com

4. I’ve bought many more things on eBay, also the next part of the OS Collection is coming soon.

5. I started getting that display driver has stopped responding error the other day, reseated the card, cleared the carpet of dust around everything and it went away, so much for the scary omen everybody seems to think it is, it was really just letting me know that I should take better care of my PC.

6. There’s a bit of rain around
IDR122

7. Numbered points might seem stupid but they are giving structure to random things that don’t go well together like…

8. That’s right, eBay now stocks… ebayjew