Skip to content

Commit

Permalink
Version 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MillerMedia committed May 17, 2022
1 parent 944e1e7 commit 71f392a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
25 changes: 19 additions & 6 deletions _inc/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ static function isEnabled($post)
if( $post_protected = self::processPosts($single_post) )
return $post_protected->ID;
}

return false;
}

if( $post_protected = self::processPosts($post) )
Expand All @@ -50,16 +48,31 @@ static function isEnabled($post)
*/
static function processPosts($post)
{
if ( is_int($post) or !is_object($post) )
$post = get_post($post);
if ( is_array($post) ){
foreach($post as $post_id){
if( $process_post = self::processPost($post_id) ){
return $process_post;
}
}
} else {
return self::processPost($post);
}

return false;
}

static function processPost($post_id){
if ( is_int($post_id) or !is_object($post_id) )
$post = get_post($post_id);

if( !$post )
return false;

if ( !self::isPasswordProtected($post) )
return false;

if ( get_post_meta($post->ID, 'protect_children', true) )
return $post;

return false;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/**
* Plugin Name: Protect the Children!
* Description: Easily password protect the child pages/posts of a post that is password protected.
* Version: 1.3.9
* Version: 1.4.0
* Author: Miller Media (Matt Miller)
* Author URI: www.millermedia.io
*/


if ( ! defined( 'PROTECT_THE_CHILDREN_PLUGIN_VERSION' ) ) {
define( 'PROTECT_THE_CHILDREN_PLUGIN_VERSION', '1.3.9' );
define( 'PROTECT_THE_CHILDREN_PLUGIN_VERSION', '1.4.0' );
}

if ( version_compare( PHP_VERSION, '5.6', '<' ) ) {
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=== Protect the Children! ===
Contributors: millermedianow, millermediadev, mohsinrasool, deltafactory, danmossop
Contributors: millermedianow, millermediadev, mohsinrasool, deltafactory, danmossop, ad_taylor
Tags: password protect, password, protected, protect, password, child, parent, edit, visibility
Tested up to: 5.9.3
Stable tag: 1.3.9
Stable tag: 1.4.0
Requires PHP: 5.6
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -39,6 +39,9 @@ PROTECT THE CHILDREN!

== Changelog ==

= 1.4.0 =
* Fixed issue with nested child pages

= 1.3.9 =
* Added full support for custom post types
* Fixed Gutenberg issues with protected meta fields
Expand Down

0 comments on commit 71f392a

Please sign in to comment.