Journal, ISO date 2018-05-23
This morning didn't go entirely to plan! I was supposed to be heading to a networking event but one of my children wasn't feeling well and ended up staying at home; hence so did I.
He's since perked up and seems OK so hopefully will be back to school tomorrow.
For me, I spent the morning catching up on emails and assorted other bits and pieces. Considering the backlog, it may have been best that I didn't spend all morning at an event.
Next up was catching up on assorted consultancy tasks and dealing with some new ones - recording some small code changes that are needed and some mucking about with the MailChimp API to add and populate a new merge field on existing list members. Just as well illness also prevented the Scouts outing for us tonight, the extra time working was very handy. Although still not enough to fully catch up - more consultancy work tomorrow. :-(
Cool house developmemt
Rightmove emailed me an amazing looking concrete cylinder! A building project like that would be fantastic if it wasn't for the required time and money.
Wordpress
Had "fun" this afternoon tracking down why a Contact Form 7 recaptcha field wasn't working on a Wordpress site.
The immediate cause of it not rendering was the following javascript error (in the browser console):
Couldn't find user-provided function: recaptchaCallback
Looking in the page souce/resources, that function was indeed missing. Checking in the Contact Form 7 source though, looked like it should be there. The trouble came with tracking down why it wasn't.
This particular contact form was being displayed in a BNE Flyout and it turns out that this means the form isn't actually rendered until the Wordpress footer.
Contact Form 7 should also output the (missing) recaptchaCallback javascript function in the footer.
However the javascript function is only rendered if a contact form containing a reCaptcha field has already been rendered first.
So due to the ordering of things within the footer, Contact Form 7 scripts before BNE Flyout (and hence the actual form), the javascript wasn't getting rendered.
Having tracked it down to a BNE Flyout and Contact Form 7 interaction issue I was able to narrow my google searches and found that it seems to be a known issue, complete with suggested fix. Although that little code snippet still needs to go somewhere! The simplest/safest place was a standalone plugin so I ended up doing the following:
cd wp-content/plugins
mkdir fix-flyout-cf7
cat <<EOF > /tmp/ttt
<?php
/*
* Plugin Name: Fix Flyouts with CF7
* Plugin URI: https://seoss.co.uk
* Description: Custom functions to fix BNE Flyouts to work with Contact Form 7 reCaptcha
* Author: SEOSS
* Version: 1.0
* Requires at least: 4.9.6
* Author URI: https://seoss.co.uk
*/
/*
* https://gist.github.com/bnecreative/50f2aea52d9b7f2835c7755ea779e96a
*/
/*
* Flyouts - Contact Form 7 reCaptcha Enqueue
*
* BNE Flyout's output occurs before contact Form 7's enqueue process. So we
* need to jump the gun with enqueueing the recaptcha callback script.
*/
function bne_flyout_cf7_recaptcha() {
if( defined( 'WPCF7_VERSION' ) ) {
wp_enqueue_script( 'google-recaptcha' );
wpcf7_recaptcha_callback_script();
}
}
add_action( 'bne_flyout_content_before', 'bne_flyout_cf7_recaptcha' );
EOF
Then activating the plugin in the normal way.
Webpage / image optimisation
Another task today was improving the PageSpeed score for a couple of pages.
It turned out that the only issue that could really be fixed (the rest being due to external tools that couldn't be removed) was images that had compression potential. This can be done with tools such as the excellent jpegoptim. But as it seems Google want to recommend at least some degree of lossy compression and I'm not sure how much they want, it's good that PageSpeed actually make the optimised images available for download (find the text "Download optimized image, JavaScript, and CSS resources for this page" near the bottom of the results page).
Bitcoin power
This isn't the first study I've seen on the power usage of bitcoin miners and the total reported is actually slightly less than I've seen suggested before, but look at the growth rate!! That really can't be good, or sustainable.