Merge branch 'development/2.6.1' into feature/um-blocks

This commit is contained in:
Nikita Sinelnikov
2023-05-23 11:14:37 +03:00
committed by GitHub
77 changed files with 2712 additions and 1488 deletions
@@ -46,6 +46,20 @@
text-align: center;
}
.wp-list-table.templates .column-core_version {
width: 100px;
text-align: center;
}
.wp-list-table.templates .column-theme_version {
width: 100px;
text-align: center;
}
.wp-list-table.templates .column-status {
width: 260px;
}
th.column-email.column-primary {
padding-left: 48px;
}
@@ -213,6 +227,16 @@ th.column-email.column-primary {
.um-small-field {
width:50%;
}
.wp-list-table.templates .column-core_version {
width: auto;
text-align: left;
}
.wp-list-table.templates .column-theme_version {
width: auto;
text-align: left;
}
}
/*
@@ -243,4 +267,4 @@ th.column-email.column-primary {
.um_setting_ajax_button_response.complete {
color:darkgreen;
font-style: italic;
}
}
+55 -18
View File
@@ -80,6 +80,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
add_action( 'um_admin_do_action__um_can_register_notice', array( &$this, 'um_hide_notice' ) );
add_action( 'um_admin_do_action__um_hide_exif_notice', array( &$this, 'um_hide_notice' ) );
add_action( 'um_admin_do_action__user_action', array( &$this, 'user_action' ) );
add_action( 'um_admin_do_action__check_templates_version', array( &$this, 'check_templates_version' ) );
add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) );
@@ -1745,48 +1746,55 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
*
* @param $action
*/
function duplicate_form( $action ) {
if ( ! is_admin() || ! current_user_can('manage_options') ) {
public function duplicate_form( $action ) {
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
die();
}
if ( ! isset( $_REQUEST['post_id'] ) || ! is_numeric( $_REQUEST['post_id'] ) ) {
if ( empty( $_REQUEST['post_id'] ) || empty( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], "um-duplicate_form{$_REQUEST['post_id']}" ) ) {
die();
}
if ( ! is_numeric( $_REQUEST['post_id'] ) ) {
die();
}
$post_id = absint( $_REQUEST['post_id'] );
$n = array(
'post_type' => 'um_form',
'post_title' => sprintf( __( 'Duplicate of %s', 'ultimate-member' ), get_the_title( $post_id ) ),
'post_status' => 'publish',
'post_author' => get_current_user_id(),
'post_type' => 'um_form',
// translators: %s - Form title
'post_title' => sprintf( __( 'Duplicate of %s', 'ultimate-member' ), get_the_title( $post_id ) ),
'post_status' => 'publish',
'post_author' => get_current_user_id(),
);
$n_id = wp_insert_post( $n );
$n_fields = get_post_custom( $post_id );
foreach ( $n_fields as $key => $value ) {
if ( $key == '_um_custom_fields' ) {
$the_value = unserialize( $value[0] );
if ( '_um_custom_fields' === $key ) {
$the_value = maybe_unserialize( $value[0] );
} else {
$the_value = $value[0];
}
update_post_meta( $n_id, $key, $the_value );
}
delete_post_meta( $n_id, '_um_core' );
$url = admin_url( 'edit.php?post_type=um_form' );
$url = add_query_arg( 'update', 'form_duplicated', $url );
exit( wp_redirect( $url ) );
$url = add_query_arg(
array(
'post_type' => 'um_form',
'update' => 'form_duplicated',
),
admin_url( 'edit.php' )
);
wp_safe_redirect( $url );
exit;
}
/**
* Action to hide notices in admin
*
@@ -1801,7 +1809,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
exit( wp_redirect( remove_query_arg( 'um_adm_action' ) ) );
}
/**
* Various user actions
*
@@ -1868,6 +1875,36 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
}
/**
* Manual check templates versions
*
* @param $action
*/
public function check_templates_version( $action ) {
$templates = UM()->admin_settings()->get_override_templates( true );
$out_date = false;
foreach ( $templates as $template ) {
if ( 0 === $template['status_code'] ) {
$out_date = true;
break;
}
}
if ( false === $out_date ) {
delete_option( 'um_override_templates_outdated' );
}
$url = add_query_arg(
array(
'page' => 'um_options',
'tab' => 'override_templates',
),
admin_url( 'admin.php' )
);
wp_safe_redirect( $url );
exit;
}
/**
* Add any custom links to plugin page
+10 -8
View File
@@ -1,9 +1,9 @@
<?php
namespace um\admin\core;
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
@@ -14,17 +14,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
*/
class Admin_Builder {
/**
* @var int
*/
public $form_id;
/**
* @var
* @var array
*/
var $form_id;
public $global_fields = array();
/**
* Admin_Builder constructor.
*/
function __construct() {
public function __construct() {
add_action( 'um_admin_field_modal_header', array( &$this, 'add_message_handlers' ) );
add_action( 'um_admin_field_modal_footer', array( &$this, 'add_conditional_support' ), 10, 4 );
add_filter( 'um_admin_builder_skip_field_validation', array( &$this, 'skip_field_validation' ), 10, 3 );
@@ -33,7 +36,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
add_filter( 'um_admin_field_update_error_handling', array( &$this, 'um_admin_field_update_error_handling' ), 1, 2 );
}
/**
* Apply a filter to handle errors for field updating in backend
*
+11 -5
View File
@@ -104,7 +104,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
return $actions;
}
/**
* Duplicate a form
*
@@ -112,13 +111,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
*
* @return string
*/
function duplicate_uri( $id ) {
$url = add_query_arg('um_adm_action', 'duplicate_form', admin_url('edit.php?post_type=um_form') );
$url = add_query_arg('post_id', $id, $url);
private function duplicate_uri( $id ) {
$url = add_query_arg(
array(
'post_type' => 'um_form',
'um_adm_action' => 'duplicate_form',
'post_id' => $id,
'nonce' => wp_create_nonce( "um-duplicate_form{$id}" ),
),
admin_url( 'edit.php' )
);
return $url;
}
/**
* Custom columns for Form
*
+10 -1
View File
@@ -123,10 +123,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
'href' => array(),
'title' => array(),
'target' => array(),
'class' => array(),
),
'i' => array(
'class' => array(),
),
'span' => array(
'class' => array(),
),
'br' => array(),
'em' => array(),
'strong' => array(),
'strong' => array(
'style' => array()
),
);
$data['value'] = wp_kses( $data['value'], $arr_kses );
}
+27 -7
View File
@@ -34,18 +34,38 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
private $custom_nonce_added = false;
var $init_icon = false;
public $init_icon = false;
/**
* @var bool
*/
public $in_edit = false;
/**
* @var null
*/
public $edit_mode_value = null;
/**
* @var array
*/
public $edit_array = array();
/**
* @var array
*/
public $postmeta = array();
/**
* @var bool
*/
public $is_loaded = false;
/**
* Admin_Metabox constructor.
*/
function __construct() {
$this->in_edit = false;
$this->edit_mode_value = null;
$this->edit_array = [];
add_action( 'admin_head', array( &$this, 'admin_head' ), 9);
public function __construct() {
add_action( 'admin_head', array( &$this, 'admin_head' ), 9 );
add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9 );
add_action( 'load-post.php', array( &$this, 'add_metabox' ), 9 );
@@ -52,6 +52,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$this->extensions_page();
$this->template_version();
// removed for now to avoid the bad reviews
//$this->reviews_notice();
@@ -714,6 +716,37 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
}
/**
* Check Templates Versions notice
*/
public function template_version() {
if ( true === (bool) get_option( 'um_override_templates_outdated' ) ) {
$link = admin_url( 'admin.php?page=um_options&tab=override_templates' );
ob_start();
?>
<p>
<?php
// translators: %s override templates page link.
echo wp_kses( sprintf( __( 'Your templates are out of date. Please visit <a href="%s">override templates status page</a> and update templates.', 'ultimate-member' ), $link ), UM()->get_allowed_html( 'admin_notice' ) );
?>
</p>
<?php
$message = ob_get_clean();
UM()->admin()->notices()->add_notice(
'um_override_templates_notice',
array(
'class' => 'error',
'message' => $message,
'dismissible' => false,
),
10
);
}
}
function dismiss_notice() {
UM()->admin()->check_ajax_nonce();
+199 -5
View File
@@ -64,10 +64,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
add_filter( 'um_settings_section_install_info__content', array( $this, 'settings_install_info_tab' ), 10, 2 );
//custom content for override templates tab
add_action( 'plugins_loaded', array( $this, 'um_check_template_version' ), 10 );
add_filter( 'um_settings_section_override_templates__content', array( $this, 'settings_override_templates_tab' ), 10, 2 );
add_filter( 'um_settings_structure', array( $this, 'sorting_licenses_options' ), 9999, 1 );
//save handlers
add_action( 'admin_init', array( $this, 'save_settings_handler' ), 10 );
@@ -75,10 +77,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
add_action( 'um_settings_before_save', array( $this, 'check_permalinks_changes' ) );
add_action( 'um_settings_save', array( $this, 'on_settings_save' ) );
add_filter( 'um_change_settings_before_save', array( $this, 'save_email_templates' ) );
//save licenses options
add_action( 'um_settings_before_save', array( $this, 'before_licenses_save' ) );
add_action( 'um_settings_save', array( $this, 'licenses_save' ) );
@@ -440,7 +440,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$duplicates = array();
$taxonomies_options = array();
$exclude_taxonomies = UM()->excluded_taxonomies();
$all_taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
$all_taxonomies = get_taxonomies( array( 'public' => true, 'show_ui' => true ), 'objects' );
foreach ( $all_taxonomies as $key => $taxonomy ) {
if ( in_array( $key, $exclude_taxonomies, true ) ) {
continue;
@@ -1839,6 +1839,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
),
),
),
'override_templates' => array(
'title' => __( 'Override templates', 'ultimate-member' ),
'fields' => array(
array(
'type' => 'override_templates',
),
),
),
)
);
@@ -1966,7 +1974,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
*/
do_action( "um_settings_page_before_" . $current_tab . "_" . $current_subtab . "_content" );
if ( in_array( $current_tab, apply_filters('um_settings_custom_tabs', array( 'licenses', 'install_info' ) ) ) || in_array( $current_subtab, apply_filters( 'um_settings_custom_subtabs', array(), $current_tab ) ) ) {
if ( in_array( $current_tab, apply_filters('um_settings_custom_tabs', array( 'licenses', 'install_info', 'override_templates' ) ) ) || in_array( $current_subtab, apply_filters( 'um_settings_custom_subtabs', array(), $current_tab ) ) ) {
/**
* UM hook
@@ -3007,6 +3015,192 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
return $section;
}
/**
* Periodically checking the versions of templates.
*
* @since 2.6.1
*
* @return void
*/
public function um_check_template_version() {
$um_check_version = get_transient( 'um_check_template_versions' );
if ( false === $um_check_version ) {
$this->get_override_templates();
}
}
/**
* HTML for Settings > Override Templates tab.
* @return void
*/
public function settings_override_templates_tab() {
$um_check_version = get_transient( 'um_check_template_versions' );
?>
<p class="description" style="margin: 20px 0 0 0;">
<a href="<?php echo esc_url( add_query_arg( 'um_adm_action', 'check_templates_version' ) ); ?>" class="button" style="margin-right: 10px;">
<?php esc_html_e( 'Re-check templates', 'ultimate-member' ); ?>
</a>
<?php
if ( false !== $um_check_version ) {
// translators: %s: Last checking templates time.
echo esc_html( sprintf( __( 'Last update: %s. You could re-check changes manually.', 'ultimate-member' ), wp_date( get_option( 'date_format', 'Y-m-d' ) . ' ' . get_option( 'time_format', 'H:i:s' ), $um_check_version ) ) );
} else {
esc_html_e( 'Templates haven\'t check yet. You could check changes manually.', 'ultimate-member' );
}
?>
</p>
<p class="description" style="margin: 20px 0 0 0;">
<?php
/** @noinspection HtmlUnknownTarget */
// translators: %s: Link to the docs article.
echo wp_kses( sprintf( __( 'You may get more details about overriding templates <a href="%s" target="_blank">here</a>.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map' ), UM()->get_allowed_html( 'admin_notice' ) );
?>
</p>
<?php
include_once um_path . 'includes/admin/core/list-tables/version-template-list-table.php';
}
/**
* @param $get_list boolean
*
* @return array|void
*/
public function get_override_templates( $get_list = false ) {
$outdated_files = array();
$scan_files['um'] = $this->scan_template_files( um_path . '/templates/' );
$scan_files = apply_filters( 'um_override_templates_scan_files', $scan_files );
$out_date = false;
set_transient( 'um_check_template_versions', time(), 12 * HOUR_IN_SECONDS );
foreach ( $scan_files as $key => $files ) {
foreach ( $files as $file ) {
if ( ! str_contains( $file, 'email/' ) ) {
$located = array();
$located = apply_filters( "um_override_templates_get_template_path__{$key}", $located, $file );
if ( ! empty( $located ) ) {
$theme_file = $located['theme'];
} elseif ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) {
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $file;
} else {
$theme_file = false;
}
if ( ! empty( $theme_file ) ) {
$core_file = $file;
if ( ! empty( $located ) ) {
$core_path = $located['core'];
$core_file_path = stristr( $core_path, 'wp-content' );
} else {
$core_path = um_path . '/templates/' . $core_file;
$core_file_path = stristr( um_path . 'templates/' . $core_file, 'wp-content' );
}
$core_version = $this->get_file_version( $core_path );
$theme_version = $this->get_file_version( $theme_file );
$status = esc_html__( 'Theme version up to date', 'ultimate-member' );
$status_code = 1;
if ( version_compare( $theme_version, $core_version, '<' ) ) {
$status = esc_html__( 'Theme version is out of date', 'ultimate-member' );
$status_code = 0;
}
if ( '' === $theme_version ) {
$status = esc_html__( 'Theme version is empty', 'ultimate-member' );
$status_code = 0;
}
if ( 0 === $status_code ) {
$out_date = true;
update_option( 'um_override_templates_outdated', true );
}
$outdated_files[] = array(
'core_version' => $core_version,
'theme_version' => $theme_version,
'core_file' => $core_file_path,
'theme_file' => stristr( $theme_file, 'wp-content' ),
'status' => $status,
'status_code' => $status_code,
);
}
}
}
}
if ( false === $out_date ) {
delete_option( 'um_override_templates_outdated' );
}
update_option( 'um_template_statuses', $outdated_files );
if ( true === $get_list ) {
return $outdated_files;
}
}
/**
* Scan the template files.
*
* @param string $template_path Path to the template directory.
* @return array
*/
public static function scan_template_files( $template_path ) {
$files = @scandir( $template_path ); // @codingStandardsIgnoreLine.
$result = array();
if ( ! empty( $files ) ) {
foreach ( $files as $value ) {
if ( ! in_array( $value, array( '.', '..' ), true ) ) {
if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) {
$sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
foreach ( $sub_files as $sub_file ) {
$result[] = $value . DIRECTORY_SEPARATOR . $sub_file;
}
} else {
$result[] = $value;
}
}
}
}
return $result;
}
/**
* @param $file string
*
* @return string
*/
public static function get_file_version( $file ) {
// Avoid notices if file does not exist.
if ( ! file_exists( $file ) ) {
return '';
}
// We don't need to write to the file, so just open for reading.
$fp = fopen( $file, 'r' ); // @codingStandardsIgnoreLine.
// Pull only the first 8kiB of the file in.
$file_data = fread( $fp, 8192 ); // @codingStandardsIgnoreLine.
// PHP will close file handle, but we are good citizens.
fclose( $fp ); // @codingStandardsIgnoreLine.
// Make sure we catch CR-only line endings.
$file_data = str_replace( "\r", "\n", $file_data );
$version = '';
if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) {
$version = _cleanup_header_comment( $match[1] );
}
return $version;
}
/**
* @param $html
+6 -5
View File
@@ -14,14 +14,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
*/
class Admin_Users {
/**
* @var string
*/
public $custom_role = 'um_role';
/**
* Admin_Users constructor.
*/
function __construct() {
$this->custom_role = 'um_role';
public function __construct() {
add_action( 'restrict_manage_users', array( &$this, 'restrict_manage_users' ) );
add_filter( 'user_row_actions', array( &$this, 'user_row_actions' ), 10, 2 );
@@ -273,7 +274,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
$submitted = get_user_meta( $user_id, 'submitted', true );
if ( ! empty( $submitted ) ) {
$actions['view_info'] = '<a href="javascript:void(0);" data-modal="UM_preview_registration" data-modal-size="smaller"
$actions['view_info'] = '<a href="javascript:void(0);" data-modal="UM_preview_registration" data-modal-size="smaller"
data-dynamic-content="um_admin_review_registration" data-arg1="' . esc_attr( $user_id ) . '" data-arg2="edit_registration">' . __( 'Info', 'ultimate-member' ) . '</a>';
}
@@ -0,0 +1,215 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class UM_Versions_List_Table
*/
class UM_Versions_List_Table extends WP_List_Table {
/**
* @var string
*/
public $no_items_message = '';
/**
* @var array
*/
public $columns = array();
/**
* UM_Versions_List_Table constructor.
*
* @param array $args
*/
public function __construct( $args = array() ) {
$args = wp_parse_args(
$args,
array(
'singular' => __( 'item', 'ultimate-member' ),
'plural' => __( 'items', 'ultimate-member' ),
'ajax' => false,
)
);
$this->no_items_message = $args['plural'] . ' ' . __( 'not found.', 'ultimate-member' );
parent::__construct( $args );
}
/**
* @param callable $name
* @param array $arguments
*
* @return mixed
*/
public function __call( $name, $arguments ) {
return call_user_func_array( array( $this, $name ), $arguments );
}
/**
*
*/
public function prepare_items() {
$screen = $this->screen;
$columns = $this->get_columns();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array( $columns, array(), $sortable );
$templates = get_option( 'um_template_statuses', array() );
$templates = is_array( $templates ) ? $templates : array();
@uasort(
$templates,
function ( $a, $b ) {
if ( strtolower( $a['status_code'] ) === strtolower( $b['status_code'] ) ) {
return 0;
}
return ( strtolower( $a['status_code'] ) < strtolower( $b['status_code'] ) ) ? -1 : 1;
}
);
$per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 );
$paged = $this->get_pagenum();
$this->items = array_slice( $templates, ( $paged - 1 ) * $per_page, $per_page );
$this->set_pagination_args(
array(
'total_items' => count( $templates ),
'per_page' => $per_page,
)
);
}
/**
* @param object $item
* @param string $column_name
*
* @return string
*/
public function column_default( $item, $column_name ) {
if ( isset( $item[ $column_name ] ) ) {
return $item[ $column_name ];
} else {
return '';
}
}
/**
*
*/
public function no_items() {
echo $this->no_items_message;
}
/**
* @param array $args
*
* @return $this
*/
public function set_columns( $args = array() ) {
$this->columns = $args;
return $this;
}
/**
* @return array
*/
public function get_columns() {
return $this->columns;
}
/**
* @param $item
*
* @return string
*/
public function column_template( $item ) {
$output = esc_html__( 'Core path - ', 'ultimate-member' );
$output .= $item['core_file'] . '<br>';
$output .= esc_html__( 'Theme path - ', 'ultimate-member' );
$output .= $item['theme_file'];
return $output;
}
/**
* @param $item
*
* @return string
*/
public function column_core_version( $item ) {
return $item['core_version'];
}
/**
* @param $item
*
* @return string
*/
public function column_theme_version( $item ) {
return $item['theme_version'] ? $item['theme_version'] : '-';
}
/**
* @param $item
*
* @return string
*/
public function column_status( $item ) {
$icon = 1 === $item['status_code'] ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt';
return $item['status'] . ' <span class="dashicons um-notification-status ' . esc_attr( $icon ) . '"></span>';
}
}
$list_table = new UM_Versions_List_Table(
array(
'singular' => __( 'Template', 'ultimate-member' ),
'plural' => __( 'Templates', 'ultimate-member' ),
'ajax' => false,
)
);
/**
* UM hook
*
* @type filter
* @title um_versions_templates_columns
* @description Version Templates List Table columns
* @input_vars
* [{"var":"$columns","type":"array","desc":"Columns"}]
* @change_log
* ["Since: 2.0"]
* @usage add_filter( 'um_versions_templates_columns', 'function_name', 10, 1 );
* @example
* <?php
* add_filter( 'um_versions_templates_columns', 'um_versions_templates_columns', 10, 1 );
* function um_versions_templates_columns( $columns ) {
* // your code here
* $columns['my-custom-column'] = 'My Custom Column';
* return $columns;
* }
* ?>
*/
$columns = apply_filters(
'um_versions_templates_columns',
array(
'template' => __( 'Template', 'ultimate-member' ),
'core_version' => __( 'Core version', 'ultimate-member' ),
'theme_version' => __( 'Theme version', 'ultimate-member' ),
'status' => __( 'Status', 'ultimate-member' ),
)
);
$list_table->set_columns( $columns );
$list_table->prepare_items();
?>
<form action="" method="get" name="um-settings-template-versions" id="um-settings-template-versions">
<input type="hidden" name="page" value="um_options" />
<input type="hidden" name="tab" value="override_templates" />
<?php $list_table->display(); ?>
</form>
+21 -29
View File
@@ -17,83 +17,75 @@ if ( ! class_exists( 'um\Config' ) ) {
*/
class Config {
/**
* @var array
*/
public $core_forms;
/**
* @var array
*/
var $core_forms;
/**
* @var array
*/
var $core_directories;
public $core_directories;
/**
* @var mixed|void
*/
var $core_pages;
public $core_pages;
/**
* @var array
*/
var $core_directory_meta = array();
public $core_directory_meta = array();
/**
* @var array
*/
var $core_global_meta_all;
public $core_global_meta_all;
/**
* @var mixed|void
*/
var $core_form_meta_all;
public $core_form_meta_all;
/**
* @var array
*/
var $core_form_meta = array();
public $core_form_meta = array();
/**
* @var
*/
var $perms;
public $perms;
/**
* @var
*/
var $nonadmin_perms;
public $nonadmin_perms;
/**
* @var mixed|void
*/
var $email_notifications;
public $email_notifications;
/**
* @var mixed|void
*/
var $settings_defaults;
public $settings_defaults;
/**
* @var array
*/
var $permalinks;
public $permalinks;
/**
* @var array|array[]
*/
public $default_roles_metadata = array();
/**
* Config constructor.
*/
function __construct() {
public function __construct() {
$this->core_forms = array(
'register',
'login',
@@ -457,7 +449,7 @@ if ( ! class_exists( 'um\Config' ) ) {
'If you did not make this change and believe your {site_name} account has been compromised, please contact us at the following email address: {admin_email}<br /><br />' .
'Thanks,<br />' .
'{site_name}',
'description' => __('Whether to send the user an email when he request to reset password (Recommended, please keep on)','ultimate-member'),
'description' => __('Whether to send the user an email when he requests to reset password (Recommended, please keep on)','ultimate-member'),
'recipient' => 'user',
'default_active' => true
),
+5 -1
View File
@@ -71,6 +71,10 @@ if ( ! class_exists( 'UM' ) ) {
*/
public $is_permalinks;
/**
* @var null|string
*/
public $honeypot = null;
/**
* Main UM Instance
@@ -82,7 +86,7 @@ if ( ! class_exists( 'UM' ) ) {
* @see UM()
* @return UM - Main instance
*/
static public function instance() {
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
self::$instance->_um_construct();
+20 -15
View File
@@ -13,33 +13,44 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
*/
class Builtin {
/**
* @var array
*/
public $predefined_fields = array();
/**
* @var array
*/
public $all_user_fields = array();
/**
* @var array
*/
var $all_user_fields = array();
public $core_fields = array();
/**
* @var array
*/
var $core_fields = array();
public $saved_fields = array();
/**
* @var array
*/
public $custom_fields = array();
/**
* @var array
*/
public $fields_dropdown = array();
/**
* Builtin constructor.
*/
function __construct() {
public function __construct() {
add_action( 'init', array( &$this, 'set_core_fields' ), 1 );
add_action( 'init', array( &$this, 'set_predefined_fields' ), 1 );
add_action( 'init', array( &$this, 'set_custom_fields' ), 1 );
$this->saved_fields = get_option( 'um_fields' );
$this->saved_fields = get_option( 'um_fields', array() );
}
@@ -1337,26 +1348,20 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
* Custom Fields
*/
function set_custom_fields() {
if ( is_array( $this->saved_fields ) ) {
$this->custom_fields = $this->saved_fields;
} else {
$this->custom_fields = '';
$this->custom_fields = array();
}
$custom = $this->custom_fields;
$custom = $this->custom_fields;
$predefined = $this->predefined_fields;
if ( is_array( $custom ) ){
if ( is_array( $custom ) ) {
$this->all_user_fields = array_merge( $predefined, $custom );
} else {
$this->all_user_fields = $predefined;
}
}
+45 -8
View File
@@ -18,7 +18,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
/**
* @var string
*/
var $set_mode = '';
public $set_mode = '';
/**
@@ -26,17 +26,53 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*/
public $set_id = null;
/**
* @var bool
*/
public $editing = false;
/**
* @var bool
*/
public $viewing = false;
/**
* @var int
*/
public $timestamp = null;
/**
* @var array
*/
public $global_args = array();
/**
* @var array
*/
public $field_icons = array();
/**
* @var array
*/
public $get_fields = array();
/**
* @var array
*/
public $rows = array();
/**
* @var array
*/
public $fields = array();
/**
* Fields constructor.
*/
function __construct() {
$this->editing = false;
$this->viewing = false;
public function __construct() {
$this->timestamp = current_time( 'timestamp' );
}
/**
* Standard checkbox field
*
@@ -248,7 +284,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
if ( isset( $fields[ $id ] ) ) {
$condition_fields = get_option( 'um_fields' );
$condition_fields = get_option( 'um_fields', array() );
if( ! is_array( $condition_fields ) ) $condition_fields = array();
@@ -2390,8 +2426,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
$field_name = $key . $form_suffix;
$field_value = htmlspecialchars( $this->field_value( $key, $default, $data ) );
$field_name = $key . $form_suffix;
$field_value = $this->field_value( $key, $default, $data );
$field_value = ! is_null( $field_value ) ? htmlspecialchars( $field_value ) : null;
$output .= '<input ' . $disabled . ' autocomplete="' . esc_attr( $autocomplete ) . '" class="' . $this->get_class( $key, $data ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_name ) . '" value="' . esc_attr( $field_value ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
+25 -12
View File
@@ -13,30 +13,45 @@ if ( ! class_exists( 'um\core\Files' ) ) {
*/
class Files {
/**
* @var
*/
public $upload_temp;
/**
* @var
*/
var $upload_temp;
public $upload_baseurl;
/**
* @var
*/
var $upload_baseurl;
public $upload_basedir;
/**
* @var
* @var array|array[]
*/
var $upload_basedir;
public $fonticon = array();
/**
* @var null|string
*/
public $upload_dir = null;
/**
* @var null
*/
public $upload_temp_url = null;
/**
* @var string
*/
public $default_file_fonticon = 'um-faicon-file-o';
/**
* Files constructor.
*/
function __construct() {
public function __construct() {
$this->setup_paths();
add_action( 'template_redirect', array( &$this, 'download_routing' ), 1 );
@@ -63,8 +78,6 @@ if ( ! class_exists( 'um\core\Files' ) ) {
'tif' => array('icon' => 'um-icon-image' ),
'tiff' => array('icon' => 'um-icon-image' ),
);
$this->default_file_fonticon = 'um-faicon-file-o';
}
@@ -326,8 +339,8 @@ if ( ! class_exists( 'um\core\Files' ) ) {
$user_id = empty( $_REQUEST['user_id'] ) ? get_current_user_id() : absint( $_REQUEST['user_id'] );
UM()->fields()->set_id = filter_input( INPUT_POST, 'set_id', FILTER_SANITIZE_NUMBER_INT );
UM()->fields()->set_mode = filter_input( INPUT_POST, 'set_mode', FILTER_SANITIZE_STRING );
UM()->fields()->set_id = isset( $_POST['set_id'] ) ? absint( $_POST['set_id'] ) : null;
UM()->fields()->set_mode = isset( $_POST['set_mode'] ) ? sanitize_text_field( $_POST['set_mode'] ) : null;
if ( UM()->fields()->set_mode != 'register' && ! UM()->roles()->um_current_user_can( 'edit', $user_id ) ) {
$ret['error'] = esc_js( __( 'You have no permission to edit this user', 'ultimate-member' ) );
+21 -17
View File
@@ -13,43 +13,47 @@ if ( ! class_exists( 'um\core\Form' ) ) {
*/
class Form {
/**
* @var null
*/
public $form_suffix;
public $form_suffix = null;
/**
* @var
*/
var $form_id;
public $form_id;
/**
* @var null
*/
var $post_form = null;
public $post_form = null;
/**
* @var null
*/
public $nonce = null;
var $nonce = null;
/**
* @var null
*/
public $errors = null;
/**
* @var null
*/
public $processing = null;
/**
* @var array
*/
public $all_fields = array();
/**
* Form constructor.
*/
function __construct() {
$this->form_suffix = null;
$this->errors = null;
$this->processing = null;
public function __construct() {
add_action( 'template_redirect', array( &$this, 'form_init' ), 2 );
add_action( 'init', array( &$this, 'field_declare' ), 10 );
}
+38 -24
View File
@@ -1,37 +1,53 @@
<?php
namespace um\core;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\core\Mail' ) ) {
/**
* Class Mail
* @package um\core
*/
class Mail {
/**
* @var array
*/
public $email_templates = array();
/**
* @var array
*/
var $email_templates = array();
public $path_by_slug = array();
/**
* @var array
*/
var $path_by_slug = array();
public $attachments = array();
/**
* @var string
*/
public $headers = '';
/**
* @var string
*/
public $subject = '';
/**
* @var string
*/
public $message = '';
/**
* Mail constructor.
*/
function __construct() {
public function __construct() {
//mandrill compatibility
add_filter( 'mandrill_nl2br', array( &$this, 'mandrill_nl2br' ) );
add_action( 'plugins_loaded', array( &$this, 'init_paths' ), 99 );
@@ -349,12 +365,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
}
echo $plain_email_template;
}
$message = ob_get_clean();
/**
* UM hook
*
@@ -387,7 +401,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
return um_convert_tags( $message, $args );
}
/**
* Send Email function
*
@@ -395,20 +408,27 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
* @param null $template
* @param array $args
*/
function send( $email, $template, $args = array() ) {
public function send( $email, $template, $args = array() ) {
if ( ! is_email( $email ) ) {
return;
}
if ( UM()->options()->get( $template . '_on' ) != 1 ) {
if ( ! empty( UM()->options()->get( $template . '_on' ) ) ) {
return;
}
$hook_disabled = apply_filters( 'um_disable_email_notification_sending', false, $email, $template, $args );
if ( false !== $hook_disabled ) {
return;
}
do_action( 'um_before_email_notification_sending', $email, $template, $args );
$this->attachments = array();
$this->headers = 'From: '. stripslashes( UM()->options()->get('mail_from') ) .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
$this->headers = 'From: ' . stripslashes( UM()->options()->get( 'mail_from' ) ) . ' <' . UM()->options()->get( 'mail_from_addr' ) . '>' . "\r\n";
add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ), 10, 1 );
add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ), 10, 1 );
/**
* UM hook
@@ -432,15 +452,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
* }
* ?>
*/
add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ), 10, 1 );
add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ), 10, 1 );
$subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template );
$subject = wp_unslash( um_convert_tags( $subject, $args ) );
$subject = wp_unslash( um_convert_tags( $subject , $args ) );
$this->subject = html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' );
$this->subject = html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' );
$this->message = $this->prepare_template( $template, $args );
@@ -456,7 +471,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
do_action( 'um_after_email_notification_sending', $email, $template, $args );
}
/**
* @param $template_name
*
+21 -1
View File
@@ -634,13 +634,16 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
if ( isset( $_GET[ 'filter_' . $attrs['parent_dropdown_relationship'] . '_' . $unique_hash ] ) ) {
$_POST['parent_option_name'] = $attrs['parent_dropdown_relationship'];
$_POST['parent_option'] = explode( '||', filter_input( INPUT_GET, 'filter_' . $attrs['parent_dropdown_relationship'] . '_' . $unique_hash ) );
$parent_option_value = sanitize_text_field( $_GET[ 'filter_' . $attrs['parent_dropdown_relationship'] . '_' . $unique_hash ] );
$_POST['parent_option'] = explode( '||', $parent_option_value );
}
}
$attrs['custom_dropdown_options_source'] = wp_unslash( $attrs['custom_dropdown_options_source'] );
$ajax_source = apply_filters( "um_custom_dropdown_options_source__{$filter}", $attrs['custom_dropdown_options_source'], $attrs );
$custom_dropdown .= ' data-um-ajax-source="' . esc_attr( $ajax_source ) . '" ';
$attrs['options'] = UM()->fields()->get_options_from_callback( $attrs, $attrs['type'] );
@@ -1580,6 +1583,17 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$meta_value = '%' . $wpdb->esc_like( $search ) . '%';
$search_meta = $wpdb->prepare( '%s', $meta_value );
preg_match( '~(?<=\{)(.*?)(?=\})~', $search_meta, $matches, PREG_OFFSET_CAPTURE, 0 );
// workaround for standard mySQL hashes which are used by $wpdb->prepare instead of the %symbol
// sometimes it breaks error for strings like that wp_postmeta.meta_value LIKE '{12f209b48a89eeab33424902879d05d503f251ca8812dde03b59484a2991dc74}AMS{12f209b48a89eeab33424902879d05d503f251ca8812dde03b59484a2991dc74}'
// {12f209b48a89eeab33424902879d05d503f251ca8812dde03b59484a2991dc74} isn't applied by the `preg_replace()` below
if ( $matches[0][0] ) {
$search_meta = str_replace( '{' . $matches[0][0] . '}', '#%&', $search_meta );
$sql['where'] = str_replace( '{' . $matches[0][0] . '}', '#%&', $sql['where'] );
}
// str_replace( '/', '\/', wp_slash( $search_meta ) ) means that we add backslashes to special symbols + add backslash to slash(/) symbol for proper regular pattern.
preg_match(
'/^(.*).meta_value LIKE ' . str_replace( '/', '\/', wp_slash( $search_meta ) ) . '[^\)]/im',
@@ -1587,12 +1601,18 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
$join_matches
);
$sql['where'] = str_replace( '#%&', '{' . $matches[0][0] . '}', $sql['where'] );
if ( isset( $join_matches[1] ) ) {
$meta_join_for_search = trim( $join_matches[1] );
// skip private invisible fields
$custom_fields = array();
foreach ( array_keys( UM()->builtin()->all_user_fields ) as $field_key ) {
if ( empty( $field_key ) ) {
continue;
}
$data = UM()->fields()->get_field( $field_key );
if ( ! um_can_view_field( $data ) ) {
continue;
+5
View File
@@ -31,6 +31,11 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
*/
var $active_tab;
/**
* @var null
*/
public $active_subnav = null;
/**
* Profile constructor.
+43 -13
View File
@@ -1,30 +1,62 @@
<?php
namespace um\core;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\core\Shortcodes' ) ) {
/**
* Class Shortcodes
* @package um\core
*/
class Shortcodes {
var $profile_role = '';
/**
* @var string
*/
public $profile_role = '';
/**
* @var bool
*/
public $message_mode = false;
/**
* @var string
*/
public $custom_message = '';
/**
* @var array
*/
public $loop = array();
/**
* @var array
*/
public $emoji = array();
/**
* @var null|int
*/
public $form_id = null;
/**
* @var null|string
*/
public $form_status = null;
/**
* @var array
*/
public $set_args = array();
/**
* Shortcodes constructor.
*/
function __construct() {
$this->message_mode = false;
$this->custom_message = '';
$this->loop = array();
public function __construct() {
add_shortcode( 'ultimatemember', array( &$this, 'ultimatemember' ) );
add_shortcode( 'ultimatemember_login', array( &$this, 'ultimatemember_login' ) );
@@ -123,10 +155,8 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$this->emoji[':innocent:'] = $base_uri . '72x72/1f607.png';
$this->emoji[':smirk:'] = $base_uri . '72x72/1f60f.png';
$this->emoji[':expressionless:'] = $base_uri . '72x72/1f611.png';
}
/**
* Conditional logout form
*
+72 -24
View File
@@ -22,35 +22,86 @@ if ( ! class_exists( 'um\core\User' ) ) {
*/
public $previous_data = null;
/**
* @var int
*/
public $id = 0;
/**
* @var null
*/
public $usermeta = null;
/**
* @var null
*/
public $data = null;
/**
* @var null
*/
public $profile = null;
/**
* @var null
*/
public $cannot_edit = null;
/**
* @var null
*/
public $deleted_user_id = null;
/**
* @var array|string[]
*/
public $banned_keys = array();
/**
* @var bool
*/
public $preview = false;
/**
* @var bool
*/
public $send_mail_on_delete = true;
/**
* A list of keys that should never be in wp_usermeta.
* @var array|string[]
*/
public $update_user_keys = array();
/**
* @var null
*/
public $target_id = null;
/**
* User constructor.
*/
function __construct() {
$this->id = 0;
$this->usermeta = null;
$this->data = null;
$this->profile = null;
$this->cannot_edit = null;
$this->deleted_user_id = null;
public function __construct() {
global $wpdb;
$this->banned_keys = array(
'metabox','postbox','meta-box',
'dismissed_wp_pointers', 'session_tokens',
'screen_layout', 'wp_user-', 'dismissed',
'cap_key', $wpdb->get_blog_prefix(). 'capabilities',
'managenav', 'nav_menu', 'user_activation_key',
'level_', $wpdb->get_blog_prefix() . 'user_level'
'metabox',
'postbox',
'meta-box',
'dismissed_wp_pointers',
'session_tokens',
'screen_layout',
'wp_user-',
'dismissed',
'cap_key',
$wpdb->get_blog_prefix() . 'capabilities',
'managenav',
'nav_menu',
'user_activation_key',
'level_',
$wpdb->get_blog_prefix() . 'user_level',
);
add_action( 'init', array( &$this, 'set' ), 1 );
$this->preview = false;
$this->send_mail_on_delete = true;
// a list of keys that should never be in wp_usermeta
$this->update_user_keys = array(
'user_email',
@@ -61,7 +112,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
'role',
);
$this->target_id = null;
add_action( 'init', array( &$this, 'set' ), 1 );
// When the cache should be cleared
add_action( 'um_delete_user', array( &$this, 'remove_cache' ), 10, 1 );
@@ -88,7 +139,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
add_action( 'user_register', array( &$this, 'user_register_via_admin' ), 10, 1 );
add_action( 'user_register', array( &$this, 'set_gravatar' ), 11, 1 );
if ( is_multisite() ) {
add_action( 'added_existing_user', array( &$this, 'add_um_role_existing_user' ), 10, 2 );
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
@@ -102,13 +152,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
}
add_action( 'updated_user_meta', array( &$this, 'on_update_usermeta' ), 10, 4 );
add_action( 'added_user_meta', array( &$this, 'on_update_usermeta' ), 10, 4 );
add_action( 'deleted_user_meta', array( &$this, 'on_delete_usermeta' ), 10, 4 );
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 );
+19 -10
View File
@@ -13,16 +13,25 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
*/
class Validation {
/**
* @var string
*/
public $regex_safe = '/\A[\w\-\.]+\z/';
/**
* @var string
*/
public $regex_username_safe = '|[^a-z0-9 _.\-@]|i';
/**
* @var string
*/
public $regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/';
/**
* Validation constructor.
*/
function __construct() {
$this->regex_safe = '/\A[\w\-\.]+\z/';
$this->regex_username_safe = '|[^a-z0-9 _.\-@]|i';
$this->regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/';
public function __construct() {
add_filter( 'um_user_pre_updating_files_array', array( $this, 'validate_files' ), 10, 1 );
add_filter( 'um_before_save_filter_submitted', array( $this, 'validate_fields_values' ), 10, 2 );
}
@@ -91,7 +100,7 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
}
// Dropdown options source from callback function
if ( in_array( $fields[ $key ]['type'], array( 'select','multiselect' ) ) &&
if ( in_array( $fields[ $key ]['type'], array( 'select','multiselect' ) ) &&
isset( $fields[ $key ]['custom_dropdown_options_source'] ) &&
! empty( $fields[ $key ]['custom_dropdown_options_source'] ) &&
function_exists( $fields[ $key ]['custom_dropdown_options_source'] ) ) {
@@ -100,7 +109,7 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
$fields[ $key ]['options'] = array_keys( $arr_options );
}
}
// Unset changed value that doesn't match the option list
if ( in_array( $fields[ $key ]['type'], array( 'select' ) ) &&
! empty( $stripslashes ) && ! empty( $fields[ $key ]['options'] ) &&
@@ -297,10 +306,10 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
if ( ! $string ) {
return true;
}
if ( substr_count( $string, '#' ) > 1 ) {
if ( strlen( $string ) < 2 || strlen( $string ) > 31 ) {
return false;
}
if ( ! preg_match( '/^(.+)#(\d+)$/', trim( $string ) ) ) {
if ( ! preg_match( '/^[a-z\d_]+(?:\.[a-z\d_]+)*(\.[a-z]*)?$/', trim( $string ) ) ) {
return false;
}
return true;
+2 -2
View File
@@ -71,7 +71,7 @@ function um_submit_form_errors_hook_login( $args ) {
if ( ! empty( $third_party_codes ) && in_array( $user->get_error_code(), $third_party_codes ) ) {
UM()->form()->add_error( $user->get_error_code(), $user->get_error_message() );
} else {
UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
UM()->form()->add_error( 'user_password', __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
}
}
@@ -80,7 +80,7 @@ function um_submit_form_errors_hook_login( $args ) {
if ( ! empty( $third_party_codes ) && in_array( $user->get_error_code(), $third_party_codes ) ) {
UM()->form()->add_error( $user->get_error_code(), $user->get_error_message() );
} else {
UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
UM()->form()->add_error( 'user_password', __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
}
}
+1 -1
View File
@@ -66,7 +66,7 @@ function um_dynamic_user_profile_title( $title, $id = '' ) {
return $title;
}
return ( strlen( $title ) !== mb_strlen( $title ) ) ? $title : utf8_encode( $title );
return ( strlen( $title ) !== mb_strlen( $title ) ) ? $title : mb_convert_encoding( $title, 'UTF-8' );
}
add_filter( 'the_title', 'um_dynamic_user_profile_title', 100000, 2 );