Windows 10, ZSH, Putty, Powerline Fonts and Screen

I recently was setting up my Windows 10 desktop machine with Putty so I could access some servers. I use the ZSH shell with OMZ and the Powerline9k theme. I use the following article to set up Putty and grab the appropriate fonts for Windows 10 that were patched.

There were some additional options on the following blog article that were required.

Oh My ZSH! with PuTTY

Everything was working great until I was having issues with powerline font’s not showing correctly when using screen.

Running the powerline echo test below resulted in hashed blocks.

echo “\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699”

echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"

Turns out I didn’t have my locale set in my shell environment.

export LANG=”C.UTF-8″

export LANG="C.UTF-8"

Once I had the appropriate locale set, everything worked fine.

WP-CLI Cheat Sheet


wp wc update – Updated WooCommerce database from command line.


wp lscache-purge all – Purge all cache.

Improve WordPress Comments Load time when using Akismet: Adding an index to wp_comments

A customer of mine was seeing a 15 second load time on their WordPress site when clicking on “Comments”.

I installed Query Monitor and saw that the Akismet plugin was running the following SQL command on each comment.

SELECT COUNT(*) FROM wp_comments WHERE user_id = 1820 AND comment_approved = 1;

This query was to show how many comments the user had previously had approved. The query was taking 0.5 seconds per comment listed when you visit the “Comments” page. The page was taking around 15 seconds to load at times. Now if you had this page set to load 100 comments per page, then you’re looking at 60 seconds.

I decided to run an explain on the query to figure out what was going on.

explain SELECT COUNT(*) FROM wp_comments WHERE user_id = 778 AND comment_approved = 1;

Which resulted in the following. (Sorry for the screenshot, copy/pasting and reformatting was not something I wanted to do. Also this references the wp_bspr_comments. This is due to the database having a wp_bspr for it’s table prefix.

MySQL Explain on wp_comments query not indexed

As you can see, the query is having to go through 19866 rows within the wp_comments table which is the total amount in the table. Since they’re using count(*) all rows are scanned.

So I decided to add an index for the user_id and comment_approved columns.

create index wp_comments_askismet ON wp_comments (user_id,comment_approved);

No when running an explain, there are only 9 rows scanned.

MySQL Explain on wp_comments with Aksimet after index

Load times were reduced dramatically. However, this can all be mitigated if you simply turn of the Akismet feature.

Akismet option to show number of approved comments beside each comment author.

WHMCS and Hexonet ISPAPI Registrar Module “Missing Required Attribute; X-CA-LEGALTYPE” Issue

If you’re running WHMCS and the Hexonet ISPAPI Registrar Module, you might have issues registering .ca domain names. An error will show up when you click on register, here’s a screenshot of the error.


Invalid attribute value; INVALID Contact [OWNERCONTACT] (Missing required attribute; X-CA-LEGALTYPE)]

This is due to the .ca registry requiring all registrations require a legal type designation, there’s multiple types. Commonly used types are Canadian Citizen and Corporation.

The fix is to open up the file “modules/registrars/ispapi/additionaldomainfields_sample.php” which is either in the downloadable zip file or already in your WHMCS installation. The file contains the following additions domain fields that you need to place under “WEBROOT/resources/domains/additionaldomainfields.php”

## add ispapi additional fields ##
$additionaldomainfields[“.ca”][] = array(
“Name” => “Legal Type”,
“LangVar” => “catldlegaltype”,
“Type” => “dropdown”,
“Options” => “Corporation,Canadian Citizen,Permanent Resident of Canada,Government,Canadian Educational Institution,Canadian Unincorporated Association,Canadian Hospital,Partnership Registered in Canada,Trade-mark registered in Canada,Canadian Trade Union,Canadian Political Party,Canadian Library Archive or Museum,Trust established in Canada,Aboriginal Peoples,Legal Representative of a Canadian Citizen,Official mark registered in Canada”,
“Default” => “Corporation”,
“Description” => “Legal type of registrant contact”,
“Ispapi-Name” => “X-CA-LEGALTYPE”,
$additionaldomainfields[“.ca”][] = array(
“Name” => “CIRA Agreement”,
“LangVar” => “catldciraagreement”,
“Type” => “tickbox”,
“Description” => “Tick to confirm you agree to the CIRA Registration Agreement shown below
You have read, understood and agree to the terms and conditions of the Registrant Agreement, and that CIRA may, from time to time and at its discretion, amend any or all of the terms and conditions of the Registrant Agreement, as CIRA deems appropriate, by posting a notice of the changes on the CIRA website and by sending a notice of any material changes to Registrant. You meet all the requirements of the Registrant Agreement to be a Registrant, to apply for the registration of a Domain Name Registration, and to hold and maintain a Domain Name Registration, including without limitation CIRA’s Canadian Presence Requirements for Registrants, at: CIRA will collect, use and disclose your personal information, as set out in CIRA’s Privacy Policy, at:
“, “Required” => true, “Ispapi-Name” => “X-CA-ACCEPT-AGREEMENT-VERSION”, “Ispapi-Eval” => ‘if ( $value ) { $value = “2.0”; } else { $value = “”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “WHOIS Opt-out”, “LangVar” => “catldwhoisoptout”, “Type” => “tickbox”, “Description” => “Tick to hide your contact information in CIRA WHOIS (only available to individuals)”, “Ispapi-Name” => “OWNERCONTACT0X-CA-DISCLOSE”, “Ispapi-Eval” => ‘if ( $value ) { $value = “0”; } else { $value = “1”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “Trademark Number”, “Type” => “text”, “Size” => “50”, “Default” => “”, “Required” => false, “Ispapi-Name” => “X-CA-DOMAIN-TRADEMARK”, “Ispapi-Eval” => ‘if ( $value ) { $value = “Y”; } else { $value = “N”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “Contact Language”, “Type” => “dropdown”, “Options” => “English,French”, “Default” => “English”, “Ispapi-Name” => “X-CA-LANGUAGE”, “Ispapi-Options” => “EN,FR” );