mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-18 06:03:38 +09:00
Content Restriction
This commit is contained in:
@@ -20,8 +20,6 @@
|
||||
-moz-osx-font-smoothing: grayscale !important;
|
||||
}
|
||||
|
||||
#um-admin-access-control * {vertical-align: middle}
|
||||
|
||||
#um-admin-access-control p {font-size: 13px}
|
||||
|
||||
#um-admin-access-control input[type=text] {font-size: 13px}
|
||||
|
||||
@@ -107,8 +107,10 @@ class UM_Admin_Metabox {
|
||||
***/
|
||||
function ui_on_off( $id, $default=0, $is_conditional=false, $cond1='', $cond1_show='', $cond1_hide='' ) {
|
||||
|
||||
if (isset($this->postmeta[$id][0])) {
|
||||
$active = $this->postmeta[$id][0];
|
||||
$meta = get_post_meta( get_the_ID(), $id, true );
|
||||
|
||||
if (isset($this->postmeta[$id][0]) || $meta ) {
|
||||
$active = ( isset( $this->postmeta[$id][0] ) ) ? $this->postmeta[$id][0] : $meta;
|
||||
} else {
|
||||
$active = $default;
|
||||
}
|
||||
|
||||
@@ -1,51 +1,62 @@
|
||||
<h4><?php _e('Content Availability','ultimatemember'); ?> <?php $this->tooltip( __('Who can access this content?','ultimatemember'), 'e'); ?></h4>
|
||||
<h4><?php _e('Apply custom access settings?','ultimatemember'); ?> <?php $this->tooltip( __('Switch to yes to override global access settings','ultimatemember'), 'e'); ?></h4>
|
||||
|
||||
<p class="um-conditional-radio-group description" data-cond1="2" data-cond1-show="um-admin-access-roles" data-cond2="1" data-cond2-show="um-admin-access-loggedout">
|
||||
|
||||
<?php $value = get_post_meta($post->ID, '_um_accessible', true); ?>
|
||||
|
||||
<label><input type="radio" name="_um_accessible" value="0" <?php if (!isset($value) || $value == 0 ) echo 'checked="checked"'; ?> /> <?php _e('Content accessible to Everyone','ultimatemember'); ?></label><br />
|
||||
<label><input type="radio" name="_um_accessible" value="1" <?php if (isset($value)) checked(1, $value); ?> /> <?php _e('Content accessible to Logged Out Users','ultimatemember'); ?></label><br />
|
||||
<label><input type="radio" name="_um_accessible" value="2" <?php if (isset($value)) checked(2, $value); ?> /> <?php _e('Content accessible to Logged In Users','ultimatemember'); ?></label>
|
||||
|
||||
<p>
|
||||
<?php $metabox = new UM_Admin_Metabox(); ?>
|
||||
<span><?php $metabox->ui_on_off('_um_custom_access_settings', 0, true, 1, '_um_custom_access_settings', 'xxx'); ?> </span>
|
||||
</p>
|
||||
|
||||
<div class="um-admin-access-loggedout">
|
||||
<div class="_um_custom_access_settings">
|
||||
|
||||
<h4><label for="_um_access_redirect2"><?php _e('Redirect URL','ultimatemember'); ?></label> <?php $this->tooltip( __('This is the URL that user is redirected to If he is not permitted to view this content','ultimatemember'), 'e'); ?></h4>
|
||||
<h4><?php _e('Content Availability','ultimatemember'); ?> <?php $this->tooltip( __('Who can access this content?','ultimatemember'), 'e'); ?></h4>
|
||||
|
||||
<p class="description">
|
||||
<p class="um-conditional-radio-group description" data-cond1="2" data-cond1-show="um-admin-access-roles" data-cond2="1" data-cond2-show="um-admin-access-loggedout">
|
||||
|
||||
<?php $value = get_post_meta($post->ID, '_um_access_redirect2', true); ?>
|
||||
|
||||
<input type="text" name="_um_access_redirect2" id="_um_access_redirect2" value="<?php if ( isset( $value ) ) echo $value; ?>" class="widefat" />
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-access-roles">
|
||||
|
||||
<h4><?php _e('Select the member roles that can see this content?','ultimatemember'); ?> <?php $this->tooltip( __('If you do not select any role, all members wil be able to view this content','ultimatemember'), 'e'); ?></h4>
|
||||
|
||||
<p class="description">
|
||||
|
||||
<?php $value = get_post_meta($post->ID, '_um_access_roles', true); ?>
|
||||
<?php $value = get_post_meta($post->ID, '_um_accessible', true); ?>
|
||||
|
||||
<?php foreach($ultimatemember->query->get_roles() as $role_id => $role) { ?>
|
||||
<label><input type="checkbox" name="_um_access_roles[]" value="<?php echo $role_id; ?>" <?php if ( ( isset( $value ) && is_array( $value ) && in_array($role_id, $value ) ) || ( isset( $value ) && $role_id == $value ) ) echo 'checked="checked"'; ?> /> <?php echo $role; ?></label><br />
|
||||
<?php } ?>
|
||||
|
||||
</p>
|
||||
|
||||
<h4><label for="_um_access_redirect"><?php _e('Redirect URL','ultimatemember'); ?></label> <?php $this->tooltip( __('This is the URL that user is redirected to If he is not permitted to view this content','ultimatemember'), 'e'); ?></h4>
|
||||
|
||||
<p class="description">
|
||||
|
||||
<?php $value = get_post_meta($post->ID, '_um_access_redirect', true); ?>
|
||||
<label><input type="radio" name="_um_accessible" value="0" <?php if (!isset($value) || $value == 0 ) echo 'checked="checked"'; ?> /> <?php _e('Content accessible to Everyone','ultimatemember'); ?></label><br />
|
||||
<label><input type="radio" name="_um_accessible" value="1" <?php if (isset($value)) checked(1, $value); ?> /> <?php _e('Content accessible to Logged Out Users','ultimatemember'); ?></label><br />
|
||||
<label><input type="radio" name="_um_accessible" value="2" <?php if (isset($value)) checked(2, $value); ?> /> <?php _e('Content accessible to Logged In Users','ultimatemember'); ?></label>
|
||||
|
||||
<input type="text" name="_um_access_redirect" id="_um_access_redirect" value="<?php if ( isset( $value ) ) echo $value; ?>" class="widefat" />
|
||||
|
||||
</p>
|
||||
|
||||
<div class="um-admin-access-loggedout">
|
||||
|
||||
<h4><label for="_um_access_redirect2"><?php _e('Redirect URL','ultimatemember'); ?></label> <?php $this->tooltip( __('This is the URL that user is redirected to If he is not permitted to view this content','ultimatemember'), 'e'); ?></h4>
|
||||
|
||||
<p class="description">
|
||||
|
||||
<?php $value = get_post_meta($post->ID, '_um_access_redirect2', true); ?>
|
||||
|
||||
<input type="text" name="_um_access_redirect2" id="_um_access_redirect2" value="<?php if ( isset( $value ) ) echo $value; ?>" class="widefat" />
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-access-roles">
|
||||
|
||||
<h4><?php _e('Select the member roles that can see this content?','ultimatemember'); ?> <?php $this->tooltip( __('If you do not select any role, all members wil be able to view this content','ultimatemember'), 'e'); ?></h4>
|
||||
|
||||
<p class="description">
|
||||
|
||||
<?php $value = get_post_meta($post->ID, '_um_access_roles', true); ?>
|
||||
|
||||
<?php foreach($ultimatemember->query->get_roles() as $role_id => $role) { ?>
|
||||
<label><input type="checkbox" name="_um_access_roles[]" value="<?php echo $role_id; ?>" <?php if ( ( isset( $value ) && is_array( $value ) && in_array($role_id, $value ) ) || ( isset( $value ) && $role_id == $value ) ) echo 'checked="checked"'; ?> /> <?php echo $role; ?></label><br />
|
||||
<?php } ?>
|
||||
|
||||
</p>
|
||||
|
||||
<h4><label for="_um_access_redirect"><?php _e('Redirect URL','ultimatemember'); ?></label> <?php $this->tooltip( __('This is the URL that user is redirected to If he is not permitted to view this content','ultimatemember'), 'e'); ?></h4>
|
||||
|
||||
<p class="description">
|
||||
|
||||
<?php $value = get_post_meta($post->ID, '_um_access_redirect', true); ?>
|
||||
|
||||
<input type="text" name="_um_access_redirect" id="_um_access_redirect" value="<?php if ( isset( $value ) ) echo $value; ?>" class="widefat" />
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user