mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Merge branch 'development/2.6.5' into fix/remove_extract_frontend
This commit is contained in:
@@ -42,7 +42,7 @@ GNU Version 2 or Any Later Version
|
||||
|
||||
## Releases
|
||||
|
||||
[Official Release Version: 2.6.3](https://github.com/ultimatemember/ultimatemember/releases/tag/2.6.3).
|
||||
[Official Release Version: 2.6.4](https://github.com/ultimatemember/ultimatemember/releases/tag/2.6.4).
|
||||
|
||||
## Changelog
|
||||
|
||||
|
||||
@@ -35,22 +35,20 @@ jQuery(document).ready(function() {
|
||||
|
||||
/* Add a Field */
|
||||
jQuery(document.body).on('submit', 'form.um_add_field', function(e){
|
||||
|
||||
e.preventDefault();
|
||||
var conditions = jQuery('.um-admin-cur-condition');
|
||||
//need fields refactor
|
||||
jQuery(conditions).each( function ( i ) {
|
||||
|
||||
if ( jQuery( this ).find('[id^="_conditional_action"]').val() === '' ||
|
||||
jQuery( this ).find('[id^="_conditional_field"]').val() === '' ||
|
||||
jQuery( this ).find('[id^="_conditional_operator"]').val() ==='' )
|
||||
{
|
||||
jQuery(conditions[i]).find('.um-admin-remove-condition').trigger('click');
|
||||
}
|
||||
} );
|
||||
conditions = jQuery('.um-admin-cur-condition');
|
||||
jQuery(conditions).each( function ( i ) {
|
||||
var id = i === 0 ? '' : i;
|
||||
var conditions = jQuery('.um-admin-cur-condition');
|
||||
//need fields refactor
|
||||
jQuery(conditions).each( function ( i ) {
|
||||
if ( jQuery( this ).find('[id^="_conditional_action"]').val() === '' ||
|
||||
jQuery( this ).find('[id^="_conditional_field"]').val() === '' ||
|
||||
jQuery( this ).find('[id^="_conditional_operator"]').val() ==='' )
|
||||
{
|
||||
jQuery(conditions[i]).find('.um-admin-remove-condition').trigger('click');
|
||||
}
|
||||
} );
|
||||
conditions = jQuery('.um-admin-cur-condition');
|
||||
jQuery(conditions).each( function ( i ) {
|
||||
var id = i === 0 ? '' : i;
|
||||
|
||||
jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id);
|
||||
jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id);
|
||||
@@ -60,8 +58,7 @@ jQuery(document).ready(function() {
|
||||
jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
|
||||
|
||||
} );
|
||||
} );
|
||||
var form = jQuery(this);
|
||||
|
||||
jQuery.ajax({
|
||||
@@ -78,40 +75,34 @@ jQuery(document).ready(function() {
|
||||
complete: function(){
|
||||
form.css({'opacity': 1});
|
||||
},
|
||||
success: function(data){
|
||||
if (data.error){
|
||||
|
||||
c = 0;
|
||||
jQuery.each(data.error, function(i, v){
|
||||
c++;
|
||||
if ( c == 1 ) {
|
||||
form.find('#'+i).addClass('um-admin-error').trigger('focus');
|
||||
form.find('.um-admin-error-block').show().html(v);
|
||||
}
|
||||
});
|
||||
|
||||
um_admin_modal_responsive();
|
||||
success: function( response ){
|
||||
if ( response.success ) {
|
||||
let data = response.data;
|
||||
if ( data.error ) {
|
||||
let c = 0;
|
||||
jQuery.each( data.error, function(i, v){
|
||||
c++;
|
||||
if ( 1 === c ) {
|
||||
form.find('#' + i).addClass('um-admin-error').trigger('focus');
|
||||
form.find('.um-admin-error-block').show().html(v);
|
||||
}
|
||||
});
|
||||
|
||||
um_admin_modal_responsive();
|
||||
} else {
|
||||
jQuery('.um-col-demon-settings').data('in_row', '').data('in_sub_row', '').data('in_column', '').data('in_group', '');
|
||||
um_admin_remove_modal();
|
||||
um_admin_update_builder();
|
||||
}
|
||||
} else {
|
||||
|
||||
jQuery('.um-col-demon-settings').data('in_row', '');
|
||||
jQuery('.um-col-demon-settings').data('in_sub_row', '');
|
||||
jQuery('.um-col-demon-settings').data('in_column', '');
|
||||
jQuery('.um-col-demon-settings').data('in_group', '');
|
||||
|
||||
um_admin_remove_modal();
|
||||
um_admin_update_builder();
|
||||
|
||||
console.log( response );
|
||||
}
|
||||
|
||||
},
|
||||
error: function(data){
|
||||
console.log(data);
|
||||
error: function( response ){
|
||||
console.log( response );
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,18 +35,19 @@ if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
|
||||
*/
|
||||
public function update_order() {
|
||||
UM()->admin()->check_ajax_nonce();
|
||||
// phpcs:disable WordPress.Security.NonceVerification -- already verified here
|
||||
|
||||
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
||||
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @var $form_id
|
||||
*/
|
||||
extract( $_POST );
|
||||
if ( empty( $_POST['form_id'] ) ) {
|
||||
wp_send_json_error( __( 'Invalid form ID.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( isset( $form_id ) ) {
|
||||
$form_id = absint( $form_id );
|
||||
$form_id = absint( $_POST['form_id'] );
|
||||
if ( empty( $form_id ) ) {
|
||||
wp_send_json_error( __( 'Invalid form ID.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
||||
@@ -71,12 +72,11 @@ if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
|
||||
|
||||
// adding rows
|
||||
if ( 0 === strpos( $key, '_um_row_' ) ) {
|
||||
|
||||
$update_args = null;
|
||||
|
||||
$row_id = str_replace( '_um_row_', '', $key );
|
||||
|
||||
if ( strstr( $_POST[ '_um_rowcols_' . $row_id . '_cols' ], ':' ) ) {
|
||||
if ( false !== strpos( $_POST[ '_um_rowcols_' . $row_id . '_cols' ], ':' ) ) {
|
||||
$cols = sanitize_text_field( $_POST[ '_um_rowcols_' . $row_id . '_cols' ] );
|
||||
} else {
|
||||
$cols = absint( $_POST[ '_um_rowcols_' . $row_id . '_cols' ] );
|
||||
@@ -105,7 +105,6 @@ if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
|
||||
}
|
||||
|
||||
$fields[ $key ] = $row_args;
|
||||
|
||||
}
|
||||
|
||||
// change field position
|
||||
@@ -160,16 +159,16 @@ if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
|
||||
update_option( 'um_form_rowdata_' . $form_id, $this->row_data );
|
||||
|
||||
UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
|
||||
// phpcs:enable WordPress.Security.NonceVerification -- already verified here
|
||||
}
|
||||
|
||||
/**
|
||||
* Load form to maintain form order.
|
||||
*/
|
||||
public function load_field_order() {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( ! isset( $screen->id ) || 'um_form' !== $screen->id ) {
|
||||
if ( ! isset( $screen, $screen->id ) || 'um_form' !== $screen->id ) {
|
||||
return;
|
||||
} ?>
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
*/
|
||||
public $is_loaded = false;
|
||||
|
||||
public $set_field_type;
|
||||
|
||||
/**
|
||||
* Admin_Metabox constructor.
|
||||
*/
|
||||
@@ -1820,7 +1822,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
?>
|
||||
|
||||
<p><label for="_format_custom"><?php _e( 'Use custom Date format', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'This option overrides "Date User-Friendly Format" option. See https://www.php.net/manual/en/function.date.php', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_format_custom" id="_format_custom" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" placeholder="j M Y" />
|
||||
<input type="text" name="_format_custom" id="_format_custom" value="<?php echo esc_attr( $this->edit_mode_value ); ?>" placeholder="j M Y" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
@@ -2191,7 +2193,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
?>
|
||||
|
||||
<p><label for="_title"><?php _e( 'Title', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the title of the field for your reference in the backend. The title will not appear on the front-end of your website.', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_title" id="_title" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" />
|
||||
<input type="text" name="_title" id="_title" value="<?php echo esc_attr( $this->edit_mode_value ); ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
@@ -2202,7 +2204,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
?>
|
||||
|
||||
<p style="display:none"><label for="_id"><?php _e( 'Unique ID', 'ultimate-member' ) ?></label>
|
||||
<input type="text" name="_id" id="_id" value="<?php echo $this->edit_mode_value; ?>" />
|
||||
<input type="text" name="_id" id="_id" value="<?php echo esc_attr( $this->edit_mode_value ); ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
@@ -2271,7 +2273,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
<?php } else { ?>
|
||||
|
||||
<p><label for="_default"><?php _e( 'Default Value', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'This option allows you to pre-fill the field with a default value prior to the user entering a value in the field. Leave blank to have no default value', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" />
|
||||
<input type="text" name="_default" id="_default" value="<?php echo esc_attr( $this->edit_mode_value ); ?>" />
|
||||
</p>
|
||||
|
||||
<?php } ?>
|
||||
@@ -2283,7 +2285,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
?>
|
||||
|
||||
<p><label for="_label"><?php _e( 'Label', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'The field label is the text that appears above the field on your front-end form. Leave blank to not show a label above field.', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_label" id="_label" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" />
|
||||
<input type="text" name="_label" id="_label" value="<?php echo esc_attr( $this->edit_mode_value ); ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
@@ -2293,7 +2295,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
?>
|
||||
|
||||
<p><label for="_label_confirm_pass"><?php _e( 'Confirm password field label', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This label is the text that appears above the confirm password field. Leave blank to show default label.', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_label_confirm_pass" id="_label_confirm_pass" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" />
|
||||
<input type="text" name="_label_confirm_pass" id="_label_confirm_pass" value="<?php echo esc_attr( $this->edit_mode_value ); ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
@@ -2303,7 +2305,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
?>
|
||||
|
||||
<p><label for="_placeholder"><?php _e( 'Placeholder', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the text that appears within the field e.g please enter your email address. Leave blank to not show any placeholder text.', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_placeholder" id="_placeholder" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" />
|
||||
<input type="text" name="_placeholder" id="_placeholder" value="<?php echo esc_attr( $this->edit_mode_value ); ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -3089,7 +3089,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
|
||||
foreach ( $scan_files as $key => $files ) {
|
||||
foreach ( $files as $file ) {
|
||||
if ( ! str_contains( $file, 'email/' ) ) {
|
||||
if ( false === strpos( $file, 'email/' ) ) {
|
||||
$located = array();
|
||||
/**
|
||||
* Filters an array of the template files for scanning versions based on $key.
|
||||
@@ -3106,8 +3106,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
*/
|
||||
$located = apply_filters( "um_override_templates_get_template_path__{$key}", $located, $file );
|
||||
|
||||
$exceptions = array(
|
||||
'members-grid.php',
|
||||
'members-header.php',
|
||||
'members-list.php',
|
||||
'members-pagination.php',
|
||||
'searchform.php',
|
||||
'login-to-view.php',
|
||||
'profile/comments.php',
|
||||
'profile/comments-single.php',
|
||||
'profile/posts.php',
|
||||
'profile/posts-single.php',
|
||||
'modal/um_upload_single.php',
|
||||
'modal/um_view_photo.php',
|
||||
);
|
||||
|
||||
if ( ! empty( $located ) ) {
|
||||
$theme_file = $located['theme'];
|
||||
} elseif ( in_array( $file, $exceptions, true ) && file_exists( get_stylesheet_directory() . '/ultimate-member/' . $file ) ) {
|
||||
$theme_file = get_stylesheet_directory() . '/ultimate-member/' . $file;
|
||||
} elseif ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) {
|
||||
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $file;
|
||||
} else {
|
||||
@@ -3491,34 +3508,34 @@ Account Deletion Notification: <?php echo $this->info_value( UM()->options()->g
|
||||
|
||||
--- UM Custom Templates ---
|
||||
|
||||
<?php // Show templates that have been copied to the theme's edd_templates dir
|
||||
$dir = get_stylesheet_directory() . '/ultimate-member/templates/*.php';
|
||||
if ( ! empty( $dir ) ) {
|
||||
$found = glob( $dir );
|
||||
if ( ! empty( $found ) ) {
|
||||
foreach ( glob( $dir ) as $file ) {
|
||||
echo "File: " . $file . "\n";
|
||||
}
|
||||
} else {
|
||||
echo 'N/A'."\n";
|
||||
}
|
||||
} ?>
|
||||
<?php // Show templates that have been copied to the theme's edd_templates dir
|
||||
$dir = get_stylesheet_directory() . '/ultimate-member/templates/*.php';
|
||||
if ( ! empty( $dir ) ) {
|
||||
$found = glob( $dir );
|
||||
if ( ! empty( $found ) ) {
|
||||
foreach ( glob( $dir ) as $file ) {
|
||||
echo "File: " . $file . "\n";
|
||||
}
|
||||
} else {
|
||||
echo 'N/A'."\n";
|
||||
}
|
||||
} ?>
|
||||
|
||||
|
||||
--- UM Email HTML Templates ---
|
||||
--- UM Custom Email Templates ---
|
||||
|
||||
<?php $dir = get_stylesheet_directory() . '/ultimate-member/templates/emails/*.html';
|
||||
<?php $dir = get_stylesheet_directory() . '/ultimate-member/email/*.php';
|
||||
|
||||
if ( ! empty( $dir ) ) {
|
||||
$found = glob( $dir );
|
||||
if ( ! empty( $found ) ){
|
||||
foreach ( glob( $dir ) as $file ) {
|
||||
echo "File: ". $file . "\n";
|
||||
}
|
||||
} else {
|
||||
echo 'N/A'."\n";
|
||||
}
|
||||
} ?>
|
||||
if ( ! empty( $dir ) ) {
|
||||
$found = glob( $dir );
|
||||
if ( ! empty( $found ) ){
|
||||
foreach ( glob( $dir ) as $file ) {
|
||||
echo "File: ". $file . "\n";
|
||||
}
|
||||
} else {
|
||||
echo 'N/A'."\n";
|
||||
}
|
||||
} ?>
|
||||
|
||||
|
||||
--- Web Server Configurations ---
|
||||
|
||||
@@ -47,7 +47,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
/**
|
||||
* @var UM the single instance of the class
|
||||
*/
|
||||
protected static $instance = null;
|
||||
protected static $instance;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -210,26 +210,22 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a core field attrs
|
||||
* Get a core field attrs.
|
||||
*
|
||||
* @param $type
|
||||
* @param string $type Field type.
|
||||
*
|
||||
* @return array|mixed
|
||||
* @return array Field data.
|
||||
*/
|
||||
function get_core_field_attrs( $type ) {
|
||||
return ( isset( $this->core_fields[ $type ] ) ) ? $this->core_fields[ $type ] : array('');
|
||||
public function get_core_field_attrs( $type ) {
|
||||
return array_key_exists( $type, $this->core_fields ) ? $this->core_fields[ $type ] : array( '' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Core Fields
|
||||
*/
|
||||
function set_core_fields() {
|
||||
|
||||
public function set_core_fields() {
|
||||
$this->core_fields = array(
|
||||
|
||||
'row' => array(
|
||||
'name' => 'Row',
|
||||
'in_fields' => false,
|
||||
@@ -651,21 +647,21 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
),
|
||||
|
||||
/*'group' => array(
|
||||
'name' => 'Field Group',
|
||||
'col1' => array('_title','_max_entries'),
|
||||
'col2' => array('_label','_public','_roles'),
|
||||
'form_only' => true,
|
||||
'validate' => array(
|
||||
'_title' => array(
|
||||
'mode' => 'required',
|
||||
'error' => 'You must provide a title'
|
||||
),
|
||||
'_label' => array(
|
||||
'mode' => 'required',
|
||||
'error' => 'You must provide a label'
|
||||
),
|
||||
)
|
||||
),*/
|
||||
'name' => 'Field Group',
|
||||
'col1' => array('_title','_max_entries'),
|
||||
'col2' => array('_label','_public','_roles'),
|
||||
'form_only' => true,
|
||||
'validate' => array(
|
||||
'_title' => array(
|
||||
'mode' => 'required',
|
||||
'error' => 'You must provide a title'
|
||||
),
|
||||
'_label' => array(
|
||||
'mode' => 'required',
|
||||
'error' => 'You must provide a label'
|
||||
),
|
||||
)
|
||||
),*/
|
||||
|
||||
);
|
||||
|
||||
@@ -1379,48 +1375,43 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all fields without metakeys
|
||||
* Get all fields without metakeys.
|
||||
*
|
||||
* @since 2.0.56
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_fields_without_metakey() {
|
||||
public function get_fields_without_metakey() {
|
||||
$fields_without_metakey = array(
|
||||
'block',
|
||||
'shortcode',
|
||||
'spacing',
|
||||
'divider',
|
||||
'group'
|
||||
'group',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
* Filters the field types without meta key.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_fields_without_metakey
|
||||
* @description Field Types without meta key
|
||||
* @input_vars
|
||||
* [{"var":"$types","type":"array","desc":"Field Types"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_fields_without_metakey', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_fields_without_metakey', 'my_fields_without_metakey', 10, 1 );
|
||||
* function my_fields_without_metakey( $types ) {
|
||||
* // your code here
|
||||
* return $types;
|
||||
* @param {array} $field_types Field types.
|
||||
*
|
||||
* @return {array} Field types.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_fields_without_metakey
|
||||
*
|
||||
* @example <caption>It adds 'location' and 'distance' field-types to fields without metakeys array.</caption>
|
||||
* function my_custom_um_fields_without_metakey( $field_types ) {
|
||||
* $field_types[] = 'location';
|
||||
* $field_types[] = 'distance';
|
||||
* return $field_types;
|
||||
* }
|
||||
* ?>
|
||||
* add_filter( 'um_fields_without_metakey', 'my_custom_um_fields_without_metakey' );
|
||||
*/
|
||||
return apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* May be used to show a dropdown, or source for user meta
|
||||
*
|
||||
|
||||
@@ -13,6 +13,9 @@ if ( ! class_exists( 'um\core\Password' ) ) {
|
||||
*/
|
||||
class Password {
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $change_password = false;
|
||||
|
||||
/**
|
||||
|
||||
@@ -343,21 +343,18 @@ if ( ! class_exists( 'um\core\Query' ) ) {
|
||||
update_post_meta( $post_id, '_um_' . $key, $new_value );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get data
|
||||
* Get postmeta related to Ultimate Member.
|
||||
*
|
||||
* @param $key
|
||||
* @param $post_id
|
||||
* @param string $key
|
||||
* @param int $post_id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function get_attr( $key, $post_id ) {
|
||||
$meta = get_post_meta( $post_id, '_um_' . $key, true );
|
||||
return $meta;
|
||||
public function get_attr( $key, $post_id ) {
|
||||
return get_post_meta( $post_id, '_um_' . $key, true );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete data
|
||||
*
|
||||
|
||||
@@ -78,6 +78,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*/
|
||||
public $target_id = null;
|
||||
|
||||
public $updating_process = false;
|
||||
|
||||
/**
|
||||
* User constructor.
|
||||
*/
|
||||
@@ -160,8 +162,30 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
add_action( 'update_user_meta', array( &$this, 'flush_um_count_users_transient_update' ), 10, 4 );
|
||||
add_action( 'added_user_meta', array( &$this, 'flush_um_count_users_transient_add' ), 10, 4 );
|
||||
add_action( 'delete_user_meta', array( &$this, 'flush_um_count_users_transient_delete' ), 10, 4 );
|
||||
|
||||
add_action( 'update_user_metadata', array( &$this, 'avoid_banned_keys' ), 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Low-level checking to avoid updating banned user metakeys while UM Forms submission.
|
||||
*
|
||||
* @param null|bool $check Whether to allow updating metadata for the given type.
|
||||
* @param int $object_id ID of the object metadata is for.
|
||||
* @param string $meta_key Metadata key.
|
||||
*
|
||||
* @return null|bool
|
||||
*/
|
||||
public function avoid_banned_keys( $check, $object_id, $meta_key ) {
|
||||
if ( false === $this->updating_process ) {
|
||||
return $check;
|
||||
}
|
||||
|
||||
if ( in_array( $meta_key, $this->banned_keys, true ) ) {
|
||||
$check = false;
|
||||
}
|
||||
|
||||
return $check;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $meta_ids
|
||||
@@ -2104,57 +2128,53 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
um_deprecated_function( 'update_files', '2.1.0', '' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update profile
|
||||
*
|
||||
* @param $changes
|
||||
*/
|
||||
function update_profile( $changes ) {
|
||||
|
||||
$args['ID'] = $this->id;
|
||||
public function update_profile( $changes ) {
|
||||
$this->updating_process = true;
|
||||
$args['ID'] = $this->id;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
* Filters the update profile changes data.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_before_update_profile
|
||||
* @description Change update profile changes data
|
||||
* @input_vars
|
||||
* [{"var":"$changes","type":"array","desc":"User Profile Changes"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_before_update_profile', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_before_update_profile', 'my_before_update_profile', 10, 2 );
|
||||
* function my_before_update_profile( $changes, $user_id ) {
|
||||
* // your code here
|
||||
* @since 1.3.x
|
||||
* @hook um_before_update_profile
|
||||
*
|
||||
* @param {array} $changes User Profile Changes.
|
||||
* @param {int} $user_id User ID.
|
||||
*
|
||||
* @return {array} User Profile Changes.
|
||||
*
|
||||
* @example <caption>Remove some_metakey from changes where user ID equals 12.</caption>
|
||||
* function my_custom_before_update_profile( $changes, $user_id ) {
|
||||
* if ( 12 === $user_id ) {
|
||||
* unset( $changes['{some_metakey}'];
|
||||
* }
|
||||
* return $changes;
|
||||
* }
|
||||
* ?>
|
||||
* add_filter( 'um_before_update_profile', 'my_custom_before_update_profile', 10, 2 );
|
||||
*/
|
||||
$changes = apply_filters( 'um_before_update_profile', $changes, $args['ID'] );
|
||||
|
||||
foreach ( $changes as $key => $value ) {
|
||||
if ( in_array( $key, $this->banned_keys ) ) {
|
||||
if ( in_array( $key, $this->banned_keys, true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! in_array( $key, $this->update_user_keys ) ) {
|
||||
if ( ! in_array( $key, $this->update_user_keys, true ) ) {
|
||||
if ( $value === 0 ) {
|
||||
update_user_meta( $this->id, $key, '0' );
|
||||
} else {
|
||||
update_user_meta( $this->id, $key, $value );
|
||||
}
|
||||
} else {
|
||||
$args[ $key ] = $changes[ $key ];
|
||||
$args[ $key ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// update user
|
||||
if ( count( $args ) > 1 ) {
|
||||
//if isset roles argument validate role to properly for security reasons
|
||||
@@ -2162,14 +2182,14 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
global $wp_roles;
|
||||
|
||||
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), UM()->roles()->get_editable_user_roles() );
|
||||
if ( in_array( $args['role'], $exclude_roles ) ) {
|
||||
if ( in_array( $args['role'], $exclude_roles, true ) ) {
|
||||
unset( $args['role'] );
|
||||
}
|
||||
}
|
||||
|
||||
wp_update_user( $args );
|
||||
}
|
||||
|
||||
$this->updating_process = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1012
-989
File diff suppressed because it is too large
Load Diff
+20
-2
@@ -7,7 +7,7 @@ Tags: community, member, membership, user-profile, user-registration
|
||||
Requires PHP: 5.6
|
||||
Requires at least: 5.5
|
||||
Tested up to: 6.2
|
||||
Stable tag: 2.6.3
|
||||
Stable tag: 2.6.4
|
||||
License: GNU Version 2 or Any Later Version
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
@@ -163,10 +163,23 @@ No, you do not need to use our plugin’s login or registration pages and can us
|
||||
* To learn more about version 2.1 please see this [docs](https://docs.ultimatemember.com/article/1512-upgrade-2-1-0)
|
||||
* UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin
|
||||
|
||||
= 2.6.4: July xx, 2023 =
|
||||
= 2.6.5: July xx, 2023 =
|
||||
|
||||
|
||||
|
||||
= 2.6.4: June 27, 2023 =
|
||||
|
||||
* Enhancements:
|
||||
|
||||
- Added: Avoid using `extract()` function and increase supporting WordPress Code Standards
|
||||
|
||||
* Bugfixes:
|
||||
|
||||
- Fixed: PHP8.2 PHP errors (deprecated, warnings, etc.)
|
||||
- Fixed: Using `str_contains()` in template override
|
||||
- Fixed: Override templates and custom path for 'members-grid.php', 'members-header.php', 'members-list.php', 'members-pagination.php', 'searchform.php', 'login-to-view.php', 'profile/comments.php', 'profile/comments-single.php', 'profile/posts.php', 'profile/posts-single.php', 'modal/um_upload_single.php', 'modal/um_view_photo.php' template files
|
||||
- Fixed: Custom emails data "--- UM Email HTML Templates ---" in Install info
|
||||
|
||||
= 2.6.3: June 14, 2023 =
|
||||
|
||||
* Enhancements:
|
||||
@@ -3224,3 +3237,8 @@ Credits to "James Golovich http://www.pritect.net" for the security checks
|
||||
= 1.0.0: January, 2015 =
|
||||
|
||||
* First official release!
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 2.6.4 =
|
||||
This version fixes a security related bug. Upgrade immediately.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the account page
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/account.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/account.php
|
||||
*
|
||||
* Page: "Account"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the GDPR checkbox in register form
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/gdpr-register.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/gdpr-register.php
|
||||
*
|
||||
* Page: "Register"
|
||||
* Call: function display_option()
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the login form
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/login.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/login.php
|
||||
*
|
||||
* Page: "Login"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the logout
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/logout.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/logout.php
|
||||
*
|
||||
* Page: "Logout"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the members directory
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/members.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/members.php
|
||||
*
|
||||
* Page: "Members"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the message after registration process
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/message.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/message.php
|
||||
*
|
||||
* Call: function parse_shortcode_args()
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the password change
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/password-change.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/password-change.php
|
||||
*
|
||||
* Call: function ultimatemember_password()
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the password reset
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/password-reset.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/password-reset.php
|
||||
*
|
||||
* Call: function ultimatemember_password()
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the profile page
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/profile.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/profile.php
|
||||
*
|
||||
* Page: "Profile"
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Template for the register page
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/register.php
|
||||
* This template can be overridden by copying it to yourtheme/ultimate-member/templates/register.php
|
||||
*
|
||||
* Page: "Register"
|
||||
*
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
Plugin Name: Ultimate Member
|
||||
Plugin URI: http://ultimatemember.com/
|
||||
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
||||
Version: 2.6.4-alpha
|
||||
Version: 2.6.5-alpha
|
||||
Author: Ultimate Member
|
||||
Author URI: http://ultimatemember.com/
|
||||
Text Domain: ultimate-member
|
||||
|
||||
Reference in New Issue
Block a user