As there are locked posts on this site I had to think of a way of getting the password for these posts as well as the registration information to the registrant in the same email. I did not want to use a plugin if I could avoid it and eventually settled on the following solution.
Open pluggable.php (wp-includes/pluggable.php) and around line 1017 you will find the following code:
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
$message .= site_url("wp-login.php", 'login') . "\r\n";
Place the following code directly after the last line of the preceding code:
$message .= __('Your message here');
A simple and effective solution. The downside is that this solution necessitates an alteration of a core file. This works in WordPress version 2.6.2./2.6.3. I have not tried with other versions of wordpress.
Please remember to make a note of the core file you have altered. When you update WordPress you will have to make the same alteration to the updated file manually.
