From a00942c42a32367070e221a4a683baa52793e7b1 Mon Sep 17 00:00:00 2001 From: champsupertramp Date: Mon, 4 Jul 2016 15:36:43 +0800 Subject: [PATCH] Fix access settings in front page and posts page --- core/um-actions-access.php | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/core/um-actions-access.php b/core/um-actions-access.php index 0a6d06eb..a0ede63e 100644 --- a/core/um-actions-access.php +++ b/core/um-actions-access.php @@ -61,10 +61,14 @@ if ( is_admin() ) return; if ( ! is_front_page() ) return; - if ( ! isset( $um_post_id ) ){ + if ( ! isset( $um_post_id ) && isset( $post->ID ) ){ $um_post_id = $post->ID; } + if( ! isset( $um_post_id ) ){ + return; + } + $args = $ultimatemember->access->get_meta( $um_post_id ); extract( $args ); @@ -163,19 +167,26 @@ if ( is_admin() ) return; if ( ! is_home() ) return; - $show_on_front = get_option( 'show_on_front' ); - if( $show_on_front == "page" ){ - $um_post_id = get_option( 'page_for_posts' ); - } - $access = um_get_option('accessible'); - if ( $access == 2 && ! is_user_logged_in() ) { - $ultimatemember->access->allow_access = false; - }else{ - $ultimatemember->access->allow_access = true; + $show_on_front = get_option( 'show_on_front' ); + + if( $show_on_front == "page" ){ + + $um_post_id = get_option( 'page_for_posts' ); + + if ( $access == 2 && ! is_user_logged_in() ) { + $ultimatemember->access->allow_access = false; + }else{ + $ultimatemember->access->allow_access = true; + } + + }else if( $show_on_front == "posts" ){ + $ultimatemember->access->allow_access = true; } + + if ( isset( $um_post_id ) ){ $args = $ultimatemember->access->get_meta( $um_post_id );