Support Forum
Hi -
I'd like to change the unsubscribe url given by default at the bottom of notification emails. The current default one isn't working for me as it doesn't properly insert their username into the url, triggering a redirect to another page. Is there a filter I can add to my functions.php file to modify this url?
The current line says: 'To unsubscribe, please visit your profile: http://everydayfeminism.com/fo.....scriptions'
Thanks!
Derek
It should work OK if they are still logged in to your site or still have an active cookie. If not then that login step is still going to be necessary. The normal SP profile URLs do not, in normal use, actually pass the user name or ID.
The nearest filter available would be 'sph_subscriptions_notification_email' which passes in 3 parameters. First is the email message text, next the post details array as a second parameter. The third parameter is the users ID.
YELLOW
SWORDFISH
|
The unsubscribe URL currently links to "...profile/?ptab=subscriptions&pmenu=topic-subscriptions". I would like to change this to "profile/?ptab=subscriptions&pmenu=forum-subscriptions" to make it easier for my members to unsubscribe from a forum since we are primarily using forum subscriptions not topic subscriptions. Is this possible?
you would need to hook into the message prior to it being sent and do a php str_replace on the url with the updated on...
the filter to use would be: sph_subscriptions_notification
do you know how wp filters work?
Visit Cruise Talk Central and Mr Papa's World
here is wp codex entry: http://codex.wordpress.org/Plugin_API
so something like:
add_filter('sph_subscriptions_notification', 'my_url_changer', 10, 2);
function my_url_changer($msg, $newpost) {
$msg = str_replace('old_url', 'new_url', $msg);
return $msg;
}
of course, untested and you have to put in the original url and new url...
Visit Cruise Talk Central and Mr Papa's World
I have studied the WP codex page you referenced. I think I understand the filter concept now and the code you suggested. The only thing I am not sure of is where exactly I should insert this code. Does it go into one of the existing php files, or do I need to create a child theme and put this into a new functions.php file?
I have been reading about child themes recently and I understand this is the best way to make modifications of WP code so changes are not lost during updates. This will be my first attempt at doing code modification so I really appreciate any extra assistance you can provide.
1 Guest(s)