mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-13 19:56:27 +09:00
Merge pull request #251 from nikitasinelnikov/master
This commit is contained in:
@@ -70,11 +70,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function um_category_access_fields_create( $term ){
|
||||
global $ultimatemember;
|
||||
|
||||
echo '<div class="form-field term-access-wrap">';
|
||||
|
||||
echo '<div class="form-field term-access-wrap um-conditional-radio-group" data-cond1="2" data-cond1-show="term-roles-wrap" data-cond2="1" data-cond2-show="term-redirect-wrap">';
|
||||
echo '<label>' . __('Content Availability','ultimatemember') . '</label>';
|
||||
echo '<label><input type="radio" name="_um_accessible" value="0" checked /> '. __('Content accessible to Everyone','ultimatemember') . '</label>
|
||||
<label><input type="radio" name="_um_accessible" value="1" /> ' . __('Content accessible to Logged Out Users','ultimatemember') . '</label>
|
||||
@@ -88,11 +88,14 @@
|
||||
echo '<label><input type="checkbox" name="_um_roles[]" value="' . $role_id . '" /> ' . $role . '</label>';
|
||||
}
|
||||
echo '<p class="description">' . __('This is applicable only if you restrict the content to logged-in users.','ultimatemember') . '</p>';
|
||||
echo '<label>' . __('Content Restriction Redirect URL','ultimatemember') . '</label>';
|
||||
echo '<input type="text" name="_um_redirect" id="_um_redirect" value="" />';
|
||||
echo '<p class="description">' . __('Users who cannot see content will get redirected to that URL.','ultimatemember') . '</p>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="form-field term-redirect-wrap">';
|
||||
echo '<label>' . __('Content Restriction Redirect URL','ultimatemember') . '</label>';
|
||||
echo '<input type="text" name="_um_redirect" id="_um_redirect" value="" />';
|
||||
echo '<input type="text" name="_um_redirect2" id="_um_redirect2" value="" />';
|
||||
echo '<p class="description">' . __('Users who cannot see content will get redirected to that URL.','ultimatemember') . '</p>';
|
||||
echo '</div>';
|
||||
|
||||
@@ -100,14 +103,15 @@
|
||||
|
||||
function um_category_access_fields_edit( $term ){
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
$termID = $term->term_id;
|
||||
$termMeta = get_option( "category_$termID" );
|
||||
$_um_accessible= (isset( $termMeta['_um_accessible'] ) )? $termMeta['_um_accessible'] : '';
|
||||
$_um_redirect= (isset( $termMeta['_um_redirect'] ) )? $termMeta['_um_redirect'] : '';
|
||||
$_um_redirect2= (isset( $termMeta['_um_redirect2'] ) )? $termMeta['_um_redirect2'] : '';
|
||||
$_um_roles= (isset( $termMeta['_um_roles'] ) )? $termMeta['_um_roles'] : '';
|
||||
|
||||
echo "<tr class='form-field form-required term-access-wrap'>";
|
||||
echo '<tr class="form-field form-required term-access-wrap um-conditional-radio-group" data-cond1="2" data-cond1-show="term-roles-wrap" data-cond2="1" data-cond2-show="term-redirect-wrap" >';
|
||||
echo "<th scope='row'><label>" . __('Content Availability','ultimatemember') . "</label></th>";
|
||||
echo '<td><label><input type="radio" name="_um_accessible" value="0" ' . checked( 0, $_um_accessible, 0 ) . ' /> '. __('Content accessible to Everyone','ultimatemember') . '</label><br />
|
||||
<label><input type="radio" name="_um_accessible" value="1" ' . checked( 1, $_um_accessible, 0 ) . ' /> ' . __('Content accessible to Logged Out Users','ultimatemember') . '</label><br />
|
||||
@@ -126,13 +130,19 @@
|
||||
}
|
||||
echo '<label><input type="checkbox" name="_um_roles[]" value="' . $role_id . '" ' . $checked . ' /> ' . $role . '</label> ';
|
||||
}
|
||||
echo '<p class="description">' . __('This is applicable only if you restrict the content to logged-in users.','ultimatemember') . '</p>';
|
||||
echo "</td></tr>";
|
||||
echo "<tr class='form-field form-required term-roles-wrap'>";
|
||||
echo "<th scope='row'><label>" . __('Content Restriction Redirect URL','ultimatemember') . "</label></th>";
|
||||
echo '<td>';
|
||||
echo '<input type="text" name="_um_redirect" id="_um_redirect" value="' . $_um_redirect . '" />';
|
||||
echo '<p class="description">' . __('Users who cannot see content will get redirected to that URL.','ultimatemember') . '</p>';
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='form-field form-required term-redirect-wrap'>";
|
||||
echo "<th scope='row'><label>" . __('Content Restriction Redirect URL','ultimatemember') . "</label></th>";
|
||||
echo '<td>';
|
||||
echo '<input type="text" name="_um_redirect" id="_um_redirect" value="' . $_um_redirect . '" />';
|
||||
echo '<input type="text" name="_um_redirect2" id="_um_redirect2" value="' . $_um_redirect2 . '" />';
|
||||
echo '<p class="description">' . __('Users who cannot see content will get redirected to that URL.','ultimatemember') . '</p>';
|
||||
echo "</td></tr>";
|
||||
|
||||
@@ -150,6 +160,7 @@
|
||||
// get value and save it into the database - maybe you have to sanitize your values (urls, etc...)
|
||||
$termMeta['_um_accessible'] = isset( $_POST['_um_accessible'] ) ? $_POST['_um_accessible'] : '';
|
||||
$termMeta['_um_redirect'] = isset( $_POST['_um_redirect'] ) ? $_POST['_um_redirect'] : '';
|
||||
$termMeta['_um_redirect2'] = isset( $_POST['_um_redirect2'] ) ? $_POST['_um_redirect2'] : '';
|
||||
$termMeta['_um_roles'] = isset( $_POST['_um_roles'] ) ? $_POST['_um_roles'] : '';
|
||||
|
||||
update_option( "category_$termID", $termMeta );
|
||||
|
||||
@@ -3,47 +3,50 @@
|
||||
class UM_Admin_DragDrop {
|
||||
|
||||
function __construct() {
|
||||
|
||||
|
||||
add_action('admin_footer', array(&$this, 'load_field_order'), 9);
|
||||
|
||||
|
||||
add_action('wp_ajax_nopriv_update_order', array(&$this, 'update_order') );
|
||||
add_action('wp_ajax_update_order', array(&$this, 'update_order') );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @update order of fields
|
||||
***/
|
||||
function update_order(){
|
||||
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
if ( !is_user_logged_in() || !current_user_can('manage_options') ) die('Please login as administrator');
|
||||
|
||||
|
||||
extract($_POST);
|
||||
|
||||
|
||||
$fields = $ultimatemember->query->get_attr('custom_fields', $form_id );
|
||||
|
||||
$this->row_data = get_option('um_form_rowdata_'. $form_id );
|
||||
|
||||
if( isset( $fields ) ){
|
||||
foreach( $fields as $key => $array ) {
|
||||
|
||||
$this->row_data = get_option('um_form_rowdata_'. $form_id, array() );
|
||||
$this->exist_rows = array();
|
||||
|
||||
if ( ! empty( $fields ) ) {
|
||||
foreach ( $fields as $key => $array ) {
|
||||
if ( $array['type'] == 'row' ) {
|
||||
$this->row_data[$key] = $array;
|
||||
unset( $fields[$key] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $_POST as $key => $value ) {
|
||||
|
||||
} else {
|
||||
$fields = array();
|
||||
}
|
||||
|
||||
foreach ( $_POST as $key => $value ) {
|
||||
|
||||
// adding rows
|
||||
if (0 === strpos($key, '_um_row_')) {
|
||||
|
||||
if ( 0 === strpos( $key, '_um_row_' ) ) {
|
||||
|
||||
$update_args = null;
|
||||
|
||||
|
||||
$row_id = str_replace( '_um_row_', '', $key );
|
||||
|
||||
|
||||
$row_array = array(
|
||||
'type' => 'row',
|
||||
'id' => $value,
|
||||
@@ -51,9 +54,9 @@ class UM_Admin_DragDrop {
|
||||
'cols' => $_POST[ '_um_rowcols_'.$row_id .'_cols' ],
|
||||
'origin' => $_POST[ '_um_roworigin_'.$row_id . '_val' ],
|
||||
);
|
||||
|
||||
|
||||
$row_args = $row_array;
|
||||
|
||||
|
||||
if ( isset( $this->row_data[ $row_array['origin'] ] ) ) {
|
||||
foreach( $this->row_data[ $row_array['origin'] ] as $k => $v ){
|
||||
if ( $k != 'position' && $k != 'metakey' ) {
|
||||
@@ -67,91 +70,91 @@ class UM_Admin_DragDrop {
|
||||
}
|
||||
|
||||
$fields[$key] = $row_args;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// change field position
|
||||
if (0 === strpos($key, 'um_position_') ) {
|
||||
if ( 0 === strpos( $key, 'um_position_' ) ) {
|
||||
$field_key = str_replace('um_position_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['position'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// change field master row
|
||||
if (0 === strpos($key, 'um_row_') ) {
|
||||
if ( 0 === strpos( $key, 'um_row_' ) ) {
|
||||
$field_key = str_replace('um_row_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['in_row'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// change field sub row
|
||||
if (0 === strpos($key, 'um_subrow_') ) {
|
||||
if ( 0 === strpos( $key, 'um_subrow_' ) ) {
|
||||
$field_key = str_replace('um_subrow_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['in_sub_row'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// change field column
|
||||
if (0 === strpos($key, 'um_col_') ) {
|
||||
if ( 0 === strpos( $key, 'um_col_' ) ) {
|
||||
$field_key = str_replace('um_col_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['in_column'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// add field to group
|
||||
if (0 === strpos($key, 'um_group_') ) {
|
||||
if ( 0 === strpos( $key, 'um_group_' ) ) {
|
||||
$field_key = str_replace('um_group_','',$key);
|
||||
if ( isset( $fields[$field_key] ) ) {
|
||||
$fields[$field_key]['in_group'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
foreach( $this->row_data as $k => $v ) {
|
||||
if ( !in_array( $k, $this->exist_rows ) )
|
||||
|
||||
foreach ( $this->row_data as $k => $v ) {
|
||||
if ( ! in_array( $k, $this->exist_rows ) )
|
||||
unset( $this->row_data[$k] );
|
||||
}
|
||||
|
||||
update_option('um_existing_rows_' . $form_id, $this->exist_rows );
|
||||
|
||||
update_option('um_form_rowdata_' . $form_id , $this->row_data );
|
||||
|
||||
update_option( 'um_existing_rows_' . $form_id, $this->exist_rows );
|
||||
|
||||
update_option( 'um_form_rowdata_' . $form_id , $this->row_data );
|
||||
|
||||
$ultimatemember->query->update_attr( 'custom_fields', $form_id, $fields );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @load form to maintain form order
|
||||
***/
|
||||
function load_field_order(){
|
||||
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
|
||||
if ( !isset( $screen->id ) || $screen->id != 'um_form' ) return;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="um-col-demon-settings" data-in_row="" data-in_sub_row="" data-in_column="" data-in_group="" />
|
||||
|
||||
|
||||
<div class="um-col-demon-row" style="display:none;">
|
||||
|
||||
|
||||
<div class="um-admin-drag-row-icons">
|
||||
<a href="#" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php _e('Add Row','ultimatemember'); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
||||
<a href="#" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php _e('Edit Row','ultimatemember'); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo get_the_ID(); ?>"><i class="um-faicon-pencil"></i></a>
|
||||
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
|
||||
<a href="#" class="um-admin-tipsy-n" title="<?php _e('Delete Row','ultimatemember'); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
|
||||
</div><div class="um-admin-clear"></div>
|
||||
|
||||
|
||||
<div class="um-admin-drag-rowsubs">
|
||||
<div class="um-admin-drag-rowsub">
|
||||
|
||||
|
||||
<div class="um-admin-drag-ctrls columns">
|
||||
<a href="#" class="active" data-cols="1"></a>
|
||||
<a href="#" data-cols="2"></a>
|
||||
@@ -165,18 +168,18 @@ class UM_Admin_DragDrop {
|
||||
|
||||
<div class="um-admin-drag-col">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="um-admin-drag-col-dynamic"></div>
|
||||
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="um-col-demon-subrow" style="display:none;">
|
||||
|
||||
|
||||
<div class="um-admin-drag-ctrls columns">
|
||||
<a href="#" class="active" data-cols="1"></a>
|
||||
<a href="#" data-cols="2"></a>
|
||||
@@ -190,28 +193,28 @@ class UM_Admin_DragDrop {
|
||||
|
||||
<div class="um-admin-drag-col">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="um-admin-drag-col-dynamic"></div>
|
||||
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<form action="" method="post" class="um_update_order">
|
||||
|
||||
|
||||
<input type="hidden" name="action" id="action" value="update_order" />
|
||||
|
||||
<input type="hidden" name="form_id" id="form_id" value="<?php echo get_the_ID(); ?>" />
|
||||
|
||||
|
||||
<div class="um_update_order_fields">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -226,10 +226,10 @@ class UM_Admin_Enqueue {
|
||||
***/
|
||||
function is_UM_admin(){
|
||||
|
||||
global $current_screen, $post;
|
||||
|
||||
global $current_screen, $post, $tax;
|
||||
|
||||
$screen_id = $current_screen->id;
|
||||
|
||||
|
||||
if ( !is_admin() ) return false;
|
||||
|
||||
if ( strstr( $screen_id, 'ultimatemember') || strstr( $screen_id, 'um_') || strstr($screen_id, 'user') || strstr($screen_id, 'profile') )return true;
|
||||
@@ -238,6 +238,8 @@ class UM_Admin_Enqueue {
|
||||
|
||||
if ( isset( $post->post_type ) ) return true;
|
||||
|
||||
if ( isset( $tax->name ) ) return true;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
@@ -290,4 +292,4 @@ class UM_Admin_Enqueue {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,23 +9,23 @@
|
||||
if ( isset($array['conditional_field']) && !empty( $array['conditional_action'] ) && !empty( $array['conditional_operator'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'] );
|
||||
}
|
||||
|
||||
|
||||
if ( isset($array['conditional_field1']) && !empty( $array['conditional_action1'] ) && !empty( $array['conditional_operator1'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] );
|
||||
}
|
||||
|
||||
|
||||
if ( isset($array['conditional_field2']) && !empty( $array['conditional_action2'] ) && !empty( $array['conditional_operator2'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] );
|
||||
}
|
||||
|
||||
|
||||
if ( isset($array['conditional_field3']) && !empty( $array['conditional_action3'] ) && !empty( $array['conditional_operator3'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] );
|
||||
}
|
||||
|
||||
|
||||
if ( isset($array['conditional_field4']) && !empty( $array['conditional_action4'] ) && !empty( $array['conditional_operator4'] ) ) {
|
||||
$array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] );
|
||||
}
|
||||
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
@@ -36,26 +36,26 @@
|
||||
function um_admin_pre_save_fields_hook( $array ){
|
||||
global $ultimatemember;
|
||||
extract( $array );
|
||||
|
||||
|
||||
$metabox = new UM_Admin_Metabox();
|
||||
|
||||
|
||||
$fields_without_metakey = array('block','shortcode','spacing','divider','group');
|
||||
$fields_without_metakey = apply_filters('um_fields_without_metakey', $fields_without_metakey );
|
||||
|
||||
|
||||
$fields = $ultimatemember->query->get_attr('custom_fields', $form_id);
|
||||
$count = 1;
|
||||
if ( isset( $fields ) && !empty( $fields) ) $count = count($fields)+1;
|
||||
|
||||
|
||||
// set unique meta key
|
||||
if ( in_array( $field_type, $fields_without_metakey ) && !isset($array['post']['_metakey']) ) {
|
||||
$array['post']['_metakey'] = "um_{$field_type}_{$form_id}_{$count}";
|
||||
}
|
||||
|
||||
|
||||
// set position
|
||||
if ( !isset( $array['post']['_position'] ) ) {
|
||||
$array['post']['_position'] = $count;
|
||||
}
|
||||
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
@@ -66,24 +66,24 @@
|
||||
function um_admin_field_update_error_handling( $errors, $array ){
|
||||
global $ultimatemember;
|
||||
extract( $array );
|
||||
|
||||
|
||||
$field_attr = $ultimatemember->builtin->get_core_field_attrs( $field_type );
|
||||
|
||||
|
||||
if ( isset( $field_attr['validate'] ) ) {
|
||||
|
||||
|
||||
$validate = $field_attr['validate'];
|
||||
foreach ( $validate as $post_input => $arr ) {
|
||||
|
||||
|
||||
$mode = $arr['mode'];
|
||||
|
||||
|
||||
switch ( $mode ) {
|
||||
|
||||
|
||||
case 'numeric':
|
||||
if ( !empty( $array['post'][$post_input] ) && !is_numeric( $array['post'][$post_input] ) ){
|
||||
$errors[$post_input] = $validate[$post_input]['error'];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'unique':
|
||||
if ( !isset( $array['post']['edit_mode'] ) ) {
|
||||
if ( $ultimatemember->builtin->unique_field_err( $array['post'][$post_input] ) ) {
|
||||
@@ -91,43 +91,42 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'required':
|
||||
if ( $array['post'][$post_input] == '' )
|
||||
$errors[$post_input] = $validate[$post_input]['error'];
|
||||
break;
|
||||
|
||||
|
||||
case 'range-start':
|
||||
if ( $ultimatemember->builtin->date_range_start_err( $array['post'][$post_input] ) && $array['post']['_range'] == 'date_range' )
|
||||
$errors[$post_input] = $ultimatemember->builtin->date_range_start_err( $array['post'][$post_input] );
|
||||
break;
|
||||
|
||||
|
||||
case 'range-end':
|
||||
if ( $ultimatemember->builtin->date_range_end_err( $array['post'][$post_input], $array['post']['_range_start'] ) && $array['post']['_range'] == 'date_range' )
|
||||
$errors[$post_input] = $ultimatemember->builtin->date_range_end_err( $array['post'][$post_input], $array['post']['_range_start'] );
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $errors;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Filter validation types on loop
|
||||
****/
|
||||
add_filter('um_builtin_validation_types_continue_loop', 'um_builtin_validation_types_continue_loop', 1, 4);
|
||||
function um_builtin_validation_types_continue_loop( $break, $key, $form_id, $field_array ){
|
||||
|
||||
function um_builtin_validation_types_continue_loop( $break, $key, $form_id, $field_array ){
|
||||
|
||||
// show unique username validation only for user_login field
|
||||
if( $field_array['metakey'] == 'user_login' && $key !== 'unique_username' ){
|
||||
return false;
|
||||
}
|
||||
if ( isset( $field_array['metakey'] ) && $field_array['metakey'] == 'user_login' && $key !== 'unique_username' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
return $break;
|
||||
}
|
||||
return $break;
|
||||
}
|
||||
|
||||
@@ -389,8 +389,8 @@
|
||||
|
||||
if ( is_user_logged_in() ){
|
||||
|
||||
if( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) {
|
||||
$redirect = $opt['_um_redirect'];
|
||||
if( isset( $opt['_um_redirect2'] ) && ! empty( $opt['_um_redirect2'] ) ) {
|
||||
$redirect = $opt['_um_redirect2'];
|
||||
}else{
|
||||
$redirect = site_url();
|
||||
}
|
||||
@@ -478,7 +478,7 @@
|
||||
case 1:
|
||||
|
||||
if ( is_user_logged_in() )
|
||||
$redirect = ( isset( $opt['_um_redirect'] ) && !empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
|
||||
$redirect = ( isset( $opt['_um_redirect2'] ) && !empty( $opt['_um_redirect2'] ) ) ? $opt['_um_redirect2'] : site_url();
|
||||
$redirect = $ultimatemember->access->set_referer( $redirect, "categories_1" );
|
||||
$ultimatemember->access->redirect_handler = $redirect;
|
||||
if ( !is_user_logged_in() )
|
||||
@@ -566,8 +566,8 @@
|
||||
|
||||
if ( is_user_logged_in() ){
|
||||
|
||||
if( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) {
|
||||
$redirect = $opt['_um_redirect'];
|
||||
if( isset( $opt['_um_redirect2'] ) && ! empty( $opt['_um_redirect2'] ) ) {
|
||||
$redirect = $opt['_um_redirect2'];
|
||||
}else{
|
||||
$redirect = site_url();
|
||||
}
|
||||
@@ -703,7 +703,7 @@
|
||||
case 1: // Logged out users only
|
||||
|
||||
if ( is_user_logged_in() ){
|
||||
$redirect = ( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
|
||||
$redirect = ( isset( $opt['_um_redirect2'] ) && ! empty( $opt['_um_redirect2'] ) ) ? $opt['_um_redirect2'] : site_url();
|
||||
$redirect = $ultimatemember->access->set_referer( $redirect, "page_cat_1a_t{$cat->term_id}_pt{$post_type}" );
|
||||
$ultimatemember->access->redirect_handler = $redirect;
|
||||
$ultimatemember->access->allow_access = false;
|
||||
|
||||
+4
-3
@@ -20,8 +20,9 @@ class UM_REST_API {
|
||||
add_action( 'init', array( $this, 'add_endpoint' ) );
|
||||
add_action( 'template_redirect', array( $this, 'process_query' ), -1 );
|
||||
add_filter( 'query_vars', array( $this, 'query_vars' ) );
|
||||
add_action( 'show_user_profile', array( $this, 'user_key_field' ) );
|
||||
add_action( 'edit_user_profile', array( $this, 'user_key_field' ) );
|
||||
|
||||
add_action( 'um_user_profile_section', array( $this, 'user_key_field' ), 2 );
|
||||
|
||||
add_action( 'personal_options_update', array( $this, 'update_key' ) );
|
||||
add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
|
||||
|
||||
@@ -863,4 +864,4 @@ class UM_REST_API {
|
||||
return hash( 'md5', $user->um_user_secret_key . $user->um_user_public_key );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ class UM_User {
|
||||
|
||||
$um_user_role = get_user_meta($user->ID,'role',true);
|
||||
?>
|
||||
<h2><?php _e('Ultimate Member','ultimatemember') ?></h2>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -79,6 +80,8 @@ class UM_User {
|
||||
</tbody>
|
||||
</table>
|
||||
<?php }
|
||||
|
||||
do_action( 'um_user_profile_section' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user