Merge pull request #1591 from ultimatemember/development/2.9.x

Version 2.9.2
This commit is contained in:
Mykyta Synelnikov
2024-12-02 22:25:32 +02:00
committed by GitHub
22 changed files with 343 additions and 276 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
"step": "installPlugin",
"pluginZipFile": {
"resource": "url",
"url": "https:\/\/downloads.wordpress.org\/plugin\/ultimate-member.2.9.1.zip"
"url": "https:\/\/downloads.wordpress.org\/plugin\/ultimate-member.2.9.2.zip"
},
"options": {
"activate": true
+1 -1
View File
@@ -44,7 +44,7 @@ GNU Version 2 or Any Later Version
### IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION
[Official Release Version: 2.9.1](https://github.com/ultimatemember/ultimatemember/releases/tag/2.9.1).
[Official Release Version: 2.9.2](https://github.com/ultimatemember/ultimatemember/releases/tag/2.9.2).
## Changelog
-1
View File
@@ -373,7 +373,6 @@ p.um-notice.warning a {
.um-field-label label {
font-size: 15px !important;
line-height: 22px !important;
font-weight: bold;
font-weight: 600;
}
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+21
View File
@@ -1,5 +1,26 @@
== Changelog ==
= 2.9.2 December 04, 2024 =
* Enhancements:
- Added: `UM()->is_new_ui()` function for future enhancements related to new UI
- Tweak: Changed hook's priority for initialization of email templates paths
- Tweak: Removed `load_plugin_textdomain` due to (article)[https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files]
* Bugfixes:
- Fixed: Using placeholders in email templates when Action Scheduler is active. Using `fetch_user_id` attribute for fetching necessary user before sending email
- Fixed: PHP errors related to `UM()->localize()` function
- Fixed: PHP errors in user meta header when `last_update` meta is empty
* Deprecated:
- Fully deprecated `UM()->localize()` function
- Fully deprecated `um_language_textdomain` filter hook
* Cached and optimized/minified assets(JS/CSS) must be flushed/re-generated after upgrade
= 2.9.1 November 15, 2024 =
* Enhancements:
+4
View File
@@ -53,6 +53,10 @@ if ( ! class_exists( 'um\action_scheduler\Init' ) ) {
}
}
public function is_enabled() {
return $this->enabled;
}
public function add_notice() {
UM()->admin()->notices()->add_notice(
'um-action-scheduler',
+1 -1
View File
@@ -24,7 +24,7 @@ if ( ! class_exists( 'um\admin\core\Admin_GDPR' ) ) {
* Admin_GDPR constructor.
*/
function __construct() {
add_action( 'init', array( &$this, 'init_fields' ), 10 );
add_action( 'init', array( &$this, 'init_fields' ) );
add_action( 'admin_init', array( &$this, 'plugin_add_suggested_privacy_content' ), 20 );
add_filter( 'wp_privacy_personal_data_exporters', array( &$this, 'plugin_register_exporters' ) );
add_filter( 'wp_privacy_personal_data_erasers', array( &$this, 'plugin_register_erasers' ) );
+62 -90
View File
@@ -175,7 +175,6 @@ if ( ! class_exists( 'UM' ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'ultimate-member' ), '1.0' );
}
/**
* UM constructor.
*
@@ -185,7 +184,6 @@ if ( ! class_exists( 'UM' ) ) {
parent::__construct();
}
/**
* UM pseudo-constructor.
*
@@ -202,19 +200,18 @@ if ( ! class_exists( 'UM' ) ) {
}
$this->is_filtering = 0;
$this->honeypot = 'um_request';
// @todo investigate permanently delete https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files
add_action( 'init', array( &$this, 'localize' ), 0 ); // textdomain loading
$this->honeypot = 'um_request';
// include UM classes
$this->includes();
// @todo build the proper 'init' priorities hook and docs about.
// include hook files
add_action( 'plugins_loaded', array( &$this, 'init' ), 0 );
//run hook for extensions init
// run hook for extensions init
add_action( 'plugins_loaded', array( &$this, 'extensions_init' ), -19 );
// Fallback to avoid fatal errors for users who still have UM extensions compatible with UM 1.3.x and install UM >= 2.0 version before these extensions update.
add_action( 'init', array( &$this, 'old_update_patch' ), 0 );
//run activation
@@ -222,7 +219,7 @@ if ( ! class_exists( 'UM' ) ) {
register_deactivation_hook( UM_PLUGIN, array( &$this, 'deactivation' ) );
if ( is_multisite() && ! defined( 'DOING_AJAX' ) ) {
if ( ! defined( 'DOING_AJAX' ) && is_multisite() ) {
add_action( 'wp_loaded', array( $this, 'maybe_network_activation' ) );
}
@@ -237,44 +234,10 @@ if ( ! class_exists( 'UM' ) ) {
}
/**
* Loading UM textdomain.
*
* Note: 'ultimate-member' is a default textdomain.
*
* @since 2.8.5 WordPress native functions are used to make this function clear.
* Fallback to avoid fatal errors for users who still have UM extensions compatible with UM 1.3.x and install UM >= 2.0 version before these extensions update.
* Doing 1.3.x active extensions deactivate for properly running 2.0.x AJAX upgrades.
*/
// public function localize() {
// $default_domain = dirname( plugin_basename( UM_PLUGIN ) );
// /**
// * Filters the plugin's textdomain.
// *
// * @param {string} $domain Plugin's textdomain.
// *
// * @return {string} Maybe changed plugin's textdomain.
// *
// * @since 1.3.x
// * @hook um_language_textdomain
// *
// * @example <caption>Change UM language locale.</caption>
// * function my_um_language_textdomain( $domain ) {
// * $domain = 'ultimate-member-custom';
// * return $domain;
// * }
// * add_filter( 'um_language_textdomain', 'my_um_language_textdomain' );
// */
// $domain = apply_filters( 'um_language_textdomain', $default_domain );
//
// // Unload textdomain if it has already loaded.
// if ( is_textdomain_loaded( $domain ) ) {
// unload_textdomain( $domain, true );
// }
// load_plugin_textdomain( $domain, false, $default_domain . '/languages' );
// }
/**
* 1.3.x active extensions deactivate for properly running 2.0.x AJAX upgrades
*/
function old_update_patch() {
public function old_update_patch() {
global $um_woocommerce, $um_bbpress, $um_followers, $um_friends, $um_mailchimp, $um_messaging, $um_mycred, $um_notices, $um_notifications, $um_online, $um_private_content, $um_profile_completeness, $um_recaptcha, $um_reviews, $um_activity, $um_social_login, $um_user_tags, $um_verified;
if ( is_object( $um_woocommerce ) ) {
@@ -873,30 +836,6 @@ if ( ! class_exists( 'UM' ) ) {
return $this->classes['admin_columns'];
}
/**
* @since 2.0
* @deprecated 2.7.0
*
* @return um\admin\Enqueue
*/
public function admin_enqueue() {
_deprecated_function( __METHOD__, '2.7.0', 'UM()->admin()->enqueue()' );
return $this->admin()->enqueue();
}
/**
* @since 2.0
* @deprecated 2.8.6
*
* @return um\frontend\Modal
*/
function modal() {
_deprecated_function( __METHOD__, '2.8.6', 'UM()->frontend()->modal()' );
return $this->frontend()->modal();
}
/**
* @since 2.0
*
@@ -1355,25 +1294,6 @@ if ( ! class_exists( 'UM' ) ) {
return $this->classes['mail'];
}
/**
* @deprecated 2.1.0
*
* @since 2.0
*
* @return um\core\Members
*/
function members() {
um_deprecated_function( 'UM()->members()', '2.1.0', 'UM()->member_directory()' );
if ( empty( $this->classes['members'] ) ) {
$this->classes['members'] = new um\core\Members();
}
return $this->classes['members'];
}
/**
* @since 2.0
*
@@ -1457,6 +1377,15 @@ if ( ! class_exists( 'UM' ) ) {
return $this->classes['action_scheduler'];
}
/**
* Checks if the new design is enabled.
*
* @return bool
*/
public function is_new_ui() {
return defined( 'UM_DEV_MODE' ) && UM_DEV_MODE && $this->options()->get( 'enable_new_ui' );
}
/**
* Include files with hooked filters/actions
*
@@ -1493,15 +1422,58 @@ if ( ! class_exists( 'UM' ) ) {
}
/**
* Init UM widgets
*
* @since 2.0
*/
function widgets_init() {
public function widgets_init() {
register_widget( 'um\widgets\UM_Search_Widget' );
}
/**
* @since 2.0
* @deprecated 2.7.0
*
* @return um\admin\Enqueue
*/
public function admin_enqueue() {
_deprecated_function( __METHOD__, '2.7.0', 'UM()->admin()->enqueue()' );
return $this->admin()->enqueue();
}
/**
* @since 2.0
* @deprecated 2.8.6
*
* @return um\frontend\Modal
*/
public function modal() {
_deprecated_function( __METHOD__, '2.8.6', 'UM()->frontend()->modal()' );
return $this->frontend()->modal();
}
/**
* Loading UM textdomain.
*
* Note: 'ultimate-member' is a default textdomain.
*
* @since 2.8.5 WordPress native functions are used to make this function clear.
* @deprecated 2.9.2 Ref. https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files
*/
public function localize() {
_deprecated_function( __METHOD__, '2.9.2' );
}
/**
* @since 2.0
* @deprecated 2.1.0
* @return um\core\Member_Directory | um\core\Member_Directory_Meta
*/
public function members() {
_deprecated_function( __METHOD__, '2.1.0', 'UM()->member_directory()' );
return UM()->member_directory();
}
}
}
+34
View File
@@ -18,6 +18,7 @@ if ( ! class_exists( 'um\common\actions\Emails' ) ) {
public function __construct() {
add_action( 'um_dispatch_email', array( $this, 'send' ), 10, 3 );
add_action( 'um_before_email_notification_sending', array( $this, 'before_email_send' ), 10, 2 );
}
/**
@@ -32,7 +33,40 @@ if ( ! class_exists( 'um\common\actions\Emails' ) ) {
return;
}
// @todo Workaround for now. Maybe we need to put base $user_id everytime
if ( array_key_exists( 'fetch_user_id', $args ) ) {
// When Action Scheduler is enabled, email sending script is located out of basic functionality, so we need to fetch the user for replace placeholders.
if ( UM()->maybe_action_scheduler()->is_enabled() ) {
um_fetch_user( $args['fetch_user_id'] );
}
unset( $args['fetch_user_id'] );
}
UM()->mail()->send( $user_email, $template, $args );
}
/**
* Add some custom placeholders when sending via Action Scheduler.
*
* @todo Workaround for now. Maybe we need to handle email placeholders in email class where $user_id is fetched everytime
*
* @param string $email
* @param string $template
*
* @return void
*/
public function before_email_send( $email, $template ) {
if ( ! UM()->maybe_action_scheduler()->is_enabled() ) {
return;
}
if ( 'checkmail_email' === $template ) {
add_filter( 'um_template_tags_patterns_hook', array( UM()->user(), 'add_activation_placeholder' ) );
add_filter( 'um_template_tags_replaces_hook', array( UM()->user(), 'add_activation_replace_placeholder' ) );
} elseif ( 'welcome_email' === $template || 'approved_email' === $template || 'resetpw_email' === $template ) {
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ) );
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ) );
}
}
}
}
+6 -6
View File
@@ -388,7 +388,7 @@ class Users {
add_filter( 'um_template_tags_patterns_hook', array( UM()->user(), 'add_activation_placeholder' ) );
add_filter( 'um_template_tags_replaces_hook', array( UM()->user(), 'add_activation_replace_placeholder' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'checkmail_email' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'checkmail_email', array( 'fetch_user_id' => $user_id ) ) );
um_fetch_user( $current_user_id );
/**
@@ -456,7 +456,7 @@ class Users {
$this->reset_activation_link( $user_id );
$userdata = get_userdata( $user_id );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'inactive_email' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'inactive_email', array( 'fetch_user_id' => $user_id ) ) );
/**
* Fires after User has been deactivated.
@@ -528,7 +528,7 @@ class Users {
$this->reset_activation_link( $user_id );
$userdata = get_userdata( $user_id );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'rejected_email' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'rejected_email', array( 'fetch_user_id' => $user_id ) ) );
/**
* Fires after User has been rejected.
@@ -606,7 +606,7 @@ class Users {
$this->reset_activation_link( $user_id );
$userdata = get_userdata( $user_id );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'pending_email' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'pending_email', array( 'fetch_user_id' => $user_id ) ) );
/**
* Fires after User has been set as pending admin review.
@@ -697,7 +697,7 @@ class Users {
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ) );
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, $email_slug ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, $email_slug, array( 'fetch_user_id' => $user_id ) ) );
um_fetch_user( $current_user_id );
/**
@@ -774,7 +774,7 @@ class Users {
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ) );
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'welcome_email' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'welcome_email', array( 'fetch_user_id' => $user_id ) ) );
um_fetch_user( $current_user_id );
+9 -8
View File
@@ -55,12 +55,12 @@ if ( ! class_exists( 'um\core\Access' ) ) {
// change the title of the post
add_filter( 'the_title', array( &$this, 'filter_restricted_post_title' ), 10, 2 );
// change the content of the restricted post
add_filter( 'the_content', array( &$this, 'filter_restricted_post_content' ), 999999, 1 );
add_filter( 'the_content', array( &$this, 'filter_restricted_post_content' ), 999999 );
// change the excerpt of the restricted post
add_filter( 'get_the_excerpt', array( &$this, 'filter_restricted_post_excerpt' ), 999999, 2 );
// comments queries
add_action( 'pre_get_comments', array( &$this, 'exclude_posts_comments' ), 99, 1 );
add_action( 'pre_get_comments', array( &$this, 'exclude_posts_comments' ), 99 );
add_filter( 'wp_count_comments', array( &$this, 'custom_comments_count_handler' ), 99, 2 );
// comments RSS
add_filter( 'comment_feed_where', array( &$this, 'exclude_posts_comments_feed' ), 99, 2 );
@@ -81,6 +81,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
add_action( 'um_access_check_individual_term_settings', array( &$this, 'um_access_check_individual_term_settings' ) );
add_action( 'um_access_check_global_settings', array( &$this, 'um_access_check_global_settings' ) );
// Don't change hook and priority, because hooks for filtering queries are run before `init`.
add_action( 'plugins_loaded', array( &$this, 'initialize_hooks' ), 1 );
}
@@ -96,19 +97,19 @@ if ( ! class_exists( 'um\core\Access' ) ) {
add_filter( 'has_post_thumbnail', array( &$this, 'filter_post_thumbnail' ), 99, 3 );
// Change recent posts widget query.
add_filter( 'widget_posts_args', array( &$this, 'exclude_restricted_posts_widget' ), 99, 1 );
add_filter( 'widget_posts_args', array( &$this, 'exclude_restricted_posts_widget' ), 99 );
// Exclude pages displayed by wp_list_pages function.
add_filter( 'wp_list_pages_excludes', array( &$this, 'exclude_restricted_pages' ), 10, 1 );
add_filter( 'wp_list_pages_excludes', array( &$this, 'exclude_restricted_pages' ) );
// Archives list change where based on restricted posts.
add_filter( 'getarchives_where', array( &$this, 'exclude_restricted_posts_archives_widget' ), 99, 2 );
// Callbacks for changing posts query.
add_action( 'pre_get_posts', array( &$this, 'exclude_posts' ), 99, 1 );
add_action( 'pre_get_posts', array( &$this, 'exclude_posts' ), 99 );
add_filter( 'posts_where', array( &$this, 'exclude_posts_where' ), 10, 2 );
add_filter( 'wp_count_posts', array( &$this, 'custom_count_posts_handler' ), 99, 3 );
// Callbacks for changing terms query.
add_action( 'pre_get_terms', array( &$this, 'exclude_hidden_terms_query' ), 99, 1 );
add_action( 'pre_get_terms', array( &$this, 'exclude_hidden_terms_query' ), 99 );
// there is posts (Posts/Page/CPT) filtration if site is accessible
// there also will be redirects if they need
@@ -123,12 +124,12 @@ if ( ! class_exists( 'um\core\Access' ) ) {
remove_action( 'pre_get_terms', array( &$this, 'exclude_hidden_terms_query' ), 99 );
remove_filter( 'widget_posts_args', array( &$this, 'exclude_restricted_posts_widget' ), 99 );
remove_filter( 'wp_list_pages_excludes', array( &$this, 'exclude_restricted_pages' ), 10 );
remove_filter( 'wp_list_pages_excludes', array( &$this, 'exclude_restricted_pages' ) );
remove_filter( 'getarchives_where', array( &$this, 'exclude_restricted_posts_archives_widget' ), 99 );
remove_filter( 'get_next_post_where', array( &$this, 'exclude_navigation_posts' ), 99 );
remove_filter( 'get_previous_post_where', array( &$this, 'exclude_navigation_posts' ), 99 );
remove_action( 'pre_get_posts', array( &$this, 'exclude_posts' ), 99 );
remove_filter( 'posts_where', array( &$this, 'exclude_posts_where' ), 10 );
remove_filter( 'posts_where', array( &$this, 'exclude_posts_where' ) );
remove_filter( 'wp_count_posts', array( &$this, 'custom_count_posts_handler' ), 99 );
}
+28 -32
View File
@@ -1447,24 +1447,6 @@ if ( ! class_exists( 'um\core\Files' ) ) {
}
}
/**
* New user upload
*
* @param $user_id
* @param $source
* @param $key
*
* @deprecated 2.1.0
*
* @return string
*/
function new_user_upload( $user_id, $source, $key ) {
um_deprecated_function( 'new_user_upload', '2.1.0', '' );
return '';
}
/**
* Remove a directory
*
@@ -1525,20 +1507,6 @@ if ( ! class_exists( 'um\core\Files' ) ) {
return $removed_files;
}
/**
* Format Bytes
*
* @deprecated 2.8.7
* @param $size
* @param int $precision
*
* @return string
*/
public function format_bytes( $size, $precision = 1 ) {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->filesystem()->format_bytes()' );
return UM()->common()->filesystem()::format_bytes( $size, $precision );
}
/**
* Get the list of profile/cover sizes
*
@@ -1569,6 +1537,34 @@ if ( ! class_exists( 'um\core\Files' ) ) {
return $sizes;
}
/**
* New user upload
*
* @param $user_id
* @param $source
* @param $key
*
* @deprecated 2.1.0
*
* @return string
*/
public function new_user_upload( $user_id, $source, $key ) {
_deprecated_function( __METHOD__, '2.1.0' );
return '';
}
/**
* Format Bytes
*
* @deprecated 2.8.7
* @param $size
* @param int $precision
*
* @return string
*/
public function format_bytes( $size, $precision = 1 ) {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->filesystem()->format_bytes()' );
return UM()->common()->filesystem()::format_bytes( $size, $precision );
}
}
}
+16 -19
View File
@@ -47,25 +47,8 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
* Mail constructor.
*/
public function __construct() {
//mandrill compatibility
add_action( 'init', array( &$this, 'init_paths' ), 0 ); // init class variables on zero-priority.
add_filter( 'mandrill_nl2br', array( &$this, 'mandrill_nl2br' ) );
add_action( 'plugins_loaded', array( &$this, 'init_paths' ), 99 );
}
/**
* Mandrill compatibility
*
* @param $nl2br
* @param string $message
* @return bool
*/
public function mandrill_nl2br( $nl2br, $message = '' ) {
// text emails
if ( ! UM()->options()->get( 'email_html' ) ) {
$nl2br = true;
}
return $nl2br;
}
/**
@@ -85,7 +68,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
* @example <caption>Extends email templates path.</caption>
* function my_email_templates_path_by_slug( $paths ) {
* // your code here
* $paths['{template_name}'] = '{template_path}';
* $paths['template_name'] = 'template_path';
* return $paths;
* }
* add_filter( 'um_email_templates_path_by_slug', 'my_email_templates_path_by_slug' );
@@ -93,6 +76,20 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
$this->path_by_slug = apply_filters( 'um_email_templates_path_by_slug', $this->path_by_slug );
}
/**
* Mandrill compatibility
*
* @param $nl2br
* @return bool
*/
public function mandrill_nl2br( $nl2br ) {
if ( ! UM()->options()->get( 'email_html' ) ) {
$nl2br = true; // nl2br for text emails
}
return $nl2br;
}
/**
* Check blog ID on multisite, return '' if single site.
*
+2 -1
View File
@@ -31,7 +31,8 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
add_action( 'init', array( &$this, 'check_for_querystrings' ), 1 );
add_action( 'init', array( &$this, 'activate_account_via_email_link' ), 1 );
// don't use lower than 2 priority because there is sending email inside, but Action Scheduler is init on 1st priority.
add_action( 'init', array( &$this, 'activate_account_via_email_link' ), 2 );
}
/**
+106 -108
View File
@@ -153,9 +153,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
add_action( 'init', array( &$this, 'check_membership' ), 10 );
if ( is_multisite() ) {
add_action( 'wpmu_delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
add_action( 'wpmu_delete_user', array( &$this, 'delete_user_handler' ) );
} else {
add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
add_action( 'delete_user', array( &$this, 'delete_user_handler' ) );
}
add_action( 'updated_user_meta', array( &$this, 'on_update_usermeta' ), 10, 4 );
@@ -623,14 +623,15 @@ if ( ! class_exists( 'um\core\User' ) ) {
// send email notifications
if ( $this->send_mail_on_delete ) {
$user_email = um_user( 'user_email' );
$template = 'deletion_email';
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $user_email, $template ) );
// Sending without Action Scheduler, because in the scheduled event the user is already deleted.
UM()->mail()->send( $user_email, 'deletion_email' );
$emails = um_multi_admin_email();
if ( ! empty( $emails ) ) {
foreach ( $emails as $email ) {
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $email, 'notification_deletion', array( 'admin' => true ) ) );
// Sending without Action Scheduler, because in the scheduled event the user is already deleted.
UM()->mail()->send( $email, 'notification_deletion', array( 'admin' => true ) );
}
}
}
@@ -1477,28 +1478,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
update_user_meta( $this->id, '_um_last_login', current_time( 'mysql', true ) );
}
/**
* Set user's account status
*
* @deprecated 2.8.7
*
* @param string $status
*/
public function set_status( $status ) {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->set_status()' );
UM()->common()->users()->set_status( $status, um_user( 'ID' ) );
}
/**
* Set user's hash
*
* @deprecated 2.8.7
*/
public function assign_secretkey() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->assign_secretkey()' );
UM()->common()->users()->assign_secretkey( um_user( 'ID' ) );
}
/**
* @param \WP_User $userdata
*
@@ -1517,10 +1496,10 @@ if ( ! class_exists( 'um\core\User' ) ) {
$this->maybe_generate_password_reset_key( $userdata );
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ), 10, 1 );
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ), 10, 1 );
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ) );
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'resetpw_email' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'resetpw_email', array( 'fetch_user_id' => um_user( 'ID' ) ) ) );
}
@@ -1534,63 +1513,13 @@ if ( ! class_exists( 'um\core\User' ) ) {
um_fetch_user( $user_id );
}
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( um_user( 'user_email' ), 'changedpw_email' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( um_user( 'user_email' ), 'changedpw_email', array( 'fetch_user_id' => $user_id ) ) );
if ( ! empty( $user_id ) ) {
um_reset_user();
}
}
/**
* This method approves a user membership and sends them an optional welcome/approval email.
* @param bool $repeat @deprecated
* @deprecated 2.8.7
*/
public function approve( $repeat = true ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- deprecated function
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->approve()' );
UM()->common()->users()->approve( um_user( 'ID' ), $repeat );
}
/**
* Pending email
* @deprecated 2.8.7
*/
public function email_pending() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->send_activation()' );
UM()->common()->users()->send_activation( um_user( 'ID' ) );
}
/**
* This method puts a user under manual review by administrator and sends them an optional email.
* @deprecated 2.8.7
* @return void
*/
public function pending() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->set_as_pending()' );
UM()->common()->users()->set_as_pending( um_user( 'ID' ) );
}
/**
* This method rejects a user membership and sends them an optional email.
* @deprecated 2.8.7
* @return void
*/
public function reject() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->reject()' );
UM()->common()->users()->reject( um_user( 'ID' ) );
}
/**
* This method deactivates a user membership and sends them an optional email.
* @deprecated 2.8.7
* @return void
*/
public function deactivate() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->deactivate()' );
UM()->common()->users()->deactivate( um_user( 'ID' ) );
}
/**
* Delete user
*
@@ -1866,18 +1795,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
return false;
}
/**
* Update files
*
* @param $changes
*
* @deprecated 2.1.0
*/
function update_files( $changes ) {
um_deprecated_function( 'update_files', '2.1.0', '' );
}
/**
* Update profile
*
@@ -2057,21 +1974,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
return false;
}
/**
* This method checks if a user exists or not in your site based on the user ID.
*
* @deprecated 2.8.7
*
* @param int $user_id A user ID must be passed to check if the user exists
*
* @return bool|int
*/
public function user_exists_by_id( $user_id ) {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()::user_exists' );
return UM()->common()->users()::user_exists( $user_id ) ? $user_id : false;
}
/**
* @param string $hash
*
@@ -2233,5 +2135,101 @@ if ( ! class_exists( 'um\core\User' ) ) {
$replace_placeholders[] = um_user( 'account_activation_link' );
return $replace_placeholders;
}
/**
* Set user's account status
*
* @deprecated 2.8.7
*
* @param string $status
*/
public function set_status( $status ) {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->set_status()' );
UM()->common()->users()->set_status( $status, um_user( 'ID' ) );
}
/**
* Set user's hash
*
* @deprecated 2.8.7
*/
public function assign_secretkey() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->assign_secretkey()' );
UM()->common()->users()->assign_secretkey( um_user( 'ID' ) );
}
/**
* Update files
*
* @param $changes
*
* @deprecated 2.1.0
*/
public function update_files( $changes ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- deprecated function
_deprecated_function( __METHOD__, '2.1.0' );
}
/**
* This method checks if a user exists or not in your site based on the user ID.
*
* @deprecated 2.8.7
*
* @param int $user_id A user ID must be passed to check if the user exists
*
* @return bool|int
*/
public function user_exists_by_id( $user_id ) {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()::user_exists' );
return UM()->common()->users()::user_exists( $user_id ) ? $user_id : false;
}
/**
* This method approves a user membership and sends them an optional welcome/approval email.
* @param bool $repeat @deprecated
* @deprecated 2.8.7
*/
public function approve( $repeat = true ) {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->approve()' );
UM()->common()->users()->approve( um_user( 'ID' ), $repeat );
}
/**
* Pending email
* @deprecated 2.8.7
*/
public function email_pending() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->send_activation()' );
UM()->common()->users()->send_activation( um_user( 'ID' ) );
}
/**
* This method puts a user under manual review by administrator and sends them an optional email.
* @deprecated 2.8.7
* @return void
*/
public function pending() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->set_as_pending()' );
UM()->common()->users()->set_as_pending( um_user( 'ID' ) );
}
/**
* This method rejects a user membership and sends them an optional email.
* @deprecated 2.8.7
* @return void
*/
public function reject() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->reject()' );
UM()->common()->users()->reject( um_user( 'ID' ) );
}
/**
* This method deactivates a user membership and sends them an optional email.
* @deprecated 2.8.7
* @return void
*/
public function deactivate() {
_deprecated_function( __METHOD__, '2.8.7', 'UM()->common()->users()->deactivate()' );
UM()->common()->users()->deactivate( um_user( 'ID' ) );
}
}
}
+1 -1
View File
@@ -593,7 +593,7 @@ function um_account_updated_notification( $user_id, $changed ) {
if ( 'password' !== $_POST['_um_account_tab'] || ! UM()->options()->get( 'changedpw_email_on' ) ) {
// Avoid email duplicates (account changed and password changed) on the password change tab.
um_fetch_user( $user_id );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( um_user( 'user_email' ), 'changedaccount_email' ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( um_user( 'user_email' ), 'changedaccount_email', array( 'fetch_user_id' => $user_id ) ) );
}
// phpcs:enable WordPress.Security.NonceVerification
}
+12 -1
View File
@@ -739,7 +739,6 @@ function um_profile_dynamic_meta_desc() {
'@context' => 'https://schema.org',
'@type' => 'ProfilePage',
'dateCreated' => um_user( 'user_registered' ),
'dateModified' => gmdate( 'Y-m-d H:i:s', um_user( 'last_update' ) ),
'mainEntity' => array(
'@type' => 'Person',
'name' => esc_attr( $title ),
@@ -751,6 +750,18 @@ function um_profile_dynamic_meta_desc() {
),
),
);
$user_last_update = um_user( 'last_update' );
if ( ! empty( $user_last_update ) ) {
if ( is_numeric( $user_last_update ) ) {
$user_last_update = (int) $user_last_update; // cast numeric type to int
} else {
$user_last_update = strtotime( $user_last_update ); // cast string date type to int
}
if ( ! empty( $user_last_update ) ) {
$person['dateModified'] = gmdate( 'Y-m-d H:i:s', $user_last_update );
}
}
/**
* Filters changing the schema.org of profile's person.
*
+2 -2
View File
@@ -120,9 +120,9 @@ function um_send_registration_notification( $user_id ) {
if ( ! empty( $emails ) ) {
foreach ( $emails as $email ) {
if ( 'pending' !== $registration_status ) {
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $email, 'notification_new_user', array( 'admin' => true ) ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $email, 'notification_new_user', array( 'admin' => true, 'fetch_user_id' => $user_id ) ) );
} else {
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $email, 'notification_review', array( 'admin' => true ) ) );
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $email, 'notification_review', array( 'admin' => true, 'fetch_user_id' => $user_id ) ) );
}
}
}
+12
View File
@@ -109,3 +109,15 @@ if ( ! defined( 'ABSPATH' ) ) {
* @depecated 2.8.7 Fully deprecated because there is used dropdown with statuses instead of list table views.
* @hook um_admin_views_users
*/
/**
* Filters the plugin's textdomain.
*
* @param {string} $domain Plugin's textdomain.
*
* @return {string} Maybe changed plugin's textdomain.
*
* @since 1.3.x
* @depecated 2.9.2 Fully deprecated because minimum required WP version is 5.5, but we cannot use `load_plugin_textdomain()` function since 4.6.0 if the plugin is situated in wp.org plugins directory.
* @hook um_language_textdomain
*/
+22 -1
View File
@@ -6,7 +6,7 @@ Tags: community, member, membership, user-profile, user-registration
Requires PHP: 5.6
Requires at least: 5.5
Tested up to: 6.7
Stable tag: 2.9.1
Stable tag: 2.9.2
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@@ -166,6 +166,27 @@ No specific extensions are needed. But we highly recommended keep active these P
IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION
= 2.9.2 2024-12-04 =
**Enhancements**
* Added: `UM()->is_new_ui()` function for future enhancements related to new UI
* Tweak: Changed hook's priority for initialization of email templates paths
* Tweak: Removed `load_plugin_textdomain` due to (article)[https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files]
**Bugfixes**
* Fixed: Using placeholders in email templates when Action Scheduler is active. Using `fetch_user_id` attribute for fetching necessary user before sending email
* Fixed: PHP errors related to `UM()->localize()` function
* Fixed: PHP errors in user meta header when `last_update` meta is empty
**Deprecated**
* Fully deprecated `UM()->localize()` function
* Fully deprecated `um_language_textdomain` filter hook
**Cached and optimized/minified assets(JS/CSS) must be flushed/re-generated after upgrade**
= 2.9.1 2024-11-15 =
**Enhancements**
+1 -1
View File
@@ -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.9.1
* Version: 2.9.2
* Author: Ultimate Member
* Author URI: http://ultimatemember.com/
* Text Domain: ultimate-member