templates = new stdClass; $this->templates->new_reg_user_admin = 'new-reg-user-admin'; $this->templates->new_reg_user_with_payment = 'new-reg-user-with-payment'; $this->templates->new_reg_user_without_payment = 'new-reg-user-without-payment'; $this->templates->email_verify_user = 'email-verify-user'; $this->templates->account_verified_user = 'account-verified-user'; $this->templates->change_password_user = 'change-password-user'; $this->templates->forgot_passowrd_user = 'forgot-passowrd-user'; $this->templates->profile_updated_user = 'profile-updated-user'; $this->templates->profile_updated_notification_to_admin = 'profile-updated-notification-admin'; $this->templates->grace_failed_payment = 'grace-failed-payment'; $this->templates->grace_eot = 'grace-eot'; $this->templates->failed_payment_admin = 'failed-payment-admin'; $this->templates->on_menual_activation = 'on-menual-activation'; } function arm_get_email_template($temp_slug) { global $wpdb,$ARMember; $res = $wpdb->get_row("SELECT * FROM `".$ARMember->tbl_arm_email_templates."` WHERE `arm_template_slug`='{$temp_slug}'"); if (!empty($res)) { $res->arm_template_subject = isset($res->arm_template_subject) ? stripslashes($res->arm_template_subject) : ''; $res->arm_template_content = isset($res->arm_template_content) ? stripslashes($res->arm_template_content) : ''; return $res; } return false; } function arm_update_email_settings() { $arm_email_from_name = isset($_POST['arm_email_from_name']) ? sanitize_text_field($_POST['arm_email_from_name']) : ''; $arm_email_from_email = isset($_POST['arm_email_from_email']) ? sanitize_email($_POST['arm_email_from_email']) : ''; $arm_email_admin_email = isset($_POST['arm_email_admin_email']) ? sanitize_email($_POST['arm_email_admin_email']) : ''; $server = isset($_POST['arm_email_server']) ? sanitize_text_field($_POST['arm_email_server']) : ''; $arm_mail_authentication = isset($_POST['arm_mail_authentication']) ? $_POST['arm_mail_authentication'] : '0'; $smtp_mail_server = isset($_POST['arm_mail_server']) ? sanitize_text_field($_POST['arm_mail_server']) : ''; $smtp_mail_port = isset($_POST['arm_mail_port']) ? sanitize_text_field($_POST['arm_mail_port']) : ''; $smtp_mail_login_name = isset($_POST['arm_mail_login_name']) ? sanitize_text_field($_POST['arm_mail_login_name']) : ''; $smtp_mail_password = isset($_POST['arm_mail_password']) ? $_POST['arm_mail_password'] : ''; $smtp_mail_enc = isset($_POST['arm_smtp_enc']) ? sanitize_text_field($_POST['arm_smtp_enc']) : 'none'; $old_settings = $this->arm_get_all_email_settings(); $email_tools = (isset($old_settings['arm_email_tools'])) ? $old_settings['arm_email_tools'] : array(); $email_settings = array( 'arm_email_from_name' => $arm_email_from_name, 'arm_email_from_email' => $arm_email_from_email, 'arm_email_admin_email' => $arm_email_admin_email, 'arm_email_server' => $server, 'arm_mail_server' => $smtp_mail_server, 'arm_mail_port' => $smtp_mail_port, 'arm_mail_login_name' => $smtp_mail_login_name, 'arm_mail_password' => $smtp_mail_password, 'arm_smtp_enc' => $smtp_mail_enc, 'arm_email_tools' => $email_tools, 'arm_mail_authentication' => $arm_mail_authentication, ); $email_settings_ser = maybe_serialize($email_settings); update_option('arm_email_settings', $email_settings_ser); } function arm_get_all_email_settings() { global $wpdb; $email_settings_unser = get_option('arm_email_settings'); $all_email_settings = maybe_unserialize($email_settings_unser); $all_email_settings = apply_filters('arm_get_all_email_settings', $all_email_settings); return $all_email_settings; } function arm_get_single_email_template($template_id, $fields = array()) { global $wpdb, $ARMember; if ($template_id == '') { return false; } $select_fields = "*"; if (is_array($fields) && !empty($fields)) { $select_fields = implode(',', $fields); } $res = $wpdb->get_row("SELECT $select_fields FROM `".$ARMember->tbl_arm_email_templates."` WHERE `arm_template_id`='$template_id'"); if (!empty($res)) { if (!empty($res->arm_template_subject)) { $res->arm_template_subject = stripslashes($res->arm_template_subject); } if (!empty($res->arm_template_content)) { $res->arm_template_content = stripslashes($res->arm_template_content); } return $res; } return false; } function arm_get_all_email_template($field = array()) { global $wpdb, $ARMember; if (is_array($field) && !empty($field)) { $field_name = implode(',', $field); $sql = "SELECT " . $field_name . " FROM `".$ARMember->tbl_arm_email_templates."` ORDER BY `arm_template_id` ASC "; } else { $sql = "SELECT * FROM `".$ARMember->tbl_arm_email_templates."` ORDER BY `arm_template_id` ASC "; } $results = $wpdb->get_results($sql); if (!empty($results->arm_template_subject)) { $results->arm_template_subject = stripslashes($results->arm_template_subject); } if (!empty($results->arm_template_content)) { $results->arm_template_content = stripslashes($results->arm_template_content); } return $results; } function arm_edit_template_data() { global $wpdb, $ARMember, $arm_slugs, $arm_members_class, $arm_global_settings, $arm_email_settings, $arm_manage_communication, $arm_capabilities_global; $ARMember->arm_check_user_cap($arm_capabilities_global['arm_manage_email_notifications'], '1'); $return = array('status' => 'error'); if (isset($_REQUEST['action']) && isset($_REQUEST['temp_id']) && $_REQUEST['temp_id'] != '') { $template_id = intval($_REQUEST['temp_id']); $temp_detail = $arm_email_settings->arm_get_single_email_template($template_id); if (!empty($temp_detail)) { $return = array( 'status' => 'success', 'id' => $template_id, 'popup_heading' => esc_html(stripslashes($temp_detail->arm_template_name)), 'arm_template_slug' => $temp_detail->arm_template_slug, 'arm_template_subject' => esc_html(stripslashes($temp_detail->arm_template_subject)), 'arm_template_content' => stripslashes($temp_detail->arm_template_content), 'arm_template_status' => $temp_detail->arm_template_status, ); } } echo json_encode($return); exit; } function arm_submit_email_template() { global $wpdb, $ARMember, $arm_capabilities_global; $ARMember->arm_check_user_cap($arm_capabilities_global['arm_manage_email_notifications'], '1'); $response = array('type'=>'error', 'msg'=>__('Sorry, Something went wrong. Please try again.', 'ARMember')); if (!empty($_POST['arm_template_id']) && $_POST['arm_template_id'] != 0) { $template_id = intval($_POST['arm_template_id']); if(! $template_id) { $template_id = ''; } if(!empty($template_id)) { $arm_email_template_subject = (!empty($_POST['arm_template_subject'])) ? sanitize_text_field($_POST['arm_template_subject']) : ''; $arm_email_template_content = (!empty($_POST['arm_template_content'])) ? wp_kses_post($_POST['arm_template_content']) : ''; $arm_email_template_status = (!empty($_POST['arm_template_status'])) ? intval($_POST['arm_template_status']) : 0; $temp_data = array( 'arm_template_subject' => $arm_email_template_subject, 'arm_template_content' => $arm_email_template_content, 'arm_template_status' => $arm_email_template_status ); $update_temp = $wpdb->update($ARMember->tbl_arm_email_templates, $temp_data, array('arm_template_id' => $template_id)); $response = array('type'=>'success', 'msg'=>__('Email Template Updated Successfully.', 'ARMember')); } } echo json_encode($response); exit; } function arm_update_email_template_status($posted_data=array()) { global $wpdb, $ARMember, $arm_capabilities_global; $ARMember->arm_check_user_cap($arm_capabilities_global['arm_manage_email_notifications'], '1'); $response = array('type'=>'error', 'msg'=>__('Sorry, Something went wrong. Please try again.', 'ARMember')); if (!empty($_POST['arm_template_id']) && $_POST['arm_template_id'] != 0 && intval($_POST['arm_template_id'])) { $template_id = intval($_POST['arm_template_id']); if(!empty($template_id)) { $arm_email_template_status = (!empty($_POST['arm_template_status'])) ? intval($_POST['arm_template_status']) : 0; $temp_data = array( 'arm_template_status' => $arm_email_template_status, ); $update_temp = $wpdb->update($ARMember->tbl_arm_email_templates, $temp_data, array('arm_template_id' => $template_id)); $response = array('type'=>'success', 'msg'=>__('Email Template Updated Successfully.', 'ARMember')); } } echo json_encode($response); exit; } function arm_insert_default_email_templates() { global $wpdb, $ARMember; $default_email_template = $this->arm_default_email_templates(); if (!empty($default_email_template)) { foreach ($default_email_template as $slug => $email_template) { $oldTemp = $this->arm_get_email_template($slug); if (!empty($oldTemp)) { continue; } else { $email_template['arm_template_slug'] = $slug; $email_template['arm_template_status'] = '1'; $ins = $wpdb->insert($ARMember->tbl_arm_email_templates, $email_template); } } } } function arm_default_email_templates() { $temp_slugs = $this->templates; $email_templates = array( $temp_slugs->new_reg_user_admin => array( 'arm_template_name' => 'Signup Completed Notification To Admin', 'arm_template_subject' => 'New user registration at {ARM_BLOGNAME}', 'arm_template_content' => '
Hello Administrator,
A new user is just registered at {ARM_BLOGNAME}. Here are some basic details of that newly registered user.
Firstname: {ARM_FIRST_NAME}
Lastname: {ARM_LAST_NAME}
Username: {ARM_USERNAME}
Email: {ARM_EMAIL}
To check further details of this user, Please click on following link:
{ARM_PROFILE_LINK}
Thank You
{ARM_BLOGNAME}
', ), $temp_slugs->new_reg_user_with_payment => array( 'arm_template_name' => 'Signup Completed (With Payment) Notification To User', 'arm_template_subject' => 'Confirmation of your membership at {ARM_BLOGNAME}', 'arm_template_content' => 'Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
Thank you for subscribed to the {ARM_PLAN} at {ARM_BLOGNAME}.
You can review and edit your membership details here:
{ARM_PROFILE_LINK}
Here are your latest payment information:
Paid With: {ARM_PAYMENT_GATEWAY}
Plan Name: {ARM_PLAN}
Plan Type: {ARM_PAYMENT_TYPE}
Amount: {ARM_PLAN_AMOUNT}
Transaction Id: {ARM_TRANSACTION_ID}
Have a nice day!
', ), $temp_slugs->new_reg_user_without_payment => array( 'arm_template_name' => 'Signup Completed (Without Payment) Notification To User', 'arm_template_subject' => 'Confirmation of your membership at {ARM_BLOGNAME}', 'arm_template_content' => 'Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
Thank you for subscribed to the {ARM_PLAN} at {ARM_BLOGNAME}.
You can review and edit your membership details here:
{ARM_PROFILE_LINK}
Have a nice day!
', ), $temp_slugs->email_verify_user => array( 'arm_template_name' => 'Email Verification', 'arm_template_subject' => 'Email verification at {ARM_BLOGNAME}', 'arm_template_content' => 'Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
You must confirm/validate your email account before logging in.
Please click on the following link to activate your account:
{ARM_VALIDATE_URL}
Have a nice day!
', ), $temp_slugs->account_verified_user => array( 'arm_template_name' => 'Email Verified', 'arm_template_subject' => 'Email verified successfully at {ARM_BLOGNAME}', 'arm_template_content' => 'Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
Your account is now verified at {ARM_BLOGNAME}.
Have a nice day!
', ), $temp_slugs->change_password_user => array( 'arm_template_name' => 'Change Password', 'arm_template_subject' => 'Your password has been changed at {ARM_BLOGNAME}', 'arm_template_content' => 'Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
Your Password has been changed.
To login please fill out your credentials on:
{ARM_LOGIN_URL}
Your Username: {ARM_USERNAME}
Have a nice day!
', ), $temp_slugs->forgot_passowrd_user => array( 'arm_template_name' => 'Forgot Password', 'arm_template_subject' => 'Reset password request at {ARM_BLOGNAME}', 'arm_template_content' => 'Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
Someone requested that the password be reset for the following account: {ARM_BLOG_URL}
Username: {ARM_USERNAME},
If this was a mistake, just ignore this email and nothing will happen.
To reset your password, visit the following address:{ARM_RESET_PASSWORD_LINK}
If you have any problems, please contact us at {ARM_ADMIN_EMAIL}.
', ), $temp_slugs->profile_updated_user => array( 'arm_template_name' => 'Profile Updated', 'arm_template_subject' => 'Your account has been updated at {ARM_BLOGNAME}', 'arm_template_content' => 'Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
Your account has been updated.
To visit your profile page follow the next link:
{ARM_PROFILE_LINK}
Have a nice day!
', ), $temp_slugs->profile_updated_notification_to_admin => array( 'arm_template_name' => 'Profile Updated Notification To Admin', 'arm_template_subject' => 'Account of {ARM_USERNAME} has been updated at {ARM_BLOGNAME}', 'arm_template_content' => 'Hello Administrator,
An account has been updated at {ARM_BLOGNAME}. Here are some basic details of that updated user.
Firstname: {ARM_FIRST_NAME}
Lastname: {ARM_LAST_NAME}
Username: {ARM_USERNAME}
Email: {ARM_EMAIL}
Thank You
Have a nice day!
', ), $temp_slugs->grace_failed_payment => array( 'arm_template_name' => 'Grace Period For Failed Payment', 'arm_template_subject' => 'Reminder for failed payment at {ARM_BLOGNAME}', 'arm_template_content' => 'Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
Unfortunately your recurring payment for {ARM_PLAN} at {ARM_BLOGNAME} has been failed for some reason.
Here are some payment details:
Paid With: {ARM_PAYMENT_GATEWAY}
Amount: {ARM_PLAN_AMOUNT}
Please contact to payment service provider for the same.
Note: If you will not take appropriate action within {ARM_GRACE_PERIOD_DAYS} days, than relevant action will be performed by system,
If you have any further queries, Then feel free to contact us at {ARM_BLOGNAME}
Have a nice day!
', ), $temp_slugs->grace_eot => array( 'arm_template_name' => 'Grace Period For End Of Term', 'arm_template_subject' => 'Reminder for membership expiration at {ARM_BLOGNAME}', 'arm_template_content' => 'Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
Your {ARM_PLAN} membership has just expired.
But still you can access our website without any problem,
If you want to renew/update your membership plan, than please click on following link:
{ARM_BLOG_URL}
Note: If will not renew/change membership within {ARM_GRACE_PERIOD_DAYS} days, than relevant action will be performed by system.
Have a nice day!
', ), $temp_slugs->failed_payment_admin => array( 'arm_template_name' => 'Failed Payment Notification To Admin', 'arm_template_subject' => 'Reminder for failed payment at {ARM_BLOGNAME}', 'arm_template_content' => 'Hello Administrator,
This is a reminder that following member\'s recurring payment for {ARM_PLAN} membership has been failed for some reason at {ARM_BLOGNAME}
Here are some details.
Username: {ARM_USERNAME}
Email: {ARM_EMAIL}
Paid With: {ARM_PAYMENT_GATEWAY}
Amount: {ARM_PLAN_AMOUNT}
Please take appropriate action.
Thank You.
Hi {ARM_FIRST_NAME} {ARM_LAST_NAME},
Your Account has been activated.
Please click on following link:
{ARM_BLOG_URL}
Have a nice day!
', ), ); $email_templates = apply_filters('arm_default_email_templates', $email_templates); return $email_templates; } } } global $arm_email_settings; $arm_email_settings = new ARM_email_settings();