Support Forum
I'm seeking to tweak the $replyto in sp-post-support.php so that it is different than the blog site email (long story behind the "why"). Right now, the stock code has this:
$replyto = apply_filters('sph_email_replyto', '', $newpost);
I'm not certain what this function is doing, but $replyto is of course used later in sp_send_email. However, when I test what $replyto is, it seems blank as far as I can tell (which I guess is fine as the default). While the email is being sent "From" the blog email (which is fine), I want the reply-to to be the email of the user who posted. So I tried this:
$replyto = $newpost['posteremail'];
or, I've tried
$replyto = 'Reply-to: ' . $newpost['postername'] . ' <' . $newpost['posteremail'] . '>';
Or other variations like that. But it seems to be bombing as the emails that normally go to admins don't work when I do that.
Please help? Thanks!
its a standard wordpress filter... see more: https://codex.wordpress.org/Plugin_API
so you would want something like:
add_filter('sph_email_replyto', 'my_reply_to', 10, 2); function my_reply_to($reply, $newpost) { $reply = 'someone@site.com'; return $reply; }
keep in mind, the reply to is an email address... so must be valid email address... you have text (reply-to) in there... and to be honest, not sure if wp email supports annotated emails like that.. you might just be a plain email address...
Visit Cruise Talk Central and Mr Papa's World
No, don't edit our code. The purpose is filters is to allow you to interact and change our code without actually modifying it. That way you won't lose changes on upgrades.
You put them code I posted in your spFunctions.php file of your simple press theme in use. You will want to create a child theme first. We provide ready made child themes I out store to get your started (free)..
Also, check out our codex article https://simple-press.com/docum.....-theme/:
Visit Cruise Talk Central and Mr Papa's World
Okay - I placed it in our custom theme's functions. Still no luck. All I did was replace 'someone@site.com' with $newpost['posteremail']. I'm not getting a php error, but the email is not being sent out. When I remove those few lines of code however, an email does get sent out. So just to be clear, here's what I added to spFunctions...
add_filter('sph_email_replyto', 'my_reply_to', 10, 2);
function my_reply_to($reply, $newpost) {
$reply = $newpost['posteremail'];
return $reply;
}
I think the function looks fine. @mr-papa - would you agree with that? Although perhaps I would change the 10 to a higher number to make sure it gets run last.
So could it be that the email send - or perhaps receive - is baulking because the recipient and the reply to of the email are one and the same? Which, let's be honest - doesn't really make any logistical sense.
But then I am no real expert on the emails...
YELLOW
SWORDFISH
|
I don't think the recipient = sender. So here's what I think I'd like to happen...
Actual sender is the main admin email of the blog.
The poster is the person posting the forum item and I think their email = $newpost[‘posteremail’]
The recipient is the email address(es) of the forum admins, none of whom = main admin email of the blog.
The reason I do it this way is because one of the forum admins has an email address that is actually a distribution list (google groups), so that when someone posts to our church forum, everyone who is part of the group gets copied. But when someone replies to that email, I want the reply-to to go back to the original poster, and not to the un-monitored main blog admin email. Everything works well with the set-up, except for the reply-to part.
It would be better if you posted your code and use the syntax highlighter so the code stays as code... after pasting, select your code with mouse, then use the highlighter button on editor toolbar (looks like piece of paper and down arrow next to it).. that way we can make sure code is valid easier...
are you running any other sp plugins? there are others that use same filter, so like andy says, 99 would make sure its last one to run... but that wouldnt cause email to not be sent...
so to verify what you want to do... this email is being sent to admins of your site, letting them know there is a new post... if the admins (or your list) should reply, you want it back to the poster? is google groups really email? or an online bb/forum you got to read? just trying to understand how it would work...
I assume on forum - options - email settings, you have enabled simple press email address settings (upper right)??
Visit Cruise Talk Central and Mr Papa's World
Thank. Here's the code (for me to practice)...
function my_reply_to($reply, $newpost) {
$reply = $newpost[‘posteremail’];
return $reply;
}
With respect to what I'm trying to do...
1) Let's say blog general admin email address is Email_A
2) Google groups allows you to send a broadcast email to all members of a group once an email is sent to a special Google email (Email_B)
3) I created a Forum Admin account with email address = Email_B
4) When someone (with address Email_C) posts to the Forum, the "fake" account with Email_B will get an email from Email_A, since forum admins are notified automatically
5) Once Email_B receives the email from Email_A, the group gets the broadcast (Email_D, E, F, etc.)
6) So now, person Email_F gets an email through Google groups - he sees that it came from Email_A (blog email) via Email_B (google groups email). When he clicks on REPLY, it defaults to going back to Email_A. Instead, I would love for the reply-to to default to going back to Email_C.
7) Because of permissions issues on my host, etc., the email has to come from Email_A to Email_B. But I think we can set the reply-to to be equal to Email_C. At one point I had this working but have since lost the coding that did it (stupid me).
Thank. Here’s the code (for me to practice)…
function my_reply_to($reply, $newpost) {
$reply = $newpost[‘posteremail’];
return $reply;
}
With respect to what I’m trying to do…
1) Let’s say blog general admin email address is Email_A
2) Google groups allows you to send a broadcast email to all members of a group once an email is sent to a special Google email (Email_B)
3) I created a Forum Admin account with email address = Email_B
4) When someone (with address Email_C) posts to the Forum, the “fake” account with Email_B will get an email from Email_A, since forum admins are notified automatically
5) Once Email_B receives the email from Email_A, the group gets the broadcast (Email_D, E, F, etc.)
6) So now, person Email_F gets an email through Google groups – he sees that it came from Email_A (blog email) via Email_B (google groups email). When he clicks on REPLY, it defaults to going back to Email_A. Instead, I would love for the reply-to to default to going back to Email_C.
7) Because of permissions issues on my host, etc., the email has to come from Email_A to Email_B. But I think we can set the reply-to to be equal to Email_C. At one point I had this working but have since lost the coding that did it (stupid me).
1 Guest(s)