diff --git a/core/um-actions-access.php b/core/um-actions-access.php index d025e038..54dd7665 100644 --- a/core/um-actions-access.php +++ b/core/um-actions-access.php @@ -37,6 +37,26 @@ }else { $ultimatemember->access->redirect_handler = $ultimatemember->access->set_referer( $redirect, "global" ); } + + // Disallow access in homepage + if( is_front_page() || is_home() ){ + $home_page_accessible = um_get_option("home_page_accessible"); + if( $home_page_accessible == 0 ){ + $ultimatemember->access->redirect_handler = $ultimatemember->access->set_referer( $redirect, "global" ); + + wp_redirect( $ultimatemember->access->redirect_handler ); exit; + } + + } + + // Disallow access in category pages + if( is_category() ){ + $category_page_accessible = um_get_option("category_page_accessible"); + if( $category_page_accessible == 0 ){ + $ultimatemember->access->redirect_handler = $ultimatemember->access->set_referer( $redirect, "global" ); + wp_redirect( $ultimatemember->access->redirect_handler ); exit; + } + } } diff --git a/um-config.php b/um-config.php index 40750f34..b935006f 100644 --- a/um-config.php +++ b/um-config.php @@ -411,7 +411,24 @@ $this->sections[] = array( 'add_text' => __('Add New URL','ultimatemember'), 'required' => array( 'accessible', '=', 2 ), ), - + array( + 'id' => 'home_page_accessible', + 'type' => 'switch', + 'title' => __( 'Allow Homepage to be accessible','ultimatemember' ), + 'default' => 1, + 'on' => __('Yes','ultimatemember'), + 'off' => __('No','ultimatemember'), + 'required' => array( 'accessible', '=', 2 ), + ), + array( + 'id' => 'category_page_accessible', + 'type' => 'switch', + 'title' => __( 'Allow Category pages to be accessible','ultimatemember' ), + 'default' => 1, + 'on' => __('Yes','ultimatemember'), + 'off' => __('No','ultimatemember'), + 'required' => array( 'accessible', '=', 2 ), + ), array( 'id' => 'wpadmin_login', 'type' => 'switch',