- updated forms labels;

This commit is contained in:
Nikita Sinelnikov
2021-07-27 15:53:22 +03:00
parent 070415bf31
commit a4f41c79e4
3 changed files with 31 additions and 30 deletions
+14 -12
View File
@@ -416,8 +416,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
array(
'id' => '_um_access_hide_from_queries',
'type' => 'checkbox',
'label' => __( 'Would you like to exclude term\'s post from WP Query when users haven\'t access?', 'ultimate-member' ),
'description' => __( 'Recommended to be enabled. Restricted post will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
'label' => __( 'Would you like to display 404 error on term\'s archive page and terms\' posts single pages when users haven\'t access?', 'ultimate-member' ),
'description' => __( 'Recommended to be enabled. Restricted term\'s archive page and all terms\' posts will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
'value' => 1,
'conditional' => array( '_um_accessible', '!=', '0' ),
),
@@ -568,8 +568,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
array(
'id' => '_um_access_hide_from_queries',
'type' => 'checkbox',
'label' => __( 'Would you like to exclude term\'s post from WP Query when users haven\'t access?', 'ultimate-member' ),
'description' => __( 'Recommended to be enabled. Restricted post will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
'label' => __( 'Would you like to display 404 error on term\'s archive page and terms\' posts single pages when users haven\'t access?', 'ultimate-member' ),
'description' => __( 'Recommended to be enabled. Restricted term\'s archive page and all terms\' posts will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
'conditional' => array( '_um_accessible', '!=', '0' ),
),
@@ -588,8 +588,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
array(
'id' => '_um_restrict_by_custom_message',
'type' => 'select',
'label' => __( 'Would you like to use the global default message or apply a custom message to this term\'s post?', 'ultimate-member' ),
'description' => __( 'Action when users without access tries to view the term\'s post', 'ultimate-member' ),
'label' => __( 'Restricted access message type', 'ultimate-member' ),
'description' => __( 'Would you like to use the global default message or apply a custom message to this term\'s post?', 'ultimate-member' ),
'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
'options' => array(
'0' => __( 'Global default message', 'ultimate-member' ),
@@ -627,12 +627,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
),
), $data, 'edit' );
UM()->admin_forms( array(
'class' => 'um-restrict-content um-third-column',
'prefix_id' => 'um_content_restriction',
'without_wrapper' => true,
'fields' => $fields,
) )->render_form();
UM()->admin_forms(
array(
'class' => 'um-restrict-content um-third-column',
'prefix_id' => 'um_content_restriction',
'without_wrapper' => true,
'fields' => $fields,
)
)->render_form();
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_taxonomy_restrict_content_nonce' );
}
@@ -81,7 +81,7 @@ if ( ! defined( 'ABSPATH' ) ) {
array(
'id' => '_um_access_hide_from_queries',
'type' => 'checkbox',
'label' => __( 'Would you like to exclude post from WP Query when users haven\'t access?', 'ultimate-member' ),
'label' => __( 'Would you like to display 404 page when users haven\'t access?', 'ultimate-member' ),
'tooltip' => __( 'Recommended to be enabled. Restricted post will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
'conditional' => array( '_um_accessible', '!=', '0' ),
@@ -101,8 +101,8 @@ if ( ! defined( 'ABSPATH' ) ) {
array(
'id' => '_um_restrict_by_custom_message',
'type' => 'select',
'label' => __( 'Would you like to use the global default message or apply a custom message to this content?', 'ultimate-member' ),
'tooltip' => __( 'Action when users without access tries to view the post', 'ultimate-member' ),
'label' => __( 'Restricted access message type', 'ultimate-member' ),
'tooltip' => __( 'Would you like to use the global default message or apply a custom message to this post?', 'ultimate-member' ),
'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
'options' => array(
'0' => __( 'Global default message', 'ultimate-member' ),
+14 -15
View File
@@ -53,23 +53,27 @@ if ( ! class_exists( 'um\core\Access' ) ) {
* Access constructor.
*/
function __construct() {
$this->singular_page = false;
$this->redirect_handler = false;
$this->allow_access = false;
// callbacks for changing posts query
add_action( 'pre_get_posts', array( &$this, 'exclude_posts' ), 99, 1 );
add_action( 'pre_get_comments', array( &$this, 'exclude_posts_comments' ), 99, 1 );
add_filter( 'get_next_post_where', array( &$this, 'exclude_navigation_posts' ), 99, 5 );
add_filter( 'get_previous_post_where', array( &$this, 'exclude_navigation_posts' ), 99, 5 );
add_filter( 'widget_posts_args', array( &$this, 'exclude_restricted_posts_widget' ), 99, 1 );
add_filter( 'comment_feed_where', array( &$this, 'exclude_posts_comments_feed' ), 99, 2 );
// callbacks for changing terms query
add_action( 'pre_get_terms', array( &$this, 'exclude_hidden_terms_query' ), 99, 1 );
// callbacks for changing comments query
add_action( 'pre_get_comments', array( &$this, 'exclude_posts_comments' ), 99, 1 );
add_filter( 'comment_feed_where', array( &$this, 'exclude_posts_comments_feed' ), 99, 2 );
add_filter( 'wp_count_comments', array( &$this, 'custom_comments_count_handler' ), 99, 2 );
/* Disable comments if user has not permission to access current post */
add_filter( 'comments_open', array( $this, 'disable_comments_open' ), 99, 2 );
add_filter( 'get_comments_number', array( $this, 'disable_comments_open_number' ), 99, 2 );
//there is posts (Posts/Page/CPT) filtration if site is accessible
//there also will be redirects if they need
@@ -79,6 +83,12 @@ if ( ! class_exists( 'um\core\Access' ) ) {
add_filter( 'get_pages', array( &$this, 'filter_protected_posts' ), 99, 2 );
//filter menu items
add_filter( 'wp_nav_menu_objects', array( &$this, 'filter_menu' ), 99, 2 );
// blocks restrictions
add_filter( 'render_block', array( $this, 'restrict_blocks' ), 10, 2 );
//filter attachment
add_filter( 'wp_get_attachment_url', array( &$this, 'filter_attachment' ), 99, 2 );
add_filter( 'has_post_thumbnail', array( &$this, 'filter_post_thumbnail' ), 99, 3 );
// turn on/off content replacement on the filter 'the_content'
add_action( 'get_header', array( &$this, 'replace_post_content_on' ), 12 );
@@ -87,22 +97,11 @@ if ( ! class_exists( 'um\core\Access' ) ) {
add_action( 'avada_before_body_content', array( &$this, 'replace_post_content_off' ), 8 );
add_action( 'avada_before_main_container', array( &$this, 'replace_post_content_on' ), 12 );
add_action( 'avada_after_main_content', array( &$this, 'replace_post_content_off' ), 8 );
//filter attachment
add_filter( 'wp_get_attachment_url', array( &$this, 'filter_attachment' ), 99, 2 );
add_filter( 'has_post_thumbnail', array( &$this, 'filter_post_thumbnail' ), 99, 3 );
//check the site's accessible more priority have Individual Post/Term Restriction settings
add_action( 'template_redirect', array( &$this, 'template_redirect' ), 1000 );
add_action( 'um_access_check_individual_term_settings', array( &$this, 'um_access_check_individual_term_settings' ) );
add_action( 'um_access_check_global_settings', array( &$this, 'um_access_check_global_settings' ) );
/* Disable comments if user has not permission to access current post */
add_filter( 'comments_open', array( $this, 'disable_comments_open' ), 99, 2 );
add_filter( 'get_comments_number', array( $this, 'disable_comments_open_number' ), 99, 2 );
add_filter( 'render_block', array( $this, 'restrict_blocks' ), 10, 2 );
}