azureardee
Forum Replies Created
-
Forum: Hacks
In reply to: Fatal error: Cannot redeclare wp_new_user_notification()Hello SFC,
I hope this is still useful to you, but I shall reply so that others can benefit from this.
You just have to add the condition
if (!function_exists('wp_new_user_notification') {
before your function. Don’t worry, it will still override the default pluggable method. I think the plug-in is loaded *before* pluggable.php, but register_activation_hook (the action that corresponds when you “Activate” a plug-in) is loaded *after* pluggable.php. So yes, you still need to check.<?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 */ if (!function_exists('wp_new_user_notification') { 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); } } ?>
Forum: Plugins
In reply to: Fatal error: Call to undefined function remove_meta_box()Thank you for this! I had the same problem, and putting remove_meta_box in admin_head did the trick. Thanks again!
Forum: Fixing WordPress
In reply to: Admin widget drag and drop not working+1 for Use Google Libraries. It solved my drag and drop problem with the Widgets admin page. It rocks.
Forum: Fixing WordPress
In reply to: Autosave empties Custom Post FieldsI guess what you need is DOING_AUTOSAVE: (from https://www.andrewgail.com/wordpress-autosave-and-custom-fields/)
global $post;
if (defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) {
return $post->ID;
}Forum: Fixing WordPress
In reply to: Autosave empties Custom Post FieldsStrange, the function wp_is_autosave()doesn’t seem to exist
Additional update: I am using Notepad++ as my plugin editor, and if I encode the file to UTF-8 without BOM, the unexpected error message goes away as well…
Hello guys,
I had this very same issue. After several minutes of tinkering around, I found that the plugin I am creating outputs that error if I encode the plugin (the plugin being a one-file program) into UTF-8.
If I encode it back to ANSI, the error disappears.
I wish this observation helps the WordPress developers to solve this bug.