mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- added setting 'Restricted Access Post Title' for restricted posts displayed in archive;
- fixed access class for posts visible in query but that have restriction settings (message or redirect);
This commit is contained in:
@@ -704,6 +704,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
}
|
||||
|
||||
$restricted_global_message = UM()->options()->get( 'restricted_access_message' );
|
||||
$restricted_global_title = UM()->options()->get( 'restricted_access_post_title' );
|
||||
|
||||
if ( is_object( $query ) ) {
|
||||
$is_singular = $query->is_singular();
|
||||
@@ -750,16 +751,18 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
//if not single query when exclude if set _um_access_hide_from_queries
|
||||
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_noaccess_action'] ) || '0' == $restriction['_um_noaccess_action'] ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
}
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
$post->post_excerpt = '';
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
$post->post_excerpt = '';
|
||||
}
|
||||
|
||||
$post = apply_filters( 'um_restricted_archive_post', $post, $restriction );
|
||||
|
||||
$filtered_posts[] = $post;
|
||||
continue;
|
||||
}
|
||||
@@ -771,10 +774,14 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
}
|
||||
|
||||
$post = apply_filters( 'um_restricted_singular_post', $post, $restriction );
|
||||
|
||||
$this->current_single_post = $post;
|
||||
|
||||
/**
|
||||
@@ -854,16 +861,18 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
//if not single query when exclude if set _um_access_hide_from_queries
|
||||
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_noaccess_action'] ) || '0' == $restriction['_um_noaccess_action'] ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
}
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
$post->post_excerpt = '';
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
$post->post_excerpt = '';
|
||||
}
|
||||
|
||||
$post = apply_filters( 'um_restricted_archive_post', $post, $restriction );
|
||||
|
||||
$filtered_posts[] = $post;
|
||||
continue;
|
||||
}
|
||||
@@ -875,6 +884,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
|
||||
$this->current_single_post = $post;
|
||||
|
||||
@@ -883,6 +893,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
}
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
|
||||
$this->current_single_post = $post;
|
||||
|
||||
@@ -891,6 +902,8 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
$post = apply_filters( 'um_restricted_singular_post', $post, $restriction );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -941,16 +954,18 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
if ( empty( $is_singular ) ) {
|
||||
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_noaccess_action'] ) || '0' == $restriction['_um_noaccess_action'] ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
}
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
$post->post_excerpt = '';
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
$post->post_excerpt = '';
|
||||
}
|
||||
|
||||
$post = apply_filters( 'um_restricted_archive_post', $post, $restriction );
|
||||
|
||||
$filtered_posts[] = $post;
|
||||
continue;
|
||||
}
|
||||
@@ -962,6 +977,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
|
||||
$this->current_single_post = $post;
|
||||
|
||||
@@ -970,6 +986,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
}
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
$post->post_title = stripslashes( $restricted_global_title );
|
||||
|
||||
$this->current_single_post = $post;
|
||||
|
||||
@@ -978,6 +995,8 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
$post = apply_filters( 'um_restricted_singular_post', $post, $restriction );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user