A little WordPress hacking

October 23, 2015

Not really I’m supposed to be looking at, but I did a little playing with WordPress today. One was to revisit my attempt to install JetPack on wobleg.inf which previously would only partially work if I enabled its DEBUG_MODE. I presumed then the “sign in/connect” problem was due to our Cosign authentication system instead of the default WP login.

I downloaded the latest version, and initially the same problem, it reported a failure to authenticate or connect, or something. Then I wondered if it was a firewall problem, as wobleg is blocked from the outside world, so I opened the HTTP and HTTPS holes, and I was then able to connect/sign in to WordPress.com (which JetPack requires).

JetPack certainly has lots of useful features (similar to those provided by WordPress.com), but rather scarily it also allow you to then manage your wobleg.inf (blog.inf) site via WordPress.com, eg add, edit, delete posts, and more if you allow it.

The recommendation is to network enable JetPack, though individual sites do not need to connect jetpack to their WP.com account.

https://jetpack.me/tag/multisite/

http://jetpack.me/support/multisite-protect/

All this sounds a bit scary, and I’m not sure about installing it on blog.inf without some more testing.

blog.inf front page

While fiddling with WordPress, I couldn’t resist having a quick look at the request to improve the current front page of blog.inf. One of the comments was that the list of “Updated Blogs” is lengthy and shows no indication of when the particular blog was last updated. There is a project (not mine!)  to give it a major revamp, https://computing.projects.inf.ed.ac.uk/330/ , but it turned out to be very simple limit the list of blogs. It turns the local theme calls get_last_updated() which produces a list of the 40 most recently changed blogs. Giving it some extra args it now only lists the 20 most recent. I’ve also extracted those last modified dates and it now shows those too.

$gmtstr = get_blog_status( $details[ 'blog_id' ], 'last_updated');
$gmttime = strtotime( $gmtstr );
date_default_timezone_set('Europe/London');
$locstr = strftime( "%a %b %e %R %Y %Z", $gmttime );
echo $locstr;

Without the timezone stuff, it just reported UTC time. Not a huge difference, but hopefully the old and stagnant blogs will be less visible.