diff --git a/classes/class-pods-beaver-page-data.php b/classes/class-pods-beaver-page-data.php index 94e875e..8f5f632 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,25 +172,26 @@ 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' ) ) { - $item_id = get_the_author_meta( 'ID' ); + if ( ( ! is_archive() || self::$pods_beaver_loop || is_author() ) && post_type_supports( get_post_type(), 'author' ) ) { + $item_id = (int) get_the_author_meta( 'ID' ); } break; case 'modified': - if ( ! is_archive() && post_type_supports( get_post_type(), 'author' ) ) { - $item_id = get_post_meta( get_post()->ID, '_edit_last', true ); + if ( ( ! is_archive() || self::$pods_beaver_loop || is_author() ) && post_type_supports( get_post_type(), 'author' ) ) { + $item_id = (int) get_post_meta( get_post()->ID, '_edit_last', true ); } break; case 'logged_in': 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(); 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 ) ); diff --git a/readme.txt b/readme.txt index f2a3d18..3d4f3da 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 @@ -72,6 +72,11 @@ You can use [GitHub Updater](https://github.com/afragen/github-updater). A simpl == Changelog == += 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 = * Required: This add-on now requires Pods 2.7.26+ in order to function fully with the latest fixes. * Fixed: Properly hook into the Beaver Themer loop functionality to tell the Pods shortcode to reference the current post in the loop. #112 (@sc0ttkclark)