Fatal error: Cannot redeclare wp_new_user_notification()
-
I receive the error Fatal error: Cannot redeclare wp_new_user_notification() (previously declared in C:\inetpub\wwwroot\inet_IPS\projectA\wordpress\wp-includes\pluggable.php:1193) in C:\inetpub\wwwroot\inet_IPS\projectA\wordpress\wp-content\plugins\new_user_notification.php on line 49
The point of my plugin is to redefine the pluggable function wp_new_user_notification() and add the phone number to the email output? What am I doing wrong? Is my plugin syntax wrong at the top in the header or do I need to do something different to use one of the pluggable functions?
Thanks,
SFC<?php /* Plugin Name: wp_new_user_notification add phone Plugin URI: https://InternetProgrammingServices.com/ Description: wp_new_user_notification with the addition of phone added to email sent to admin Author: Susan F. Cooley Version: 1 Author URI: https://InternetProgrammingServices.com/ */ /** * Notify the blog admin of a new user, normally via email. * * @since 2.0 * * @param int $user_id User ID * @param string $plaintext_pass Optional. The user's plaintext password */ function wp_new_user_notification($user_id, $plaintext_pass = '') { $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); $phone = get_user_meta( $user_id ,'phone' , true); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $message .= sprintf(__('Phone: %s'), $phone) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if ( empty($plaintext_pass) ) return; $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; $message .= sprintf(__('Phone: %s'), $phone) . "\r\n"; $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; $message .= wp_login_url() . "\r\n"; wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); } ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Fatal error: Cannot redeclare wp_new_user_notification()’ is closed to new replies.