mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Refactor email placeholders and deprecate obsolete methods
Streamline placeholder handling for emails by introducing universal patterns and replacements, and update email dispatch functions for efficiency. Deprecated various redundant user and password-related methods, consolidating logic into common utility classes for better maintainability.
This commit is contained in:
@@ -208,7 +208,7 @@ function um_convert_tags( $content, $args = array(), $with_kses = true ) {
|
||||
// Support for all usermeta keys
|
||||
if ( ! empty( $matches[1] ) && is_array( $matches[1] ) ) {
|
||||
foreach ( $matches[1] as $match ) {
|
||||
$key = str_replace( 'usermeta:', '', $match );
|
||||
$key = str_replace( 'usermeta:', '', $match );
|
||||
$value = um_user( $key );
|
||||
if ( is_array( $value ) ) {
|
||||
$value = implode( ', ', $value );
|
||||
@@ -219,32 +219,6 @@ function um_convert_tags( $content, $args = array(), $with_kses = true ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM Placeholders for activation link in email
|
||||
*
|
||||
* @param $placeholders
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function account_activation_link_tags_patterns( $placeholders ) {
|
||||
$placeholders[] = '{account_activation_link}';
|
||||
return $placeholders;
|
||||
}
|
||||
|
||||
/**
|
||||
* UM Replace Placeholders for activation link in email
|
||||
*
|
||||
* @param $replace_placeholders
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function account_activation_link_tags_replaces( $replace_placeholders ) {
|
||||
$replace_placeholders[] = um_user( 'account_activation_link' );
|
||||
return $replace_placeholders;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @function um_user_ip()
|
||||
*
|
||||
@@ -2583,12 +2557,12 @@ function um_user( $data, $attrs = null ) {
|
||||
break;
|
||||
|
||||
case 'password_reset_link':
|
||||
// Avoid using and make it directly with `UM()->password()->reset_url( $user_id )`
|
||||
return UM()->password()->reset_url();
|
||||
break;
|
||||
|
||||
case 'account_activation_link':
|
||||
// Avoid using and make it directly with `UM()->permalinks()->activate_url( $user_id )`
|
||||
return UM()->permalinks()->activate_url();
|
||||
break;
|
||||
|
||||
case 'profile_photo':
|
||||
$data = um_get_user_avatar_data( um_user( 'ID' ), $attrs );
|
||||
|
||||
Reference in New Issue
Block a user