Fix access settings in front page and posts page

This commit is contained in:
champsupertramp
2016-07-04 15:36:43 +08:00
parent dd1baf8b8f
commit a00942c42a
+21 -10
View File
@@ -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 );