Esscotti Web development & SEO

20Sep/090

Disabling new user email notifications in Wordpress

Sometimes there is a need to disable the email that is automatically sent to newly registered users. One example might be if you are setting up new users in your blog and don't want these new users to be notified until the data-entry has been completed.

This can be done by modifying the file /wp-includes/pluggable.php. Locate the function wp_new_user_notification(). This starts on line 1144 in Wordpress version 2.8.5.


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);

 $messageĀ  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
 $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
 $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";

 @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);

 if ( empty($plaintext_pass) )
 return;

 $messageĀ  = sprintf(__('Username: %s'), $user_login) . "\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'), get_option('blogname')), $message);
}

Simply comment out the last line to disable the email..


// wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
Filed under: Code, Wordpress No Comments
19Sep/090

TinyMCE not working in IE6 – solved

If you got TinyMCE working in most browsers except IE6 then first check how you reference the tinymce javascript file.

We had the following


<!-- TinyMCE -->
 <script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
 <script type="text/javascript">
 tinyMCE.init({
 mode : "textareas",
 theme : "advanced"
 });
 </script>
 <!-- /TinyMCE -->

...which is wrong. The correct code is


<!-- TinyMCE -->
 <script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
 <script type="text/javascript">
 tinyMCE.init({
 mode : "textareas",
 theme : "advanced"
 });
 </script>
 <!-- /TinyMCE -->

Note the src="/js/tiny_mce/tiny_mce.js" The problem was reported by a client that were using IE6 and could not upgrade to anything else for internal IT-policy reasons. We easily found the error by looking at the apache error logs on their virtual private server which showed.


[Thu Nov 19 13:20:13 2009] [error] [client xx.xx.xx.xx] Invalid URI in request GET /../js/tiny_mce/themes/advanced/editor_template.js HTTP/1.1, referer: http://www.example.com/admin/

It seems the client (the web-client, i.e. IE6) had introduced an extra slash '/' before the javascript filename. Hope this helps someone.