Plugins Articles - Blog - Andy Palmer Personal website of Andy Palmer - A Web Developer based in Exeter, Devon Fri, 03 Nov 2017 00:04:46 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.2 Post Lockdown v2.0 Released /blog/code/post-lockdown-v2-0-released/ /blog/code/post-lockdown-v2-0-released/#respond Sun, 02 Oct 2016 16:44:56 +0000 https://andypalmer.me/?p=159 Today I released v2.0 of the Post Lockdown WordPress plugin. It can be downloaded via the WordPress plugin repository or directly onto your WordPress powered site by going to Plugins > Add New in WordPress admin and searching for Post Lockdown. This major release is pretty much a rewrite of the old version whilst retaining […]

The post Post Lockdown v2.0 Released appeared first on Andy Palmer.

]]>
Today I released v2.0 of the Post Lockdown WordPress plugin. It can be downloaded via the WordPress plugin repository or directly onto your WordPress powered site by going to Plugins > Add New in WordPress admin and searching for Post Lockdown.

This major release is pretty much a rewrite of the old version whilst retaining all old functionality. The original version of the plugin was contained within one file and used a single class with static methods. Following the separation of concerns principle, I’ve split certain functionality into its own classes and files and generate instances of classes rather than using static methods. This was mainly for testing, performance and scalability.

Most users will be able to upgrade to v2 without a hitch, however if you used the old version and used the static methods in your theme code like

PostLockdown::is_post_locked($post_id)

then you’ll need to update that code to the following to use v2:

$GLOBALS['postlockdown']->is_post_locked($post_id);

If you’re going to use the instance more than once then it’d make sense to declare the global like global $postlockdown so you don’t need to use the $GLOBALS array:

<?php
global $postlockdown;

$postlockdown->is_post_locked($post_id);
$postlockdown->is_post_protected($post_id);

 

The post Post Lockdown v2.0 Released appeared first on Andy Palmer.

]]>
/blog/code/post-lockdown-v2-0-released/feed/ 0