Support Forum

How do I customize the subscription notification emails?

JD jdevore
jdevore
Member

The notification emails are displaying the name of my news site The Link rather than the name of the forum which happens to be called xChange. 

How can I customize notification emails/ subject line / body text?

 

Thank you.

34 Answers

New Answer

MP Mr Papa
Mr Papa
Member

yes, the subscriptions use your site name…  seemed natural… frankly no one has asked for anything different…

but you can use a filter (standard to wp) to change it…  use the filter:  sph_subscriptions_notification

and you can replace the sitename with the forum name if you like…

if you are unsure how to use wp filters, here is a reference:   http://codex.wordpress.org/Function_Reference/add_filter

come on back if you need more help past that…

JD jdevore
jdevore
Member

Thanks for your response. 

 

Do I make the replacement in my wp-config.php file?

 

Not sure which line of code to replace the sph_subscriptions_notification with?

MP Mr Papa
Mr Papa
Member

no, as I said, it would go in the spFunctions.php file of your sp theme…  so something like:

add_filter('sph_subscriptions_notification', 'my_subs_title');
function my_subs_title($content) {
    $content = str_replace('blog title', 'forum name', $content);
    return $content;
}

of course, replace ‘blog title’ with what you want to replace and change ‘forum name’ to what you want to replace it with…

also, be sure to make your own sp theme:  http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/

JD jdevore
jdevore
Member

I followed all of the instructions. The only part I was unsure about was modifying the spFunctions.php file. I tried to add the filter into the code. Here is what I did: 

 

<?php

# ————————————————————————————–

#

# Simple:Press Theme custom function file

# Theme : mytheme

# File : custom functions

# Author : Simple:Press

#

# The ‘functions’ file can be used for custom functions & is loaded with each template

#

# ————————————————————————————–

add_action(‘init’, ‘spmytheme_textdomain’);

# load the theme textdomain for tranlations

function spmytheme_textdomain() {

sp_theme_localisation(‘spmytheme’);

}

add_filter(‘sph_subscriptions_notification’, ‘my_subs_title’); function my_subs_title($content) {

$content = str_replace(‘The Link’, ‘xChange Forum’, $content);

return $content;

}

if(function_exists(‘sp_FontResizer’)) {

add_action(‘sph_BeforeDisplayStart’, ‘spDefault_spShowFontResize’);

}

function spmytheme_spShowFontResize() {

$tipMinus = __sp(‘decrease forum font size’);

$tipReset = __sp(‘reset forum font size’);

$tipPlus = __sp(‘increase font size’);

sp_FontResizer(‘tagClass=spFontSizeControl spRight’, $tipMinus, $tipReset, $tipPlus);

sp_InsertBreak(‘direction-right’);

}

?>

 

Here is the error message I received:

Warning: Cannot modify header information – headers already sent by (output started at /problem-with-post-edit-buttonome/cpsirv/public_html/marketing/thelink/wp-content/sp-resources/forum-themes/mytheme/templates/spFunctions.php:40) in /problem-with-post-edit-buttonome/cpsirv/public_html/marketing/thelink/wp-content/plugins/simple-press/sp-startup/site/sp-ahah-handler.php on line 21

Warning: Cannot modify header information – headers already sent by (output started at /problem-with-post-edit-buttonome/cpsirv/public_html/marketing/thelink/wp-content/sp-resources/forum-themes/mytheme/templates/spFunctions.php:40) in /problem-with-post-edit-buttonome/cpsirv/public_html/marketing/thelink/wp-includes/pluggable.php on line 881

MP Mr Papa
Mr Papa
Member

hmm… just tested it and it works fine…

can you check your code, in the actual file and make sure the single quotes are proper?  might be worth typing over in case copying from here got different encoded quotes…

JD jdevore
jdevore
Member

Doesn’t seem to be working for me. Odd. I must be doing something wrong. How would I just change the portion that says: Forum Post – 

to CPS Forum Post?

MP Mr Papa
Mr Papa
Member

same kind of hook…  just change the two strings in str_replace… first is from, second is to…

which line is 40 in you spFunctions.php file?  might be worth posting the added code again…  when you copied mine, did you do copy the code using the raw code button? or directly from the post?  the former of course is the proper way…

JD jdevore
jdevore
Member

I copied the raw code. It’s not working. So perhaps, I missed something along the way following the theme creation instructions. 

 

Or perhaps, this isn’t the correct place to insert the filter. I also don’t understand your post above. change the two strings in str_replace … Are you saying I would just need to insert what I want replaced first and then content I want to replace it with second? Would be nice if I could get this to work. 

Thanks for your help.

spFunctions-code.PNG
MP Mr Papa
Mr Papa
Member

Can you set me up a temp account with wp admin and SP admin caps? If doable, please pm and I can try to look into tonight.

MP Mr Papa
Mr Papa
Member

so not sure what the issue is…  put my code back in your spFunctions.php fille…  made a post and it was successful with no errors… and it says it sent subscription notices…

can you confirm?

JD jdevore
jdevore
Member

Hi. So where are we at with this? Still waiting to hear back regarding this. 

Any updates? 

JD jdevore
jdevore
Member

Yeah, I see that. Its not working man. Switch the forum to mytheme and it breaks. I get the error I already supplied. 

How do we move forward. This back and forth thing is killing me. Subscription notices are not displaying the changes I made to the subject line.

 

Thanks.