From b667a45d3d30253af9e0775ec65232d71ef2c47a Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Fri, 19 Jul 2024 20:52:52 +0200 Subject: [PATCH] Redirect home from bookshelf if not logged in --- singular-bookmarks.php | 2 +- singular-bookshelf-ajax.php | 6 ++++++ singular-bookshelf.php | 4 ++-- user-profile.php | 6 +++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/singular-bookmarks.php b/singular-bookmarks.php index f6acbfa7..f61121f8 100644 --- a/singular-bookmarks.php +++ b/singular-bookmarks.php @@ -16,7 +16,7 @@ // Return home if bookmarks are disabled if ( ! get_option( 'fictioneer_enable_bookmarks' ) ) { wp_redirect( home_url() ); - exit(); + exit; } // Header diff --git a/singular-bookshelf-ajax.php b/singular-bookshelf-ajax.php index 786efc1e..92ccf23b 100644 --- a/singular-bookshelf-ajax.php +++ b/singular-bookshelf-ajax.php @@ -12,6 +12,12 @@ */ +// Only for logged-in users... +if ( ! is_user_logged_in() && ! get_option( 'fictioneer_enable_public_cache_compatibility' ) ) { + wp_safe_redirect( home_url() ); + exit; +} + // Setup $current_tab = sanitize_key( $_GET['tab'] ?? '' ); $order = fictioneer_sanitize_query_var( $_GET['order'] ?? 0, ['desc', 'asc'], 'desc' ); diff --git a/singular-bookshelf.php b/singular-bookshelf.php index 717b2397..15f38c77 100644 --- a/singular-bookshelf.php +++ b/singular-bookshelf.php @@ -12,10 +12,10 @@ */ -// Only for logged-in users... +// Only for logged-in users and not compatible with public caching... if ( ! is_user_logged_in() || get_option( 'fictioneer_enable_public_cache_compatibility' ) ) { wp_safe_redirect( home_url() ); - exit(); + exit; } // Setup diff --git a/user-profile.php b/user-profile.php index 93699330..ae12a2e9 100644 --- a/user-profile.php +++ b/user-profile.php @@ -15,7 +15,7 @@ // Only for logged-in users... if ( ! is_user_logged_in() && ! get_option( 'fictioneer_enable_public_cache_compatibility' ) ) { wp_safe_redirect( home_url() ); - exit(); + exit; } // If public caching is active, redirect to dashboard profile @@ -24,13 +24,13 @@ if ( get_option( 'fictioneer_enable_public_cache_compatibility' ) ) { wp_safe_redirect( get_edit_profile_url( 0 ) ); - exit(); + exit; } // Redundant safeguard if ( ! is_user_logged_in() ) { wp_safe_redirect( home_url() ); - exit(); + exit; } // Setup