mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed message for restricted taxonomy;
This commit is contained in:
@@ -103,7 +103,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
* Check individual term Content Restriction settings
|
||||
*/
|
||||
function um_access_check_individual_term_settings() {
|
||||
|
||||
//check only tax|tags|categories - skip archive, author, and date lists
|
||||
if ( ! ( is_tax() || is_tag() || is_category() ) ) {
|
||||
return;
|
||||
@@ -119,8 +118,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
$restriction = get_term_meta( $tag_id, 'um_content_restriction', true );
|
||||
}
|
||||
} elseif ( is_category() ) {
|
||||
$um_category = get_the_category();
|
||||
$um_category = current( $um_category );
|
||||
$um_category = get_category( get_query_var( 'cat' ) );
|
||||
|
||||
$restricted_taxonomies = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
|
||||
if ( empty( $restricted_taxonomies[ $um_category->taxonomy ] ) )
|
||||
@@ -162,17 +160,21 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
if ( is_user_logged_in() ) {
|
||||
|
||||
$custom_restrict = $this->um_custom_restriction( $restriction );
|
||||
|
||||
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
|
||||
if ( $custom_restrict ) {
|
||||
$this->allow_access = true;
|
||||
return;
|
||||
} else {
|
||||
//restrict terms page by 404 for logged in users with wrong role
|
||||
global $wp_query;
|
||||
add_filter( 'tag_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
||||
add_filter( 'archive_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
||||
add_filter( 'category_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
||||
add_filter( 'taxonomy_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
||||
|
||||
/*global $wp_query;
|
||||
$wp_query->set_404();
|
||||
status_header( 404 );
|
||||
nocache_headers();
|
||||
nocache_headers();*/
|
||||
}
|
||||
} else {
|
||||
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
|
||||
@@ -181,11 +183,17 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
$this->allow_access = true;
|
||||
return;
|
||||
} else {
|
||||
|
||||
add_filter( 'tag_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
||||
add_filter( 'archive_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
||||
add_filter( 'category_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
||||
add_filter( 'taxonomy_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
||||
|
||||
//restrict terms page by 404 for logged in users with wrong role
|
||||
global $wp_query;
|
||||
/*global $wp_query;
|
||||
$wp_query->set_404();
|
||||
status_header( 404 );
|
||||
nocache_headers();
|
||||
nocache_headers();*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,6 +221,18 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $template
|
||||
* @param $type
|
||||
* @param $templates
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function taxonomy_message( $template, $type, $templates ) {
|
||||
return UM()->locate_template( 'restricted-taxonomy.php' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check global accessible settings
|
||||
*/
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ Donate link:
|
||||
Tags: community, member, membership, user-profile, user-registration
|
||||
Requires at least: 4.1
|
||||
Tested up to: 4.9
|
||||
Stable tag: 2.0.4
|
||||
Stable tag: 2.0.5
|
||||
License: GNU Version 2 or Any Later Version
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div class="wrap">
|
||||
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<header class="page-header">
|
||||
<?php
|
||||
the_archive_title( '<h1 class="page-title">', '</h1>' );
|
||||
the_archive_description( '<div class="taxonomy-description">', '</div>' );
|
||||
?>
|
||||
</header><!-- .page-header -->
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="primary" class="content-area">
|
||||
<main id="main" class="site-main" role="main">
|
||||
|
||||
<?php echo 'asdasdasda'; ?>
|
||||
|
||||
</main><!-- #main -->
|
||||
</div><!-- #primary -->
|
||||
<?php get_sidebar(); ?>
|
||||
</div><!-- .wrap -->
|
||||
|
||||
<?php get_footer();
|
||||
Reference in New Issue
Block a user