| 1 |
<?php |
| 2 |
/** |
| 3 |
* UsersWP Emails Settings |
| 4 |
* |
| 5 |
* @author AyeCode |
| 6 |
* @category Admin |
| 7 |
* @package userswp/Admin |
| 8 |
* @version 1.0.24 |
| 9 |
*/ |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; // Exit if accessed directly |
| 13 |
} |
| 14 |
|
| 15 |
if ( ! class_exists( 'UsersWP_Settings_Email', false ) ) : |
| 16 |
|
| 17 |
/** |
| 18 |
* UsersWP_Settings_Email. |
| 19 |
*/ |
| 20 |
class UsersWP_Settings_Email extends UsersWP_Settings_Page { |
| 21 |
|
| 22 |
/** |
| 23 |
* Constructor. |
| 24 |
*/ |
| 25 |
public function __construct() { |
| 26 |
|
| 27 |
$this->id = 'emails'; |
| 28 |
$this->label = __( 'Emails', 'userswp' ); |
| 29 |
|
| 30 |
add_filter( 'uwp_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
| 31 |
add_action( 'uwp_settings_' . $this->id, array( $this, 'output' ) ); |
| 32 |
add_action( 'uwp_sections_' . $this->id, array( $this, 'output_toggle_advanced' ) ); |
| 33 |
add_action( 'uwp_settings_save_' . $this->id, array( $this, 'save' ) ); |
| 34 |
add_action( 'uwp_sections_' . $this->id, array( $this, 'output_sections' ) ); |
| 35 |
|
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Output the settings. |
| 40 |
*/ |
| 41 |
public function output() { |
| 42 |
global $current_section; |
| 43 |
|
| 44 |
$settings = $this->get_settings( $current_section ); |
| 45 |
|
| 46 |
UsersWP_Admin_Settings::output_fields( $settings ); |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Save settings. |
| 51 |
*/ |
| 52 |
public function save() { |
| 53 |
global $current_section; |
| 54 |
|
| 55 |
$settings = $this->get_settings( $current_section ); |
| 56 |
UsersWP_Admin_Settings::save_fields( $settings ); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Get sections. |
| 61 |
* |
| 62 |
* @return array |
| 63 |
*/ |
| 64 |
public function get_sections() { |
| 65 |
|
| 66 |
$sections = array( |
| 67 |
'' => __( 'Email Options', 'userswp' ), |
| 68 |
'user_emails' => __( 'User Emails', 'userswp' ), |
| 69 |
'admin_emails' => __( 'Admin Emails', 'userswp' ), |
| 70 |
); |
| 71 |
|
| 72 |
return apply_filters( 'uwp_get_sections_' . $this->id, $sections ); |
| 73 |
} |
| 74 |
|
| 75 |
public function get_settings( $current_section = '' ) { |
| 76 |
|
| 77 |
if($current_section == 'admin_emails'){ |
| 78 |
$settings = apply_filters( 'uwp_admin_email_settings', array( |
| 79 |
|
| 80 |
array('name' => __('WP new user notification email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'wp_new_user_notification_email_settings'), |
| 81 |
|
| 82 |
array( |
| 83 |
'name' => __('Enable email', 'userswp'), |
| 84 |
'desc' => __('This will replace the email sent by WordPress when new user registered.', 'userswp'), |
| 85 |
'id' => 'wp_new_user_notification_email_admin', |
| 86 |
'type' => 'checkbox', |
| 87 |
'default' => 1, |
| 88 |
), |
| 89 |
array( |
| 90 |
'name' => __('Subject', 'userswp'), |
| 91 |
'desc' => __('The email subject.', 'userswp'), |
| 92 |
'id' => 'wp_new_user_notification_email_subject_admin', |
| 93 |
'type' => 'text', |
| 94 |
'class' => 'large-text', |
| 95 |
'desc_tip' => true, |
| 96 |
'advanced' => true, |
| 97 |
'placeholder' => UsersWP_Defaults::wp_new_user_notification_email_subject_admin(), |
| 98 |
), |
| 99 |
array( |
| 100 |
'name' => __('Body', 'userswp'), |
| 101 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 102 |
'id' => 'wp_new_user_notification_email_content_admin', |
| 103 |
'type' => 'textarea', |
| 104 |
'class' => 'code uwp-email-body', |
| 105 |
'desc_tip' => true, |
| 106 |
'advanced' => true, |
| 107 |
'placeholder' => UsersWP_Defaults::wp_new_user_notification_email_content_admin(), |
| 108 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_wp_new_user_notification_tags() |
| 109 |
), |
| 110 |
|
| 111 |
array('type' => 'sectionend', 'id' => 'wp_new_user_notification_email_settings'), |
| 112 |
|
| 113 |
array('name' => __('New account registration', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'registration_success_admin_email_settings'), |
| 114 |
|
| 115 |
array( |
| 116 |
'name' => __('Enable email', 'userswp'), |
| 117 |
'desc' => __('Send an email to admin when user has created account on site.', 'userswp'), |
| 118 |
'id' => 'registration_success_email_admin', |
| 119 |
'type' => 'checkbox', |
| 120 |
'default' => 1, |
| 121 |
), |
| 122 |
array( |
| 123 |
'name' => __('Subject', 'userswp'), |
| 124 |
'desc' => __('The email subject.', 'userswp'), |
| 125 |
'id' => 'registration_success_email_subject_admin', |
| 126 |
'type' => 'text', |
| 127 |
'class' => 'large-text', |
| 128 |
'desc_tip' => true, |
| 129 |
'placeholder' => UsersWP_Defaults::registration_success_email_subject_admin(), |
| 130 |
'advanced' => true |
| 131 |
), |
| 132 |
array( |
| 133 |
'name' => __('Body', 'userswp'), |
| 134 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 135 |
'id' => 'registration_success_email_content_admin', |
| 136 |
'type' => 'textarea', |
| 137 |
'class' => 'code uwp-email-body', |
| 138 |
'desc_tip' => true, |
| 139 |
'placeholder' => UsersWP_Defaults::registration_success_email_content_admin(), |
| 140 |
'advanced' => true, |
| 141 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_all_email_tags(true, array('[#form_fields#]')) |
| 142 |
), |
| 143 |
|
| 144 |
array('type' => 'sectionend', 'id' => 'registration_success_admin_email_settings'), |
| 145 |
|
| 146 |
array('name' => __('Account delete email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'account_delete_admin_email_settings'), |
| 147 |
|
| 148 |
array( |
| 149 |
'name' => __('Enable email', 'userswp'), |
| 150 |
'desc' => __('Send an email to admin after user account deleted from the site.', 'userswp'), |
| 151 |
'id' => 'account_delete_email_admin', |
| 152 |
'type' => 'checkbox', |
| 153 |
'default' => 1, |
| 154 |
), |
| 155 |
array( |
| 156 |
'name' => __('Subject', 'userswp'), |
| 157 |
'desc' => __('The email subject.', 'userswp'), |
| 158 |
'id' => 'account_delete_email_subject_admin', |
| 159 |
'type' => 'text', |
| 160 |
'class' => 'large-text', |
| 161 |
'desc_tip' => true, |
| 162 |
'advanced' => true, |
| 163 |
'placeholder' => UsersWP_Defaults::account_delete_email_subject_admin(), |
| 164 |
), |
| 165 |
array( |
| 166 |
'name' => __('Body', 'userswp'), |
| 167 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 168 |
'id' => 'account_delete_email_content_admin', |
| 169 |
'type' => 'textarea', |
| 170 |
'class' => 'code uwp-email-body', |
| 171 |
'desc_tip' => true, |
| 172 |
'advanced' => true, |
| 173 |
'placeholder' => UsersWP_Defaults::account_delete_email_content_admin(), |
| 174 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_delete_account_email_tags() |
| 175 |
), |
| 176 |
|
| 177 |
array('type' => 'sectionend', 'id' => 'account_delete_admin_email_settings'), |
| 178 |
|
| 179 |
)); |
| 180 |
}elseif($current_section == 'user_emails'){ |
| 181 |
$settings = apply_filters( 'uwp_user_email_settings', array( |
| 182 |
|
| 183 |
array('name' => __('WP new user notification email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'wp_new_user_notification_email_settings'), |
| 184 |
|
| 185 |
array( |
| 186 |
'name' => __('Enable email', 'userswp'), |
| 187 |
'desc' => __('This will replace the email sent by WordPress when new user registered.', 'userswp'), |
| 188 |
'id' => 'wp_new_user_notification_email', |
| 189 |
'type' => 'checkbox', |
| 190 |
'default' => 1, |
| 191 |
), |
| 192 |
array( |
| 193 |
'name' => __('Subject', 'userswp'), |
| 194 |
'desc' => __('The email subject.', 'userswp'), |
| 195 |
'id' => 'wp_new_user_notification_email_subject', |
| 196 |
'type' => 'text', |
| 197 |
'class' => 'large-text', |
| 198 |
'desc_tip' => true, |
| 199 |
'advanced' => true, |
| 200 |
'placeholder' => UsersWP_Defaults::wp_new_user_notification_email_subject(), |
| 201 |
), |
| 202 |
array( |
| 203 |
'name' => __('Body', 'userswp'), |
| 204 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 205 |
'id' => 'wp_new_user_notification_email_content', |
| 206 |
'type' => 'textarea', |
| 207 |
'class' => 'code uwp-email-body', |
| 208 |
'desc_tip' => true, |
| 209 |
'advanced' => true, |
| 210 |
'placeholder' => UsersWP_Defaults::wp_new_user_notification_email_content(), |
| 211 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_wp_new_user_notification_tags(true, array('[#reset_link#]')) |
| 212 |
), |
| 213 |
|
| 214 |
array('type' => 'sectionend', 'id' => 'wp_new_user_notification_email_settings'), |
| 215 |
|
| 216 |
array('name' => __('Registration activate email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'registration_activate_email_settings'), |
| 217 |
|
| 218 |
array( |
| 219 |
'name' => __('Enable email', 'userswp'), |
| 220 |
'desc' => __('Send an email to user for activation when registered.', 'userswp'), |
| 221 |
'id' => 'registration_activate_email', |
| 222 |
'type' => 'checkbox', |
| 223 |
'default' => 1, |
| 224 |
), |
| 225 |
array( |
| 226 |
'name' => __('Subject', 'userswp'), |
| 227 |
'desc' => __('The email subject.', 'userswp'), |
| 228 |
'id' => 'registration_activate_email_subject', |
| 229 |
'type' => 'text', |
| 230 |
'class' => 'large-text', |
| 231 |
'desc_tip' => true, |
| 232 |
'advanced' => true, |
| 233 |
'placeholder' => UsersWP_Defaults::registration_activate_email_subject(), |
| 234 |
), |
| 235 |
array( |
| 236 |
'name' => __('Body', 'userswp'), |
| 237 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 238 |
'id' => 'registration_activate_email_content', |
| 239 |
'type' => 'textarea', |
| 240 |
'class' => 'code uwp-email-body', |
| 241 |
'desc_tip' => true, |
| 242 |
'advanced' => true, |
| 243 |
'placeholder' => UsersWP_Defaults::registration_activate_email_content(), |
| 244 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_all_email_tags(true, array('[#activation_link#]')) |
| 245 |
), |
| 246 |
|
| 247 |
array('type' => 'sectionend', 'id' => 'registration_activate_email_settings'), |
| 248 |
|
| 249 |
array('name' => __('Registration success email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'registration_success_email_settings'), |
| 250 |
|
| 251 |
array( |
| 252 |
'name' => __('Enable email', 'userswp'), |
| 253 |
'desc' => __('Send an email to user on successful registration.', 'userswp'), |
| 254 |
'id' => 'registration_success_email', |
| 255 |
'type' => 'checkbox', |
| 256 |
'default' => 1, |
| 257 |
), |
| 258 |
array( |
| 259 |
'name' => __('Subject', 'userswp'), |
| 260 |
'desc' => __('The email subject.', 'userswp'), |
| 261 |
'id' => 'registration_success_email_subject', |
| 262 |
'type' => 'text', |
| 263 |
'class' => 'large-text', |
| 264 |
'desc_tip' => true, |
| 265 |
'advanced' => true, |
| 266 |
'placeholder' => UsersWP_Defaults::registration_success_email_subject(), |
| 267 |
), |
| 268 |
array( |
| 269 |
'name' => __('Body', 'userswp'), |
| 270 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 271 |
'id' => 'registration_success_email_content', |
| 272 |
'type' => 'textarea', |
| 273 |
'class' => 'code uwp-email-body', |
| 274 |
'desc_tip' => true, |
| 275 |
'advanced' => true, |
| 276 |
'placeholder' => UsersWP_Defaults::registration_success_email_content(), |
| 277 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_all_email_tags() |
| 278 |
), |
| 279 |
|
| 280 |
array('type' => 'sectionend', 'id' => 'registration_success_email_settings'), |
| 281 |
|
| 282 |
array('name' => __('Forgot password email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'forgot_password_email_settings'), |
| 283 |
|
| 284 |
array( |
| 285 |
'name' => __('Enable email', 'userswp'), |
| 286 |
'desc' => __('Send an email to user for forgot password.', 'userswp'), |
| 287 |
'id' => 'forgot_password_email', |
| 288 |
'type' => 'checkbox', |
| 289 |
'default' => 1, |
| 290 |
), |
| 291 |
array( |
| 292 |
'name' => __('Subject', 'userswp'), |
| 293 |
'desc' => __('The email subject.', 'userswp'), |
| 294 |
'id' => 'forgot_password_email_subject', |
| 295 |
'type' => 'text', |
| 296 |
'class' => 'large-text', |
| 297 |
'desc_tip' => true, |
| 298 |
'advanced' => true, |
| 299 |
'placeholder' => UsersWP_Defaults::forgot_password_email_subject(), |
| 300 |
), |
| 301 |
array( |
| 302 |
'name' => __('Body', 'userswp'), |
| 303 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 304 |
'id' => 'forgot_password_email_content', |
| 305 |
'type' => 'textarea', |
| 306 |
'class' => 'code uwp-email-body', |
| 307 |
'desc_tip' => true, |
| 308 |
'advanced' => true, |
| 309 |
'placeholder' => UsersWP_Defaults::forgot_password_email_content(), |
| 310 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_all_email_tags() |
| 311 |
), |
| 312 |
|
| 313 |
array('type' => 'sectionend', 'id' => 'forgot_password_email_settings'), |
| 314 |
|
| 315 |
array('name' => __('Change password email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'change_password_email_settings'), |
| 316 |
|
| 317 |
array( |
| 318 |
'name' => __('Enable email', 'userswp'), |
| 319 |
'desc' => __('Send an email to user for change password.', 'userswp'), |
| 320 |
'id' => 'change_password_email', |
| 321 |
'type' => 'checkbox', |
| 322 |
'default' => 1, |
| 323 |
), |
| 324 |
array( |
| 325 |
'name' => __('Subject', 'userswp'), |
| 326 |
'desc' => __('The email subject.', 'userswp'), |
| 327 |
'id' => 'change_password_email_subject', |
| 328 |
'type' => 'text', |
| 329 |
'class' => 'large-text', |
| 330 |
'desc_tip' => true, |
| 331 |
'advanced' => true, |
| 332 |
'placeholder' => UsersWP_Defaults::change_password_email_subject(), |
| 333 |
), |
| 334 |
array( |
| 335 |
'name' => __('Body', 'userswp'), |
| 336 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 337 |
'id' => 'change_password_email_content', |
| 338 |
'type' => 'textarea', |
| 339 |
'class' => 'code uwp-email-body', |
| 340 |
'desc_tip' => true, |
| 341 |
'advanced' => true, |
| 342 |
'placeholder' => UsersWP_Defaults::change_password_email_content(), |
| 343 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_all_email_tags() |
| 344 |
), |
| 345 |
|
| 346 |
array('type' => 'sectionend', 'id' => 'change_password_email_settings'), |
| 347 |
|
| 348 |
array('name' => __('Reset password email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'reset_password_email_settings'), |
| 349 |
|
| 350 |
array( |
| 351 |
'name' => __('Enable email', 'userswp'), |
| 352 |
'desc' => __('Send an email to user for reset password.', 'userswp'), |
| 353 |
'id' => 'reset_password_email', |
| 354 |
'type' => 'checkbox', |
| 355 |
'default' => 1, |
| 356 |
), |
| 357 |
array( |
| 358 |
'name' => __('Subject', 'userswp'), |
| 359 |
'desc' => __('The email subject.', 'userswp'), |
| 360 |
'id' => 'reset_password_email_subject', |
| 361 |
'type' => 'text', |
| 362 |
'class' => 'large-text', |
| 363 |
'desc_tip' => true, |
| 364 |
'advanced' => true, |
| 365 |
'placeholder' => UsersWP_Defaults::reset_password_email_subject(), |
| 366 |
), |
| 367 |
array( |
| 368 |
'name' => __('Body', 'userswp'), |
| 369 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 370 |
'id' => 'reset_password_email_content', |
| 371 |
'type' => 'textarea', |
| 372 |
'class' => 'code uwp-email-body', |
| 373 |
'desc_tip' => true, |
| 374 |
'advanced' => true, |
| 375 |
'placeholder' => UsersWP_Defaults::reset_password_email_content(), |
| 376 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_all_email_tags() |
| 377 |
), |
| 378 |
|
| 379 |
array('type' => 'sectionend', 'id' => 'reset_password_email_settings'), |
| 380 |
|
| 381 |
array('name' => __('Account update email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'account_update_email_settings'), |
| 382 |
|
| 383 |
array( |
| 384 |
'name' => __('Enable email', 'userswp'), |
| 385 |
'desc' => __('Send an email to user when updating account details.', 'userswp'), |
| 386 |
'id' => 'account_update_email', |
| 387 |
'type' => 'checkbox', |
| 388 |
'default' => 1, |
| 389 |
), |
| 390 |
array( |
| 391 |
'name' => __('Subject', 'userswp'), |
| 392 |
'desc' => __('The email subject.', 'userswp'), |
| 393 |
'id' => 'account_update_email_subject', |
| 394 |
'type' => 'text', |
| 395 |
'class' => 'large-text', |
| 396 |
'desc_tip' => true, |
| 397 |
'advanced' => true, |
| 398 |
'placeholder' => UsersWP_Defaults::account_update_email_subject(), |
| 399 |
), |
| 400 |
array( |
| 401 |
'name' => __('Body', 'userswp'), |
| 402 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 403 |
'id' => 'account_update_email_content', |
| 404 |
'type' => 'textarea', |
| 405 |
'class' => 'code uwp-email-body', |
| 406 |
'desc_tip' => true, |
| 407 |
'advanced' => true, |
| 408 |
'placeholder' => UsersWP_Defaults::account_update_email_content(), |
| 409 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_all_email_tags(true, array('[#form_fields#]')) |
| 410 |
), |
| 411 |
|
| 412 |
array('type' => 'sectionend', 'id' => 'account_update_email_settings'), |
| 413 |
|
| 414 |
array('name' => __('Account new email activation email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'account_new_email_activation_email_settings'), |
| 415 |
|
| 416 |
array( |
| 417 |
'name' => __('Enable email', 'userswp'), |
| 418 |
'desc' => __('Send an email to user when updating account details.', 'userswp'), |
| 419 |
'id' => 'account_new_email_activation_email', |
| 420 |
'type' => 'checkbox', |
| 421 |
'default' => 1, |
| 422 |
), |
| 423 |
array( |
| 424 |
'name' => __('Subject', 'userswp'), |
| 425 |
'desc' => __('The email subject.', 'userswp'), |
| 426 |
'id' => 'account_new_email_activation_email_subject', |
| 427 |
'type' => 'text', |
| 428 |
'class' => 'large-text', |
| 429 |
'desc_tip' => true, |
| 430 |
'advanced' => true, |
| 431 |
'placeholder' => UsersWP_Defaults::account_new_email_activation_email_subject(), |
| 432 |
), |
| 433 |
array( |
| 434 |
'name' => __('Body', 'userswp'), |
| 435 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 436 |
'id' => 'account_new_email_activation_email_content', |
| 437 |
'type' => 'textarea', |
| 438 |
'class' => 'code uwp-email-body', |
| 439 |
'desc_tip' => true, |
| 440 |
'advanced' => true, |
| 441 |
'placeholder' => UsersWP_Defaults::account_new_email_activation_email_content(), |
| 442 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_all_email_tags(true, array('[#new_email#]', '[#new_email_link#]')) |
| 443 |
), |
| 444 |
|
| 445 |
array('type' => 'sectionend', 'id' => 'account_new_email_activation_email_settings'), |
| 446 |
|
| 447 |
array('name' => __('Account delete email', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'account_delete_email_settings'), |
| 448 |
|
| 449 |
array( |
| 450 |
'name' => __('Enable email', 'userswp'), |
| 451 |
'desc' => __('Send an email to user after deleting account from the site.', 'userswp'), |
| 452 |
'id' => 'account_delete_email', |
| 453 |
'type' => 'checkbox', |
| 454 |
'default' => 1, |
| 455 |
), |
| 456 |
array( |
| 457 |
'name' => __('Subject', 'userswp'), |
| 458 |
'desc' => __('The email subject.', 'userswp'), |
| 459 |
'id' => 'account_delete_email_subject', |
| 460 |
'type' => 'text', |
| 461 |
'class' => 'large-text', |
| 462 |
'desc_tip' => true, |
| 463 |
'advanced' => true, |
| 464 |
'placeholder' => UsersWP_Defaults::account_delete_email_subject(), |
| 465 |
), |
| 466 |
array( |
| 467 |
'name' => __('Body', 'userswp'), |
| 468 |
'desc' => __('The email body, this can be text or HTML.', 'userswp'), |
| 469 |
'id' => 'account_delete_email_content', |
| 470 |
'type' => 'textarea', |
| 471 |
'class' => 'code uwp-email-body', |
| 472 |
'desc_tip' => true, |
| 473 |
'advanced' => true, |
| 474 |
'placeholder' => UsersWP_Defaults::account_delete_email_content(), |
| 475 |
'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_delete_account_email_tags() |
| 476 |
), |
| 477 |
|
| 478 |
array('type' => 'sectionend', 'id' => 'account_delete_email_settings'), |
| 479 |
|
| 480 |
)); |
| 481 |
} else { |
| 482 |
$settings = apply_filters( 'uwp_email_settings', array( |
| 483 |
|
| 484 |
|
| 485 |
array('name' => __('Email sender options', 'userswp'), 'type' => 'title', 'desc' => '', 'id' => 'email_settings'), |
| 486 |
|
| 487 |
array( |
| 488 |
'name' => __('Sender name', 'userswp'), |
| 489 |
'desc' => __('How the sender name appears in outgoing UsersWP emails.', 'userswp'), |
| 490 |
'id' => 'email_name', |
| 491 |
'type' => 'text', |
| 492 |
'placeholder' => get_bloginfo('name'), |
| 493 |
'desc_tip' => true, |
| 494 |
), |
| 495 |
array( |
| 496 |
'name' => __('Email address', 'userswp'), |
| 497 |
'desc' => __('How the sender email appears in outgoing UsersWP emails.', 'userswp'), |
| 498 |
'id' => 'email_address', |
| 499 |
'type' => 'text', |
| 500 |
'placeholder' => UsersWP_Mails::get_mail_from(), |
| 501 |
'desc_tip' => true, |
| 502 |
), |
| 503 |
|
| 504 |
array('type' => 'sectionend', 'id' => 'email_settings'), |
| 505 |
|
| 506 |
array('name' => __('Email Template', 'userswp'), 'type' => 'title', 'desc' => sprintf( __( 'This section lets you customize the UsersWP email template. %sClick here to preview your email template%s.', 'userswp' ), '<a href="'.wp_nonce_url( admin_url( '?uwp_preview_mail=true' ), 'uwp-preview-mail' ).'" target="_blank">', '</a>' ), 'id' => 'email_template_settings'), |
| 507 |
|
| 508 |
array( |
| 509 |
'type' => 'select', |
| 510 |
'id' => 'email_type', |
| 511 |
'name' => __('Email type', 'userswp'), |
| 512 |
'desc' => __('Select format of the email to send.', 'userswp'), |
| 513 |
'options' => $this->get_email_type_options(), |
| 514 |
'default' => 'html', |
| 515 |
'desc_tip' => true, |
| 516 |
'advanced' => true, |
| 517 |
), |
| 518 |
array( |
| 519 |
'name' => __('Logo', 'userswp'), |
| 520 |
'desc' => __('Upload a logo to be displayed at the top of the emails. Displayed on HTML emails only.', 'userswp'), |
| 521 |
'id' => 'email_logo', |
| 522 |
'type' => 'image', |
| 523 |
'image_size' => 'full', |
| 524 |
'desc_tip' => true, |
| 525 |
), |
| 526 |
array( |
| 527 |
'name' => __('Footer Text', 'userswp'), |
| 528 |
'desc' => __('The text to appear in the footer of all UsersWP emails.', 'userswp'), |
| 529 |
'id' => 'email_footer_text', |
| 530 |
'type' => 'text', |
| 531 |
'class' => 'code', |
| 532 |
'desc_tip' => true, |
| 533 |
'placeholder' => $this->email_footer_text() |
| 534 |
), |
| 535 |
'email_base_color' => array( |
| 536 |
'id' => 'email_base_color', |
| 537 |
'name' => __( 'Base Color', 'userswp' ), |
| 538 |
'desc' => __( 'The base color for UsersWP email template. Default <code>#557da2</code>.', 'userswp' ), |
| 539 |
'default' => '#557da2', |
| 540 |
'type' => 'color', |
| 541 |
'desc_tip' => true, |
| 542 |
'advanced' => true, |
| 543 |
), |
| 544 |
'email_background_color' => array( |
| 545 |
'id' => 'email_background_color', |
| 546 |
'name' => __( 'Background Color', 'userswp' ), |
| 547 |
'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'userswp' ), |
| 548 |
'default' => '#f5f5f5', |
| 549 |
'type' => 'color', |
| 550 |
'desc_tip' => true, |
| 551 |
'advanced' => true, |
| 552 |
), |
| 553 |
'email_body_background_color' => array( |
| 554 |
'id' => 'email_body_background_color', |
| 555 |
'name' => __( 'Body Background Color', 'userswp' ), |
| 556 |
'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'userswp' ), |
| 557 |
'default' => '#fdfdfd', |
| 558 |
'type' => 'color', |
| 559 |
'desc_tip' => true, |
| 560 |
'advanced' => true, |
| 561 |
), |
| 562 |
'email_text_color' => array( |
| 563 |
'id' => 'email_text_color', |
| 564 |
'name' => __( 'Body Text Color', 'userswp' ), |
| 565 |
'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'userswp' ), |
| 566 |
'default' => '#505050', |
| 567 |
'type' => 'color', |
| 568 |
'desc_tip' => true, |
| 569 |
'advanced' => true, |
| 570 |
), |
| 571 |
'email_header_background_color' => array( |
| 572 |
'id' => 'email_header_background_color', |
| 573 |
'name' => __( 'Header Background Color', 'userswp' ), |
| 574 |
'desc' => __( 'The header background color of email template. Default <code>#555555</code>.', 'userswp' ), |
| 575 |
'default' => '#555555', |
| 576 |
'type' => 'color', |
| 577 |
'desc_tip' => true, |
| 578 |
'advanced' => true, |
| 579 |
), |
| 580 |
'email_header_text_color' => array( |
| 581 |
'id' => 'email_header_text_color', |
| 582 |
'name' => __( 'Header Text Color', 'userswp' ), |
| 583 |
'desc' => __( 'The footer text color. Default <code>#ffffff</code>.', 'userswp' ), |
| 584 |
'default' => '#ffffff', |
| 585 |
'type' => 'color', |
| 586 |
'desc_tip' => true, |
| 587 |
'advanced' => true, |
| 588 |
), |
| 589 |
'email_footer_background_color' => array( |
| 590 |
'id' => 'email_footer_background_color', |
| 591 |
'name' => __( 'Footer Background Color', 'userswp' ), |
| 592 |
'desc' => __( 'The footer background color of email template. Default <code>#666666</code>.', 'userswp' ), |
| 593 |
'default' => '#666666', |
| 594 |
'type' => 'color', |
| 595 |
'desc_tip' => true, |
| 596 |
'advanced' => true, |
| 597 |
), |
| 598 |
'email_footer_text_color' => array( |
| 599 |
'id' => 'email_footer_text_color', |
| 600 |
'name' => __( 'Footer Text Color', 'userswp' ), |
| 601 |
'desc' => __( 'The footer text color. Default <code>#dddddd</code>.', 'userswp' ), |
| 602 |
'default' => '#dddddd', |
| 603 |
'type' => 'color', |
| 604 |
'desc_tip' => true, |
| 605 |
'advanced' => true, |
| 606 |
), |
| 607 |
|
| 608 |
array('type' => 'sectionend', 'id' => 'email_template_settings'), |
| 609 |
|
| 610 |
)); |
| 611 |
} |
| 612 |
|
| 613 |
return apply_filters( 'uwp_get_settings_' . $this->id, $settings ); |
| 614 |
} |
| 615 |
|
| 616 |
/** |
| 617 |
* The default email footer text. |
| 618 |
* |
| 619 |
* @since 1.2.1.2 |
| 620 |
* @return string |
| 621 |
*/ |
| 622 |
public function email_footer_text(){ |
| 623 |
return apply_filters('uwp_email_footer_text', |
| 624 |
wp_sprintf( __( '%s - Powered by UsersWP', 'userswp' ), get_bloginfo( 'name', 'display' ) ) |
| 625 |
); |
| 626 |
} |
| 627 |
|
| 628 |
/** |
| 629 |
* Email type options. |
| 630 |
* |
| 631 |
* @since 1.2.1.2 |
| 632 |
* @return array |
| 633 |
*/ |
| 634 |
public function get_email_type_options() { |
| 635 |
$types = array(); |
| 636 |
if ( class_exists( 'DOMDocument' ) ) { |
| 637 |
$types['html'] = __( 'HTML', 'userswp' ); |
| 638 |
} |
| 639 |
$types['plain'] = __( 'Plain text', 'userswp' ); |
| 640 |
|
| 641 |
return $types; |
| 642 |
} |
| 643 |
|
| 644 |
} |
| 645 |
|
| 646 |
endif; |
| 647 |
|
| 648 |
return new UsersWP_Settings_Email(); |