Protect Yourself From an Accidental 'Publish' with a Wordpress "molly-guard"

Note: the following has only been briefly tested with version 2.9.1. Use at your own discretion Apparently I’m not the only one who has accidentally clicked on “Publish” when they meant to click “Save Draft”. After searching high and low, I couldn’t find any plugins or “best practices’ for doing this. I have taken matters into my own hands and created a “molly-guard” for the “Publish” button.

This is a quick and dirty hack, it’s not pretty but it gets the job done.

Modify meta-boxes.php

In your wordpress installation located wp-admin/includes/meta-boxes.php

Next, find the section just below

<input type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" name="original_publish"></input>
<input name="publish" accesskey="p" value="<?php esc_attr_e('Schedule') ?>" type="submit" id="publish" tabindex="5"></input>

Now replace the original contents (between the and )


<input type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" name="original_publish"></input>
<input name="publish" accesskey="p" value="<?php esc_attr_e('Publish') ?>" class="button-primary" type="submit" id="publish" tabindex="5"></input>


<script type="text/javascript">
<script language="javascript">
    function toggleMolly() {
        document.getElementById('molly-guard').style.display = 'none';
	document.getElementById('real-post').style.display = 'block';
<div id="molly-guard">
    <input value="<?php esc_attr_e('Publish') ?>" name="molly-button" onclick="toggleMolly();" class="button-primary"></input>
<div style="display:none;" id="real-post">
    <input type="hidden" name="original_publish" value="<?php esc_attr_e('Publish') ?>" id="original_publish"></input>
    <input name="publish" accesskey="p" value="<?php esc_attr_e('Sure?') ?>" class="button-primary" type="submit" id="publish" tabindex="5"></input>
<div id="molly-guard">
<input value="<?php esc_attr_e('Publish') ?>" class="button-primary" onclick="toggleMolly();" name="molly-button"></input></div>
<div style="display: none;" id="real-post">
<input type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" name="original_publish"></input>
<input name="publish" accesskey="p" value="<?php esc_attr_e('Sure?') ?>" class="button-primary" type="submit" id="publish" tabindex="5"></input></div>

How this works

Like a real molly-guard, this doesn’t disable or modify the publish button itself, it simply covers it up (actually ‘hides” it in this case).

When the page loads the “Publish” button (in its new surrounding div) is set to hidden.  In its place we have a new button that simply triggers some javascript when its clicked.

When it is clicked, it hides itself and reveals the real publish button.

This may not be a very clean solution, but it will buy you that few seconds to react if you instinctively click “Publish” in a fervor so save your latest draft.

Let me know if this helps you out, or if you have any recommendations. Contact me if you have experience writing Wordpress plugins and lets figure out how to do this right!

The four reasons why lockpicking is an essential skill for IT

Last week, I was tasked with the rather mundane chore of performing a physical inventory of a server.  To give you some background, most of my clients are small businesses, which typically have no IT staff of their own and are very lucky if they have one “power user” on site. Luxuries such as documentation and maintenance are a rarity.

After years of faithful service, a certain client’s server sorely needed some attention.  When it was setup (years ago) the “C” drive partition was probably ample, but now they are in constant danger of some calamity or another because the drive is running out of space.  At the same time, the secondary partition has vast, unused, capacity.

Since this is a “delicate” server (no one has documentation or knows how to rebuild it if things really go south) my first order of business is a full inventory.  And this, ladies and gentlemen, is where our story picks up.

The final bit of my checkout of the server included physically verifying the make, model and capacity of its hard-drives.  I needed to verify that what we thought was connected and active, actually was.  As I was putting the side panel back in place, I somewhat absent-mindedly reached around front of the server to open the door and remove the drive trays.

“That’s funny,” I thought, “this doesn’t want to budge.”

Taking a closer look, to my dread, the case door was locked tight!

After quite a while of searching the typical places (near the server, on the server, in the server) I concluded that the key was missing.

Rather than feeling defeated, I was actually smiling.  Now I get to use one of my favorite IT tools, the Dyno Kwick Lock Pick.

In under a minute I had my lock pick out, opened the lock, had it safely stowed away and was on with my business.

The really great thing about this pick set is that it looks just like any other tool you might use.  It is less likely to raise a suspicious eye. If it does, it’s presentation goes a long way to say “I am a tool for getting a job done”, rather than “I am the tool of a criminal”.

I’m sure you can imagine plenty of times when this skill might have come in handy: unlocking a desk drawer that has been long forgotten, letting yourself in after being locked out, or even opening server cases as I have.

It is obvious to see how this skill can be useful to practically anyone, but I want to tell you why I think they are especially usefully to those in IT.

Reason One: It demonstrates that security is an illusion

This is a bold statement, but all security is an illusion.  Even the best lock (physical or digital) can only serve to slow down someones access, it can never completely keep anyone out. Any lock, with sufficient time, can be opened. It is just a matter of determination. Lock-picking will make a very concrete example of this.  Nothing can match the overwhelming feeling the first time you pick your first lock and think,_ “It can’t be _that easy, can it?”

Reason Two: It will test your perseverance

Undoubtedly, you will meet that one lock that will test your patience.  You studied and practiced, yet you just cannot get this one to yield.  You’ll want to swear and throw it across the room.  Through practice you will learn that all of these things are counter-productive.  The more tense you are, the harder and harder it will be to pick.  An essential skill for lock picking is to maintain a feather-light touch on the torsion wrench (the “L” shaped piece pictured above) while using your other hand to do the picking.  Any extra tension (literal and figuratively) can lead to you having to start all over.  This practice will help to reinforce the skill that all people in IT must have, grace under pressure.

Reason Three: It reminds you to be humble and to keep a “beginner’s mind”

Remember that lock that you have been practicing on for hours.  You’ve cursed, you’ve tossed it aside, and you’ve come back to finally get _it.  One of your friends will ask you what this lock picking thing is all about, and they ** will** pick that lock on their first try.  Why? Because, they didn’t know that they _couldn’t do it.  Lock-picking will teach you to be humble and not focus on what others can do better, but to take an honest inventory of your skills and your progress.

Reason Four: It makes it easier to admit defeat

Sometimes, you will have to just admit defeat.  It might be for a few minutes, for an evening, or for even longer. In the end, being able to admit your limitations will allow you to focus on the things that are within your grasp.  It isn’t productive to waste energy on things that are out of your reach for the moment.  This isn’t to say you should give up on your goals or aspirations, but you should temper these with realistic measures of your abilities.  The knowledge of what you can do will fuel you to keep bettering yourself to eventually reach that next step.

Please consult your local laws on the possession, transportation and use of such tools

The laws and requirements vary from state to state and country to country.  Please do some research and see what those laws are in your area!  The lockwiki might be a really good place to start.

Here are some more sites to start your research:

So, does anyone out there have any unconventional skills that have helped them out in the IT world?  I’d love to hear from you!

This is one of my more popular articles. If you have any suggestions for updates or new articles like this please don’t hesitate to leave a comment below, or email me directly at [email protected]

Whoopsie, the "Publish" button needs a molly-guard

It looks like I may have prematurely posted an unfinished article.  The article has been since finished and published, some people may have received a half-written one.

While, it is the rare glimpse into the inner-workings of my writing process, I still want to say “sorry, my bad”.

I ended up writing one