Support Forum

Private Messaging – automatically set "Receive an email when … private message" for new users

SS Sebastian Schimpf
Sebastian Schimpf
Member

Hi there,

I am working on a private forum and would like to set up the messaging feature to be easy to use for every body. I believe that the option “Receive an email when someone sends you a private message” should be activated by default for our users because it is challenging to explain to all users that they should activate it to receive an email when getting messages.
The hint for new messages in the inbox is so subtle in the interface that I believe even if people are logged in by chance when they have a new message, they may just overlook the tiny number in the “inbox” button.

Is there a way to activate the “email notification” option by default, so users don’t have to activate it manually?

Warm regards,
Sebastian

 

 

13 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

If you have the option that allows email notifications turned on – then the default for users in their SP profile, should also be on by default…?

SS Sebastian Schimpf
Sebastian Schimpf
Member

I just created a new user and indeed, the option is activated by default. Yay!
“Problem” solved! 🙂 Thanks!

SS Sebastian Schimpf
Sebastian Schimpf
Member

Hi Swordfish,
could you tell me how I can change the subject of the notification email that WordPress sends out through the Private Messaging plugin?

screenshot_8.png

The emails that I get show the right Sender Name now but the title of the website is put in front of the Subject and it does not make sense here.
Is there a way to modify the subject?

YS Yellow Swordfish
Yellow Swordfish
Member

There are 2 ways if doing this. The first would be to install our HTML Email plugin which lets you change virtually all emails that SP sends.

Or – for this particular instance, there is a standard WordPress filter you can use. The filter is:

‘sph_pm_email_subject’

and it passes 4 arguments –  $subject, $email, $sender, $newpm);

Whatever you return from the call will be the new subject text.

There are two places to add filter code. One would be in the spFunctions file of your child theme. The other method is to create a new php file in the wp-content folder named ‘sp-user-functions.php’ which is entirely safe from any update we may make in the future. This file will always be loaded if it exists.

SS Sebastian Schimpf
Sebastian Schimpf
Member

Hi,

I would like to try to use the sph_pm_email_subject.php in /wp-content/.

How do I link this function to only one particular event? I only need to change the subject of the notification for a private message. Other emails that SP sends are fine I think.

And to use the function …
would it look like this:
sph_pm_email_subject(‘my subject’, ‘test@test.com’, ‘Sender Name’, $newpm);

What is “$newpm”?
And how do I put this into a working filter?

YS Yellow Swordfish
Yellow Swordfish
Member

Do you not know how to write WordPress filters?

SS Sebastian Schimpf
Sebastian Schimpf
Member

would it look like this?

apply_filters( ‘sph_pm_email_subject’, ‘my subject’, ‘test@test.com’, ‘Sender Name’, $newpm);

YS Yellow Swordfish
Yellow Swordfish
Member

No.

Like:

add_filter('sph_pm_email_subject', 'your_function_name', 1, 4);
function your_function_name($subject, $email, $sender, $newpm) {
    $subject = 'whatever text you want it to say';
    return $subject;
}

I didn’t test this by the way!

SS Sebastian Schimpf
Sebastian Schimpf
Member

Thank you!
That looks proper! 😀

But
How do I link this function to only one particular event? I only need to change the subject of the notification for a private message. Other emails that SP sends are fine I think.

Any chance that you have a trick for that?

YS Yellow Swordfish
Yellow Swordfish
Member

that is what the filter is for. Hence the name of the filter

SS Sebastian Schimpf
Sebastian Schimpf
Member

That makes perfect sense. 🙂
Thank you!

SS Sebastian Schimpf
Sebastian Schimpf
Member

The filter in that php file works fine!
Thanks again for providing an easy solution, brother!