mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-16 05:03:33 +09:00
- UM Woocommerce compatibility;
- make "Shop" page restricted;
This commit is contained in:
@@ -103,8 +103,13 @@ if ( ! class_exists( 'Admin_Metabox' ) ) {
|
||||
//restrict content metabox
|
||||
$post_types = um_get_option( 'restricted_access_post_metabox' );
|
||||
if ( ! empty( $post_types[ $current_screen->id ] ) ) {
|
||||
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_restrict_content'), 1 );
|
||||
add_action( 'save_post', array( &$this, 'save_metabox_restrict_content' ), 10, 2 );
|
||||
|
||||
$hide_metabox = apply_filters( 'um_restrict_content_hide_metabox', false );
|
||||
|
||||
if ( ! $hide_metabox ) {
|
||||
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_restrict_content'), 1 );
|
||||
add_action( 'save_post', array( &$this, 'save_metabox_restrict_content' ), 10, 2 );
|
||||
}
|
||||
|
||||
if ( $current_screen->id == 'attachment' ) {
|
||||
add_action( 'add_attachment', array( &$this, 'save_attachment_metabox_restrict_content' ), 10, 2 );
|
||||
|
||||
@@ -131,3 +131,15 @@
|
||||
|
||||
return $break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_filter( 'um_restrict_content_hide_metabox', 'um_hide_metabox_restrict_content_shop', 10, 1 );
|
||||
function um_hide_metabox_restrict_content_shop( $hide ) {
|
||||
if ( function_exists( 'wc_get_page_id' ) && ! empty( $_GET['post'] ) &&
|
||||
$_GET['post'] == wc_get_page_id( 'shop' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $hide;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
* @return array
|
||||
*/
|
||||
function filter_protected_posts( $posts, $query ) {
|
||||
$filtered_posts = array();
|
||||
$filtered_posts = array();
|
||||
|
||||
//if empty
|
||||
if ( empty( $posts ) )
|
||||
@@ -213,7 +213,6 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
|
||||
//other filter
|
||||
foreach ( $posts as $post ) {
|
||||
|
||||
$restriction = $this->get_post_privacy_settings( $post );
|
||||
if ( ! $restriction ) {
|
||||
$filtered_posts[] = $post;
|
||||
|
||||
Reference in New Issue
Block a user