mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- change placeholders for set password
This commit is contained in:
@@ -423,6 +423,9 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ) );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ) );
|
||||
if ( array_key_exists( 'generated_pass', $args ) && 1 === absint( $args['generated_pass'] ) ) {
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder_set_password' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters email notification subject.
|
||||
@@ -621,6 +624,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
$placeholders[] = '{admin_email}';
|
||||
$placeholders[] = '{submitted_registration}';
|
||||
$placeholders[] = '{login_url}';
|
||||
$placeholders[] = '{login_button}';
|
||||
$placeholders[] = '{password}';
|
||||
$placeholders[] = '{account_activation_link}';
|
||||
return $placeholders;
|
||||
@@ -639,9 +643,27 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
$replace_placeholders[] = um_admin_email();
|
||||
$replace_placeholders[] = um_user_submitted_registration_formatted();
|
||||
$replace_placeholders[] = um_get_core_page( 'login' );
|
||||
$replace_placeholders[] = esc_html__( 'Login to our site', 'ultimate-member' );
|
||||
$replace_placeholders[] = esc_html__( 'Your set password', 'ultimate-member' );
|
||||
$replace_placeholders[] = um_user( 'account_activation_link' );
|
||||
return $replace_placeholders;
|
||||
}
|
||||
|
||||
|
||||
public function add_replace_placeholder_set_password( $replace_placeholders ) {
|
||||
$key = array_search( um_get_core_page( 'login' ), $replace_placeholders, true );
|
||||
if ( false !== $key ) {
|
||||
$url = UM()->password()->reset_url();
|
||||
$replace_placeholders[ $key ] = add_query_arg( array( 'set_pass' => 'new_user' ), $url );
|
||||
}
|
||||
|
||||
$button = esc_html__( 'Login to our site', 'ultimate-member' );
|
||||
$button_key = array_search( $button, $replace_placeholders , true );
|
||||
if ( false !== $key ) {
|
||||
$url = UM()->password()->reset_url();
|
||||
$replace_placeholders[ $button_key ] = esc_html__( 'Set your password', 'ultimate-member' );
|
||||
}
|
||||
return $replace_placeholders;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1690,7 +1690,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
?>
|
||||
*
|
||||
*/
|
||||
function approve( $repeat = true ) {
|
||||
function approve( $repeat = true, $args = array() ) {
|
||||
$user_id = um_user( 'ID' );
|
||||
|
||||
if ( ! $repeat ) {
|
||||
@@ -1712,7 +1712,13 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
} else {
|
||||
//$userdata = get_userdata( $user_id );
|
||||
//get_password_reset_key( $userdata );
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'welcome_email' );
|
||||
$welcome_email_args = array();
|
||||
if ( true === (bool) $args['generated_pass'] ) {
|
||||
$welcome_email_args = array(
|
||||
'generated_pass' => 1,
|
||||
);
|
||||
}
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'welcome_email', $welcome_email_args );
|
||||
}
|
||||
|
||||
$this->set_status( 'approved' );
|
||||
|
||||
@@ -8,12 +8,12 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
*
|
||||
* @param int $user_id
|
||||
*/
|
||||
function um_post_registration_approved_hook( $user_id ) {
|
||||
function um_post_registration_approved_hook( $user_id, $args ) {
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
UM()->user()->approve();
|
||||
UM()->user()->approve( true, $args );
|
||||
}
|
||||
add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook' );
|
||||
add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook', 10, 2 );
|
||||
|
||||
/**
|
||||
* Account needs email validation.
|
||||
@@ -456,6 +456,9 @@ function um_submit_form_register( $args, $form_data ) {
|
||||
'user_password' => $user_password,
|
||||
'user_email' => trim( $user_email ),
|
||||
);
|
||||
if ( ! isset( $args['user_password'] ) ) {
|
||||
$credentials['generated_pass'] = true;
|
||||
}
|
||||
|
||||
// @todo test when ready maybe remove
|
||||
if ( ! empty( $args['submitted'] ) ) {
|
||||
|
||||
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
<div style="padding: 30px 0;font-size: 24px;text-align: center;line-height: 40px;">Thank you for signing up!<span style="display: block;">Your account is now active.</span></div>
|
||||
|
||||
<div style="padding: 10px 0 50px 0;text-align: center;"><a href="{login_url}" style="background: #555555;color: #fff;padding: 12px 30px;text-decoration: none;border-radius: 3px;letter-spacing: 0.3px;">Login to our site</a></div>
|
||||
<div style="padding: 10px 0 50px 0;text-align: center;"><a href="{login_url}" style="background: #555555;color: #fff;padding: 12px 30px;text-decoration: none;border-radius: 3px;letter-spacing: 0.3px;">{login_button}</a></div>
|
||||
|
||||
<div style="padding:20px;">If you have any problems, please contact us at <a href="mailto:{admin_email}" style="color: #3ba1da;text-decoration: none">{admin_email}</a></div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user