• Hello,

    im trying to replace a function in pluggable.php, where i can define some options to use instead of the predefined text.

    It is the wp_new_user_notification function, and i know a lot of people ask on here about changing the text etc, and i know there is already the custom log in plugin that can change this, but i know people have had problems with it, so i thought i’d have a go at writing my first plugin.

    i keep getting a fatal error though, and i know that the offending code is this bit, as without it, the rest of the plugin functions fine.

    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(__('Hi %s'), $user_login) . "\r\n";
    	$message .= $emailOptions('newuseremailtext') . "\r\n";
    	$message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
    	$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
    
    	wp_mail($user_email, $emailOptions('newuseremailsubject'), get_option('blogname')), $message);
    
    }

    I have $emailOptions defined to be get_option, this is after following the devlounge plugin series.

    as it is my first plugin, i cant see what is wrong, and this function hasnt really had much changed, so its annoying that i cant sort it!!

    thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Alex Cragg

    (@epicalex)

    an update, i have narrowed down the error to this line –
    wp_mail($user_email, $emailOptions('newuseremailsubject'), get_option('blogname')), $message);

    and so i replaced it with the default

    wp_mail($user_email, sprintf(__('[%s] Welcome to my test blog'), get_option('blogname')), $message);

    this allowed the plugin to be enabled, but when i register a new user, the new text i defined isnt being used, but it is in the options database.

    is there something else i need to do to get this function to work? can it not be independent?

    Thread Starter Alex Cragg

    (@epicalex)

    ok, so the text i am defining just isnt being used at all, can someone tell me what i need to hook into to get this to be used, i have tried the following in add_action; user_register, register_post, register_form and wp_mail, none of which worked.

    Can someone please point me in the right direction? maybe i am not explaining well, or people just dont know what i am asking, so please say if you need more info to help.

    thanks

    ringostar

    (@ringostar)

    any solution found yet ? I had this working prior to 2.3 by adding a message to pluggable.php but now its not working which is strange, they must have did something to the core

    Thread Starter Alex Cragg

    (@epicalex)

    Hey, yeah it’s all sorted, head to New User Email Setup for the download.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Replacing a function in pluggable.php’ is closed to new replies.