Tag ‘Code’ » Archiv


Never lose your source code, ever!


Twice. In 1 week.

I lost my code and my awesome plugin edits when my hard drive crashed, I started writing it again and I formatted the wrong partition. Seriously gutted! I tried to recover the data with undelete apps but it was gone forever.

No worry no more!

Now, I don’t need to worry because I use Dropbox and have configured my local server to use it as the document_root of my dev site. That way, all the developing work I’m doing gets saved automatically online and is accessible on any of my pc’s.

I don’t even need to worry about being able to access the SAMBA share if I want to edit a file, I just open it from my dropbox on the pc I’m using and save it back there, it’ll get automatically updated on my dev server.

Oops no more!

Another advantage is the revisions feature. You can go online and see the updates that you made to a file and revert it back to an earlier save. This has already saved me from crying, I always forget to rename a file before I start trying to add updates and before I know it, the whole thing is causing an error and I can’t remember how to put it back the way it was! just luvin the revision feature!!

Get 2GB for FREE! (and help me out)

You can apply for a Dropbox for FREE and get a full 2GB to use to store anything from simple documents to executable files to database backups or like me, use it as your code repository and never go through the pain of a lost bit of awesome code again!

You can even install it on Linux which is super helpful when it comes to transferring files between a windows->linux network.

If you click this link and install your dropbox for free, we both get extra bonus space which would help me out a lot :)

Blog Tools, Code, Uncategorized


A day of other peoples code


Support Tickets

I did some pretty fancy tweaking of code today to see if I can replace the support tickets system on ComLuv, the system at the moment isn’t bad but the last support ticket management software I used was far superior and allowed me to reply to closed tickets and create canned responses.

It will need some more work to integrate it into the dashboard of the site but I’m pretty confident I can do it.


I feel the need to tweak themes too, I found an old mockup image on my hard drive that I had for a client that never took up the job and I contacted someone about converting it to a WP theme. I love how it looks and I’d really like to have the format for ComLuv so I can start on tutorials and other features.

That’s not to say the current one isn’t great, it’s just that I’m all for “get it done” then “make it work” and then “make it pretty” and then “do it all again until I have what I want.


I had a bit of a nightmare with my newsletter software taking up too much resources while being on the same server as ComLuv so I took steps to transfer it to another server and use the ComLuv SMTP connection to do all the sending. Hopefully this will fix any issues I was seeing..

Tutorials & Videos

I have the new pc set up with a screen recorder and I have a list of videos that I’d like to produce for tutorials on the ComLuv site. I tested it out and my quad core monster can handle the capture on a widescreen so I can do HD videos and host them on Vimeo

Remote Images & Scripts

I have done some serious optimization on the blogger version of CommentLuv so that now there are very few calls to the ComLuv server for images and scripts. This one thing should dramatically decrease the server load during busy times.


And now I have to tweak the system in the shop.  The tweaking never ends!

Blog News, PHP, Social Networking, Wordpress


Drowning in code – why WP2.7 will be a journey for me


Someone sent me a message saying that the options page doesn’t update on CommentLuv for WP2.7b3 and it’s set off a small chain reaction in my head.

I checked another plugin that does work for the options update in 2.7b3 and compared it to my code and that’s where the kerbumph happened in my head…

My wordpress plugin code needs a complete overhaul! you see, it has grown organically (as in like wild weed beds) since it’s inception as a simple one file plugin to what it is now which is a large bit of code with functions calling functions and some (I admit) messy solutions to problems.

Not my fault though! These messy solutions were made at a time when my coding knowledge was expanding (which is always). My coding knowledge is pretty much down to writing this plugin and it’s support site so it’s only natural that code I wrote just 2 months ago could have benefited from my brain of now.

Not a problem… this just means I need to rewrite the whole plugin and add some things I have wanted to do for a long time but I didn’t know how!

Here’s a list of things I have in my mind for it (more for my own sake when I come back and stare at old posts for inspiration)..

  • Move the options page to a separate file
    This will make it easier to update options and be compatible with 2.7
  • Fix so no config for form fields required (done)
    This came to me while thinking about eggs. go figure!
  • Use external javascript file for CommentLuv and heart box
    I wanted to do this a long time ago but didn’t know if my server could handle it, turns out it can and it has the advantage of me being able to change the way commentluv functions at one place and everyone that uses it gets the update immediately. no more relying on people to update their plugin!
  • put a refresh image next to the last blog post so someone can refresh their link
    This is so I can simplify the code of the javascript for speedier running and compatibility
  • add alert function so remote script can send back an alert to the user if they’re commenting too fast
  • make all platform versions look the same (blogger done)
  • retrieve commentluv member id from options page via ajax
  • automatically detect if blog is using ID commenting and take appropriate action so commentluv still works

There’s a lot more I imagine but the most important thing for me is the options page and remote javascript instead of included.

The house will be busy this week and the contest is going mad so when all that’s over, I’ll see if I can go to a quiet place and be out of contact for a week while I make the changes. oh gwd, I see a large growth of chin whiskers happening…

Blog News, Code


A great book for wordpress theme design


WordPress Theme Design – Tessa Blakeley Silver
Price 35.99 USD (ebook $27.19)

I bought a book recently after seeing it mentioned in the WP dashboard news items, it’s called WordPress Theme Design by Tessa Blakeley Silver and although a lot of the information regarding the functions of wordpress can be found at the codex, the book gives you so much more like the process gone through to design a theme from scratch.

I do quite a lot of sites in wordpress now and find it much easier to provide a client with a website that can be updated so easily, a few plugins here and there and you can provide a website that does all and more that’s needed.

Usually I get a standard theme and cut it up a bit and change the css to give me my site, or create in photoshop and send off for wordpressing but lately due to some more custom design requests I’ve received and the always dependable mistakes that freelancers can make I have wanted to do the whole thing myself from scratch..

I’ve downloaded a tutorial before about WP theme design from small potato before it was taken over and that was pretty darn useful but was made a little while ago so it wasn’t 2.5 specific.

That’s why I like what Tessa has put her book, it takes you step by step through the process of creating a non-blog wordpress blog, from sketch to WP core code. It’s made a big difference to my initial prototyping of concept sites and has really opened my eyes to what you can do with a bit of manipulation of the wordpress template tags. I’m even working on a magazine style front page for here so I can have a featured post for contests that stays up while it’s open for entries as well as excerpts to the regular posts..

You can buy the book printed or get it as pdf for a bit cheaper (I printed mine out from pdf on someone elses printer lol!) at packet publishing

Packtpublishing is sending me a new book about WordPress For Business Bloggers , they’re offering a deal if you get both books together. Stay tuned for the review of the new book!

Audio, books, Reviews, VWD elottery, Wordpress


Autumn Sun and Coding Fun


After a bright and early start to the day after my scrumptious chicken last night I felt good as the sun shone through my window and now, in the late afternoon, I’m done.

CommentLuv is now updated to 2.5, it incorporates the heart tip plugin as an optional extra and makes it compatible with wp2.5 too.

I spent most of the time separating the jquery and other scripts into include folders which makes the header source much tidier and the scripts themselves much easier to edit and update. The last 2 hours have been spent getting the tip box to work as part of commentluv and the result is activated here for testing.

I’ll let it settle in for a day or so and then do a codex update along with an update to the CommentLuv registered members to let them know about the site allowing them to edit their profile and have their description parsed and placed in the info boxes.

I made some minor changes to the code so that those who prefer the old style commentluv can have a checkbox to untick if the user doesn’t want the last post shown. Hopefully that will make it easier for the previous versions users to switch to the new one.

To celebrate, I’m off for a walk next to the canal with the missus
canal boats

edit… I had such a nice walk that I came up with some good ideas and my missus’ secret stealth plan to get us to end up in Oxford street gave me time to run them through my head until I could get back to the keyboard and add them in!

I have put in a bit of code that should make it work out of the box for most blogs, most of the questions I get on the forum are solved either by getting the person to change their comment form ID value or telling them that it is working but they can’t see the button and checkbox while they’re logged in as admin.

Now, the form id is found out automatically as long as the comment text area ID is correct and that should be because all wordpress blogs send their comment as POST variables which use the name attribute of the form and for that to work on all themes, all themes must use the same values for the name attribute.

If I know what they are then I can find out the parent form ID easily.

I’ve also added the checkbox and badge to show for admin so I no longer have to spend ages visiting peoples sites and viewing the source to let someone know how to get the plugin working.

this is really the best version out yet! I’ll update it on the codex tomorrow

ajax, Blog News, Blog Tools, Code, PHP


Some important things to note for WordPress plugin Authors


I have learned a gadoodle of information over the past 3 weeks of coding the update to CommentLuv and it would have gone a lot smoother had I known these 2 things.

Including jQuery with wp_enqueue_script

This seems to be simple at first but there is an important caveat to note.

You can include the jQuery library manually by echoing out a <script src=”… in your plugin code which works but could cause a problem if a user has changed their wp-content location or there are other plugins including jquery which would mean it gets loaded twice or more which isn’t ideal.

The solution is to use wp_enqueue_script but, it needs to be put in the right place!

If you use the wp_head action to call a function that has wp_enqueue_script in it then the library wont be included, using wp_head is too late in the render process for WP to put in the include.

Instead, I put wp_enqueue_script(‘jquery’); under the actions and hooks commands so it is run as early as possible in the execution of the plugin.

The plugins directory constant wp_plugin_dir

This has always tripped me up for some reason but it all became clear recently.

If you want to reference an image or js file in your plugins directory it is a lot better to use a constant than to put in an absolute url. I thought I had solved everything by using the constant WP_PLUGIN_DIR which works with WP2.6 and up but doesn’t work with WP2.5.1 :-(

What if you want to make it compatible with wp2.5? simple!, use this code in your plugin and you can use all the constants for WP2.6

if ( ! defined( 'WP_CONTENT_URL' ) )
define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
if ( ! defined( 'WP_CONTENT_DIR' ) )
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
if ( ! defined( 'WP_PLUGIN_URL' ) )
define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
if ( ! defined( 'WP_PLUGIN_DIR' ) )
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );

Code, PHP, Wordpress


Animated DIV slide


I’ve been working with jQuery quite a lot over the past week to get the commentluv settings page up and running and get the new commentluv plugin working as promised. It always amazes me at how incredibly easy it is to get it to do cool things with a web page.

Not just Ajax things, simple effects that allow you to take a page from a digital piece of paper to a digital pop-up book! Click here for an example..

Look at me!

Send me back up

Example explained

(you should have the jQuery library loaded in the head of your document, my wordpress already does this but if yours doesn’t you’ll have to put a line like this in the head of your page) read more… »

Blog News, Code, Wordpress


Beating the beta out


I must say thanks to the following people who have helped me get the Ajax version of CommentLuv to an installable beta state…

  1. tata from imnotbeautifullikeyou.com who was the very first blog to have a installable plugin of ACL – thanks so much for the repeated re-install of the plugin to get it to a semi-working state, it really helped having you reply so quickly
  2. Pacuraru Ovidiu from Zice.ro for checking for compatibility with Mu.
  3. Jon from Beauty Salon Marketing for finding the kinky slash that threw a spanner in the works. (spanner removed!)
  4. Byteful Traveller from Byteful Blog for making the fine looking badge used on the bottom of the comment form

I put the link to the beta version as a reply to a comment on a post from a few days ago and it’s been downloaded nearly 50 times! Either some people are lurking in the background or someone is click happy!

The new version of the Ajax CommentLuv plugin and supporting site are still in early beta but do seem to work. There’s probably some i’s to dot and t’s to cross but that’s what beta releases are all about!

The major feature is it finds the post while the visitor is typing their comment which speeds up comment posting and reduces load on the server as it’s all done on the browser side. It’ll reduce the load on my server to because it’s called with javascript and most ‘bots don’t parse that.

If you feel like being a bit of a tester, here’s the temporary download link. Please give your comments in the support forum if you have issues and I’ll do my best to fix any errors as and when they come.

Blog News, Blog Tools, Code, Wordpress


Another coding frenzy successfully finished


I’ve had another few days of intensive coding and completed a few plugins that can help with the new theme.

I can’t believe that only last week I was feeling burnt out with coding! All I needed was a little “I wonder if I could …” php demon in my ear and I was off. Everything else has suffered though, I have barely talked to anyone in the past 3 days. I haven’t even answered any text messages! lol. I must be a hermit :-)

Here’s what I’ve been up to:


Blog Tools, Code, PHP


Rainy day – perfect weather for code tinkerers


It’s a rainy day outside and I’m just in the mood for coding! First I have to plough through all the comments and see if I can get a decent reply up, visit the site and hopefully make a meaningful comment.

I played with the database code for CommentLuv last night and successfully got a page up and working showing blogs that I have received comments from but not recipricated which was pretty cool, problem is that I noticed that I need to restructure the tables in the database and the code that populates it! arrrgh, just when I was about to switch it on for the whole of the commentluv userbase… luckily I got it in time so I can make the changes without too much fuss.

I think I’ll work on the commentluv site for a bit today, change some css and get the general layout the way I want it. That should take the best part of a couple of days (which in realilty means it’ll be all week!) at least I’ll remain dry throughout…

Blog News, Code