From b48e38b695f69780cc709d0b521a1335296696a2 Mon Sep 17 00:00:00 2001 From: Bernhard Date: Sat, 9 Jan 2021 16:17:31 +0100 Subject: [PATCH 1/5] new branch --- readme.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index f2a3d18..1cfc578 100755 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: pods, beaver builder, beaver themer Requires at least: 4.4 Tested up to: 5.6 Requires PHP: 5.4 -Stable tag: 1.3.5 +Stable tag: 1.3.6 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -71,6 +71,8 @@ You can use [GitHub Updater](https://github.com/afragen/github-updater). A simpl 5. Example for Templates or Magic Tags. == Changelog == += 1.3.6 - tbd = + = 1.3.5 - January 8th, 2021 = * Required: This add-on now requires Pods 2.7.26+ in order to function fully with the latest fixes. From d273d1616e122baed31da09aa5d4cbf3aeaf6f0b Mon Sep 17 00:00:00 2001 From: Bernhard Date: Sat, 9 Jan 2021 16:18:31 +0100 Subject: [PATCH 2/5] update version --- pods-beaver-themer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pods-beaver-themer.php b/pods-beaver-themer.php index a14d8c8..d347184 100644 --- a/pods-beaver-themer.php +++ b/pods-beaver-themer.php @@ -3,7 +3,7 @@ * Plugin Name: Pods Beaver Themer Add-On * Plugin URI: http://pods.io/ * Description: Integration with Beaver Builder Themer (https://www.wpbeaverbuilder.com). Provides a UI for mapping Field Connections with Pods - * Version: 1.3.5 + * Version: 1.3.6 * Author: Quasel, Pods Framework Team * Author URI: http://pods.io/about/ * Text Domain: pods-beaver-builder-themer-add-on @@ -30,7 +30,7 @@ * @package Pods\Beaver Themer */ -define( 'PODS_BEAVER_VERSION', '1.3.5' ); +define( 'PODS_BEAVER_VERSION', '1.3.6' ); define( 'PODS_BEAVER_FILE', __FILE__ ); define( 'PODS_BEAVER_DIR', plugin_dir_path( PODS_BEAVER_FILE ) ); define( 'PODS_BEAVER_URL', plugin_dir_url( PODS_BEAVER_FILE ) ); From 85c59caf1d5f0d853ea685aaed069b2b1d11c682 Mon Sep 17 00:00:00 2001 From: Bernhard Date: Sat, 9 Jan 2021 17:23:05 +0100 Subject: [PATCH 3/5] improve user/author handling Fixes #106 --- classes/class-pods-beaver-page-data.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/classes/class-pods-beaver-page-data.php b/classes/class-pods-beaver-page-data.php index 94e875e..2508448 100644 --- a/classes/class-pods-beaver-page-data.php +++ b/classes/class-pods-beaver-page-data.php @@ -128,7 +128,7 @@ public static function get_current_pod_info() { */ public static function get_pod( $settings = array() ) { - $item_id = 0; + $item_id = null; $pod_name = null; if ( is_array( $settings ) && ! empty( $settings['pod'] ) ) { @@ -172,12 +172,12 @@ public static function get_pod( $settings = array() ) { if ( 'user' === $pod_name && isset( $settings->type )) { switch ( $settings->type ) { case 'author': - if ( ! is_archive() && post_type_supports( get_post_type(), 'author' ) ) { + if ( ( ! is_archive() || self::$pods_beaver_loop || is_author() ) && post_type_supports( get_post_type(), 'author' ) ) { $item_id = get_the_author_meta( 'ID' ); } break; case 'modified': - if ( ! is_archive() && post_type_supports( get_post_type(), 'author' ) ) { + if ( ( ! is_archive() || self::$pods_beaver_loop || is_author() ) && post_type_supports( get_post_type(), 'author' ) ) { $item_id = get_post_meta( get_post()->ID, '_edit_last', true ); } break; @@ -185,12 +185,13 @@ public static function get_pod( $settings = array() ) { case '': // For backwards compatibility if ( is_user_logged_in() ) { $item_id = get_current_user_id(); - } else { - // User is not logged in, cannot return data - return false; - }; + } break; } + if ( $item_id < 1 ) { + // No user found - return early to avoid getting wrong $pod! + return false; + } } } else { $info = self::get_current_pod_info(); From 2d29e1047c1ec538a98fe4bd05b487ac01615ad2 Mon Sep 17 00:00:00 2001 From: Scott Kingsley Clark Date: Mon, 1 Feb 2021 14:40:11 -0600 Subject: [PATCH 4/5] Cast as int to ensure it's set properly for the comparison below --- classes/class-pods-beaver-page-data.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/class-pods-beaver-page-data.php b/classes/class-pods-beaver-page-data.php index 2508448..8f5f632 100644 --- a/classes/class-pods-beaver-page-data.php +++ b/classes/class-pods-beaver-page-data.php @@ -173,12 +173,12 @@ public static function get_pod( $settings = array() ) { switch ( $settings->type ) { case 'author': if ( ( ! is_archive() || self::$pods_beaver_loop || is_author() ) && post_type_supports( get_post_type(), 'author' ) ) { - $item_id = get_the_author_meta( 'ID' ); + $item_id = (int) get_the_author_meta( 'ID' ); } break; case 'modified': if ( ( ! is_archive() || self::$pods_beaver_loop || is_author() ) && post_type_supports( get_post_type(), 'author' ) ) { - $item_id = get_post_meta( get_post()->ID, '_edit_last', true ); + $item_id = (int) get_post_meta( get_post()->ID, '_edit_last', true ); } break; case 'logged_in': From 641c41ac20d0026c7fd7be0b4199225052c17731 Mon Sep 17 00:00:00 2001 From: Scott Kingsley Clark Date: Mon, 1 Feb 2021 14:41:25 -0600 Subject: [PATCH 5/5] Update readme.txt --- readme.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 1cfc578..3d4f3da 100755 --- a/readme.txt +++ b/readme.txt @@ -71,7 +71,10 @@ You can use [GitHub Updater](https://github.com/afragen/github-updater). A simpl 5. Example for Templates or Magic Tags. == Changelog == -= 1.3.6 - tbd = + += 1.3.6 - February 1st, 2021 = + +* Fixed: Prevent the wrong pod data from unintentionally loading for user-related queries when user ID can not be determined. = 1.3.5 - January 8th, 2021 =