diff --git a/includes/admin/settings/class-ur-settings-email.php b/includes/admin/settings/class-ur-settings-email.php
index 27d33bde9..bbeb565ba 100644
--- a/includes/admin/settings/class-ur-settings-email.php
+++ b/includes/admin/settings/class-ur-settings-email.php
@@ -62,6 +62,8 @@ public function __construct() {
$this->emails['UR_Settings_Profile_Details_Changed_Email'] = include 'emails/class-ur-settings-profile-details-changed-email.php';
+ $this->emails['UR_Settings_Profile_Details_Updated_Email'] = include 'emails/class-ur-settings-profile-details-updated-email.php';
+
$this->emails = apply_filters( 'user_registration_email_classes', $this->emails );
}
diff --git a/includes/admin/settings/emails/class-ur-settings-profile-details-updated-email.php b/includes/admin/settings/emails/class-ur-settings-profile-details-updated-email.php
new file mode 100644
index 000000000..0800d7016
--- /dev/null
+++ b/includes/admin/settings/emails/class-ur-settings-profile-details-updated-email.php
@@ -0,0 +1,113 @@
+id = 'profile_details_updated_email';
+ $this->title = __( 'Profile Details Updated Email', 'user-registration' );
+ $this->description = __( 'Email sent to the user when a user changed their profile information', 'user-registration' );
+ }
+
+ /**
+ * Get settings
+ *
+ * @return array
+ */
+ public function get_settings() {
+
+ $settings = apply_filters(
+ 'user_registration_profile_details_updated_email',
+ array(
+ 'title' => __( 'Emails', 'user-registration' ),
+ 'sections' => array(
+ 'profile_details_updated_email' => array(
+ 'title' => __( 'Profile Details Updated Email', 'user-registration' ),
+ 'type' => 'card',
+ 'desc' => '',
+ 'back_link' => ur_back_link( __( 'Return to emails', 'user-registration' ), admin_url( 'admin.php?page=user-registration-settings&tab=email' ) ),
+ 'preview_link' => ur_email_preview_link(
+ __( 'Preview', 'user-registration' ),
+ $this->id
+ ),
+ 'settings' => array(
+ array(
+ 'title' => __( 'Enable this email', 'user-registration' ),
+ 'desc' => __( 'Enable this email sent to the user when a user updated their profile information.', 'user-registration' ),
+ 'id' => 'user_registration_enable_profile_details_changed_email',
+ 'default' => 'false',
+ 'type' => 'toggle',
+ 'autoload' => false,
+ ),
+ array(
+ 'title' => __( 'Email Subject', 'user-registration' ),
+ 'desc' => __( 'The email subject you want to customize.', 'user-registration' ),
+ 'id' => 'user_registration_profile_details_updated_email_subject',
+ 'type' => 'text',
+ 'default' => __( 'Profile Details Updated Email: {{blog_info}}', 'user-registration' ),
+ 'css' => 'min-width: 350px;',
+ 'desc_tip' => true,
+ ),
+ array(
+ 'title' => __( 'Email Content', 'user-registration' ),
+ 'desc' => __( 'The email content you want to customize.', 'user-registration' ),
+ 'id' => 'user_registration_profile_details_Updated_email',
+ 'type' => 'tinymce',
+ 'default' => $this->ur_get_profile_details_updated_email(),
+ 'css' => 'min-width: 350px;',
+ 'desc_tip' => true,
+ ),
+ ),
+ ),
+ ),
+ )
+ );
+
+ return apply_filters( 'user_registration_get_settings_' . $this->id, $settings );
+ }
+
+ /**
+ * Email Message to be send to admin while profile detail changed.
+ *
+ * @return string message
+ */
+ public function ur_get_profile_details_updated_email() {
+
+ $message = apply_filters(
+ 'user_registration_profile_details_updated_email_message',
+ sprintf(
+ __(
+ 'Your profile details have been successfully updated on {{blog_info}}.
+
+
+ {{all_fields}}
+
+ Thank You!',
+ 'user-registration'
+ )
+ )
+ );
+
+ return $message;
+ }
+ }
+endif;
+
+return new UR_Settings_Profile_Details_Updated_Email();
diff --git a/includes/class-ur-emailer.php b/includes/class-ur-emailer.php
index 7c04d3e1c..3a9c92d18 100644
--- a/includes/class-ur-emailer.php
+++ b/includes/class-ur-emailer.php
@@ -46,7 +46,7 @@ public static function init() {
__CLASS__,
'ur_profile_details_changed_mail',
),
- 10,
+ 8,
2
);
}
@@ -218,6 +218,11 @@ public static function ur_profile_details_changed_mail( $user_id, $form_id ) {
$value = implode( ',',$upload_data );
}
}
+
+ if ( 'privacy_policy' === $form_data['field_key'] && '' !== $value ) {
+ $value = esc_html__( 'Accepted', 'user-registration' );
+ }
+
if ( 'country' === $form_data['field_key'] && '' !== $value ) {
$country_class = ur_load_form_field_class( $form_data['field_key'] );
$countries = $country_class::get_instance()->get_country();
@@ -254,6 +259,7 @@ public static function ur_profile_details_changed_mail( $user_id, $form_id ) {
do_action( 'user_registration_email_send_before' );
self::send_profile_changed_email_to_admin( $email, $username, $user_id, $data_html, $name_value, $attachments );
+ self::send_profile_changed_email_to_user( $email, $username, $user_id, $data_html, $name_value, $attachments );
do_action( 'user_registration_email_send_after' );
}
@@ -591,6 +597,49 @@ public static function send_profile_changed_email_to_admin( $user_email, $userna
}
}
+ /**
+ * Trigger the email after profile details changed by user.
+ *
+ * @param string $user_email Email of the user.
+ * @param string $username Username of the user.
+ * @param int $user_id User id.
+ * @param string $data_html String replaced with {{all_fields}} smart tag.
+ * @param array $name_value Array to replace with extra fields smart tag.
+ * @param array $attachments Email Attachement.
+ * @return void
+ * @since 3.0.5
+ */
+ public static function send_profile_changed_email_to_user( $user_email, $username, $user_id, $data_html, $name_value, $attachments ) {
+
+ $header = array(
+ 'Reply-To:' . $user_email,
+ 'Content-Type: text/html; charset=UTF-8'
+ );
+
+ $attachment = isset( $attachments['user'] ) ? $attachments['user'] : '';
+ $subject = get_option( 'user_registration_profile_details_updated_email_subject', esc_html__( 'Profile Details Updated Email: {{blog_info}}', 'user-registration' ) );
+ $settings = new UR_Settings_Profile_Details_Updated_Email();
+ $message = $settings->ur_get_profile_details_updated_email();
+ $message = get_option( 'user_registration_profile_details_updated_email', $message );
+ $form_id = ur_get_form_id_by_userid( $user_id );
+
+ $values = array(
+ 'username' => $username,
+ 'email' => $user_email,
+ 'all_fields' => $data_html,
+ 'form_id' => $form_id,
+ );
+
+ list( $message, $subject ) = user_registration_email_content_overrider( $form_id, $settings, $message, $subject );
+ $message = self::parse_smart_tags( $message, $values, $name_value );
+ $subject = self::parse_smart_tags( $subject, $values, $name_value );
+
+ if ( ur_option_checked( 'user_registration_enable_profile_details_updated_email', true ) ) {
+ $template_id = ur_get_single_post_meta( $form_id, 'user_registration_select_email_template' );
+ self::user_registration_process_and_send_email( $user_email, $subject, $message, $header, $attachment, $template_id );
+ }
+ }
+
/**
* Process smart tags for status change emails.
*
diff --git a/wpml-config.xml b/wpml-config.xml
index 69ef5dcc0..59d757641 100644
--- a/wpml-config.xml
+++ b/wpml-config.xml
@@ -30,6 +30,8 @@
+
+