| | 320 | if ( !function_exists('wp_password_change_notification') ) : |
| | 321 | /** |
| | 322 | * Notify the blog admin of a user changing password, normally via email. |
| | 323 | * |
| | 324 | * NOTE: The method of overriding this function has been deprecated. The provided hooks should be used instead. |
| | 325 | * |
| | 326 | * @since 2.7 |
| | 327 | * |
| | 328 | * @param object $user User Object |
| | 329 | */ |
| | 330 | function wp_password_change_notification(&$user) { |
| | 331 | // Allow plugins to short-circuit notification |
| | 332 | $disable = apply_filters('disable_password_change_notification', false, $user); |
| | 333 | if ( $disable ) |
| | 334 | return; |
| | 335 | |
| | 336 | do_action('password_change_notification', $user); |
| | 337 | // send a copy of password change notification to the admin |
| | 338 | // but check to see if it's the admin whose password we're changing, and skip this |
| | 339 | if ( $user->user_email != get_option('admin_email') ) { |
| | 340 | $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; |
| | 341 | // The blogname option is escaped with esc_html on the way into the database in sanitize_option |
| | 342 | // we want to reverse this for the plain text arena of emails. |
| | 343 | $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
| | 344 | |
| | 345 | $title = sprintf(__('[%s] Password Lost/Changed'), $blogname); |
| | 346 | |
| | 347 | $title = apply_filters('password_change_admin_notification_title', $title); |
| | 348 | $message = apply_fitlers('password_change_admin_notification_message', $message, $user); |
| | 349 | |
| | 350 | @wp_mail(get_option('admin_email'), $title, $message); |
| | 351 | } |
| | 352 | } |
| | 353 | endif; |
| | 354 | |
| | 355 | if ( !function_exists('wp_new_user_notification') ) : |
| | 356 | /** |
| | 357 | * Notify the blog admin of a new user, normally via email. |
| | 358 | * |
| | 359 | * NOTE: The method of overriding this function has been deprecated. The provided hooks should be used instead. |
| | 360 | * |
| | 361 | * @since 2.0 |
| | 362 | * |
| | 363 | * @param int $user_id User ID |
| | 364 | * @param string $plaintext_pass Optional. The user's plaintext password |
| | 365 | */ |
| | 366 | function wp_new_user_notification($user_id, $plaintext_pass = '') { |
| | 367 | $user = new WP_User($user_id); |
| | 368 | |
| | 369 | // The blogname option is escaped with esc_html on the way into the database in sanitize_option |
| | 370 | // we want to reverse this for the plain text arena of emails. |
| | 371 | $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
| | 372 | |
| | 373 | // Allow plugins to short-circuit admin notification |
| | 374 | $disable = apply_filters('disable_new_user_admin_notification', false, $user); |
| | 375 | if ( ! $disable ) { |
| | 376 | do_action('new_user_admin_notification', $user); |
| | 377 | |
| | 378 | $user_login = stripslashes($user->user_login); |
| | 379 | $user_email = stripslashes($user->user_email); |
| | 380 | |
| | 381 | $message = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n"; |
| | 382 | $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; |
| | 383 | $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; |
| | 384 | |
| | 385 | $title = sprintf(__('[%s] New User Registration'), $blogname); |
| | 386 | |
| | 387 | $title = apply_filters('new_user_admin_notification_title', $title); |
| | 388 | $message = apply_filters('new_user_admin_notification_message', $message, $user); |
| | 389 | |
| | 390 | @wp_mail(get_option('admin_email'), $title, $message); |
| | 391 | } |
| | 392 | |
| | 393 | if ( empty($plaintext_pass) ) |
| | 394 | return; |
| | 395 | |
| | 396 | // Allow plugins to short-circuit user notification |
| | 397 | $disable = apply_filters('disable_new_user_notification', false, $user); |
| | 398 | if ( ! $disable ) { |
| | 399 | do_action('new_user_notification', $user, $plaintext_pass); |
| | 400 | |
| | 401 | $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; |
| | 402 | $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; |
| | 403 | $message .= wp_login_url() . "\r\n"; |
| | 404 | |
| | 405 | $title = sprintf(__('[%s] Your username and password'), $blogname); |
| | 406 | |
| | 407 | $title = apply_filters('new_user_notification', $title); |
| | 408 | $message = apply_filters('new_user_notification', $message, $user, $plaintext_pass); |
| | 409 | |
| | 410 | wp_mail($user_email, $title, $message); |
| | 411 | } |
| | 412 | } |
| | 413 | endif; |
| | 414 | |