Arrow

Posts on this site are never sponsored.

How to temporarily disable (turn off) all new comments on your WordPress blog

There are currently two options in WordPress to disable comments. One is under “Options… Discussion” where you can toggle “Allow people to post comments on the article” on and off. But this only applies to future posts. The other option is to individually toggle the “Allow Comments” option for each post. But then if you want to temporarily disable ALL comments, this is time-consuming to implement and to undo (and if you use a script to change the setting in the database for all posts… that is a permanent solution for all posts).

If the above options don’t appeal to you, and your situation is that you want to temporarily disable new comments, but still display existing comments (handy if you’re going on vacation), do the following two things:

1) Turn off the display of the comment form in your Comments file in your template. To do this, go to “Presentation… Theme Editor…” then edit the Comments file. Find the part in the file that looks like this (it is probably slightly different, depending on what theme you’re using):

<?php if ('open' == $post->comment_status) : ?>
<h3 id="respond">Leave a Reply</h3>

Change it to this:

<?php // if ('open' == $post->comment_status) : ?>
		<p>Comments are temporarily disabled</p>
<?php if (1 == 2) : ?>
<h3 id="respond">Leave a Reply</h3>

Change it back when you’re ready to re-enable comments.

2) Either rename your wp-comments-post.php file (in the root of your WordPress directory) to something unguessable like betyoucantguessthis.php (then change it back when you’re ready to re-enable comments) OR install (and de-activate later)
this plugin that I whipped up
where you can temporarily disable all comments but choose to still allow trackbacks and / or pingbacks.

The second step is necessary because spammers don’t need to visit your comment form to be able to post comments.

If you’re already using my anti-spam plugin then the second step is already done by that plugin, since it only allows people to comment through the form on your blog (which was hidden in step 1).

Call home from the London, England (or anywhere in the UK) for cheap!

Travelling to the UK? Call home for bloody cheap… on a cell phone! With the Orange UK Call Abroad pay as you go plan, I will be paying only 5p per minute to call Canada from the UK. Heck, that’s cheaper than calling within Canada on my local cell phone plan (7-Eleven Speak Out Wireless).

With the Call Abroad plan, calls within London are 15p to landlines and Orange mobiles and 35p to other London mobiles. So I guess this is comparable to other plans, but remember that the real savings are in making international calls.

As is usually the case in the UK, incoming calls are free.

Of course, what you need to do is 1) Have an existing unlocked tri-band GSM phone and 2) Buy a SIM card for this service — these can be purchased on eBay (and probably many other places on the Internet) for a few dollars or you can just wait until you get to the United Kingdom and find a place that sells one. Then, put the SIM card into your phone and start calling… for cheap!

Extract Mac font suitcases with fondu

I still don’t fully understand what a font suitcase is, but I needed to get individual .ttf files from a .dfont font suitcase. All I had to do was download fondu and type “fondu fontname.dfont” to extract the individual .ttf files from the .dfont font suitcase.

So yeah, I can’t really provide any font support, but check out the free fondu program if your situation sounds similar… fondu doesn’t quite get the Google love that it should (in other words, it took me a while to find that it was what I needed).

Can’t embed Times New Roman, Helvetica, Courier in your PDF, don’t worry about it!

Base 14 fonts include Times New Roman, Helvetica, Courier, Symbol, and Zapf Dingbats. They are included in Adobe Acrobat Reader. So if for some reason you cannot embed these fonts in your PDF, you most likely do not have to worry about your audience being able to display them properly.

About.com does a good job at defining Base 14 fonts.

Why did I even look up this random information in the first place? At eZ Systems, we produced a PDF book from XML using the XEP FOP (read about that here). It refused to embed Helvetica using the included .afm file and thus the printing company said there was a problem because the fonts weren’t embedded. And Helvetica is a font that must be licensed (if you don’t already have it, good luck finding it online without having to pay for it). But upon further investigation, we were told that all was OK because it was just a Base 14 font.

And don’t say we could have just used Arial!

Peter’s Random Anti-Spam Image Version 1.1 for eZ Publish 3.8+

I’ve spun off my anti-spam WordPress plugin — this time for eZ Publish!

I work for eZ Systems, the maker of eZ Publish, as an editor. So I certainly don’t have awesome technical skills, but I’ve managed to create an extension for eZ Publish to help fight comment spam (just as the comment plugin on this blog works where you have to type in the anti-spam word before being submitting a comment). eZ Publish is a rockin’ Open Source Enterprise Content Management System.

First, download Peter’s Random Anti-Spam Image for eZ Publish. Then:

(French instructions available here.)

1) Unzip the customantispam directory into the eZ Publish extension directory.

2) Activate the extension in the eZ Publish Administration Interface by clicking on the Setup tab, then the Extensions menu item.

3) Run the SQL query in customantispamtables.sql to insert the necessary tables into the same database as your eZ Publish installation.

4) Add a policy under the Anonymous Role (click the User accounts tab, then the Roles and Policies link) to grant full access to the customantispam module.

5) Add a new workflow. Click the Setup tab, then the Workflows menu item. Click the New workflow group button and enter any name you want (such as “Anti-spam”).

a) In the new workflow group, click the New workflow button. Name it “Anti-spam” and select the event “Event / Custom anti-spam”, then click the Add event button.

b) Alternatively, you can add the “Custom anti-spam” event to a multiplexer workflow. This is useful if you have several events that you need to run in the “content / publish / before” trigger (in step 6). In that case, select the event “Event / Multiplexer”, then click the Add event button. There are many more options in the Multiplexer event, such as affected sections, languages, classes, versions and users. For this workflow, you can leave all of the options as “all”. If you are using this extension to filter objects of the Comment class, select that under the Classes to run workflow list box. In the Workflow to run dropdown list, select the “Anti-spam” workflow. Then, click the OK button.

6) Add a new trigger by clicking the Setup tab, then the Triggers menu item. Under the “content” module, “publish” function and “before” connection type, select the workflow “anti-spam” then click the Apply changes button.

7) Find your comment template (for ezwebin, it’s extension/ezwebin/design/ezwebin/override/templates/edit/comment.tpl).

Add this at the top of your template:

{set-block scope=root variable=cache_ttl}0{/set-block}

If you are putting the anti-spam protection into a different template (such as directly in a blog post if you are using Kristof’s powercontent extension at http://ezpedia.org/wiki/en/ez/powercontent to add a comment form directly in a template), add cache-blocks around the sections of the page preceding and following the anti-spam code:

{cache-block}
Start of page
{/cache-block}
anti-spam code
{cache-block}
Rest of page
{/cache-block}

However, cache-blocks are probably not necessary if you are editing the edit/comment.tpl template.

Add the following code to the form, usually above the message text area:

<div class="block">
{def $antispam = custom_anti_spam()}
<label>Anti-spam word</label><div class="labelbreak"></div>
<input type="hidden" name="matchthis" value="{$antispam}" />
<a href={concat("/customantispam/audio/(audio)/",$antispam)|ezurl("double")}><img src={concat("/customantispam/image/(image)/",$antispam)|ezurl("double")} style="border: 1px solid black" alt="Click to hear an audio file of the anti-spam word"/></a><div class="labelbreak"></div>
<input type="text" name="securitycode" size="10" />
</div>