From 391686fa5a0ae607096832a4f2b60f6fa7df13e8 Mon Sep 17 00:00:00 2001 From: Jory Hogeveen Date: Tue, 30 Jan 2024 11:52:16 +0100 Subject: [PATCH 1/2] Fix custom capability fallback Related #7218 --- classes/PodsInit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/PodsInit.php b/classes/PodsInit.php index 7c1bc84bb5..092fc07878 100644 --- a/classes/PodsInit.php +++ b/classes/PodsInit.php @@ -1235,7 +1235,7 @@ public function setup_content_types( $force = false ) { $capability_type = pods_v( 'capability_type', $post_type, 'post' ); if ( 'custom' === $capability_type ) { - $capability_type = pods_v( 'capability_type_custom', $post_type, 'post' ); + $capability_type = pods_v( 'capability_type_custom', $post_type, pods_v( 'name', $post_type, 'post' ) ); } $show_in_menu = (boolean) pods_v( 'show_in_menu', $post_type, true ); From 3330c70541e2556bd6d4dbe4f6d4f193c9e7ab3b Mon Sep 17 00:00:00 2001 From: Scott Kingsley Clark Date: Sun, 24 Mar 2024 21:23:42 -0500 Subject: [PATCH 2/2] Enforce strict checks so that the capability type is never just empty --- classes/PodsInit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/PodsInit.php b/classes/PodsInit.php index 092fc07878..6c9f19125e 100644 --- a/classes/PodsInit.php +++ b/classes/PodsInit.php @@ -1232,10 +1232,10 @@ public function setup_content_types( $force = false ) { $cpt_rewrite['slug'] = preg_replace( '/[^a-zA-Z0-9%\-_\/]/', '-', $cpt_rewrite['slug'] ); } - $capability_type = pods_v( 'capability_type', $post_type, 'post' ); + $capability_type = pods_v( 'capability_type', $post_type, 'post', true ); if ( 'custom' === $capability_type ) { - $capability_type = pods_v( 'capability_type_custom', $post_type, pods_v( 'name', $post_type, 'post' ) ); + $capability_type = pods_v( 'capability_type_custom', $post_type, pods_v( 'name', $post_type, 'post', true ), true ); } $show_in_menu = (boolean) pods_v( 'show_in_menu', $post_type, true );