New Topic Notification: No Content
-
I installed bbPress Notify (No spam) on 9/15/15 (and uninstalled bbPress Notify that was not sending topic or reply content). Replies started showing content in the emails immediately, but it appears the topic content was still not being attached.
Today I wanted to troubleshoot this and I saw a new update was available. I assumed this might have something to do with my problem so I installed this recent update and attempted to make a new topic. The content for topics is still not inserted into the administrator emails.
After reading the previous topic “new topic emails stopped working” I realized that I was not the only one having problems, but also that you had attempted to resolve this with the update, am I correct?
Should I attempt the solution you suggested in that topic or was the update the correct way to approach resolving this?
Is there anything else I should be doing to troubleshoot this?
Thank you,
Matoca
-
Hi Matoca,
I don’t quite understand the problem you’re having. Are you saying that you receive messages but with no content in the body?
The problem occurring in the ‘new topic emails stopped working’ was that UTF-8 characters in the Subject line were causing the messages to not get sent. The initial fix was to simply transform the characters into their HTML entity representation. Version 1.9 has an improved implementation using “quoted-printable” encoding to make the characters appear as they should.
Please explain exactly what kind of error you’re seeing.
Cheers,
VinnyExactly. The administrator emails are generated when a new topic is made, they have all the correct formatting for a notification email, and mirror exactly what the reply notifications look like. Except under Content: there is nothing.
This was exactly the problem I was having with bbPress Notify except there was no content for BOTH replies and topics.
bbPress Notify (no spam) IS correctly generating reply notifications and they DO contain the Content:
I’ve rechecked the settings in the dashboard and all the correct items are checked for both replies and topics.
This is the email notification from a test topic I made this afternoon.
Hello!
A new topic has been posted by Patrice.
Topic title: Testing Notification
Topic url: http://www.secondchanceaihadogs.com/forums/topic/testing-notification/Content:
The topic content should be: “Look under the dog bed.”
Here is the email notification of a reply to this topic in the forum.
Hello!
A new reply has been posted by Brigitte.
Topic title: Reply To: Testing Notification
Topic url: http://www.secondchanceaihadogs.com/forums/reply/14239/Content:
I did check the dog bed…:) Nothing there and nothing in my email either:(So my moderators are getting the new topic notification email as well, but they also do not see any content. They have to go to the forum to read the content.
my best
matocaPlease provide the email template in Settings -> Forums.
blogname New topic: [topic-title]
Hello!
A new topic has been posted by [topic-author].
Topic title: [topic-title]
Topic url: [topic-url]Content: [topic-content]
blogname [reply-title]
Hello!
A new reply has been posted by [reply-author].
Topic title: [reply-title]
Topic url: [reply-url]Content: [reply-content]
I’ve just applied your 1.9.1 update and retested by making two new topics. Both have empty content in the notification email.
The replies have the content in the body of the notification email.
http://www.secondchanceaihadogs.com/forums/forum/aiha-dog/Got me. The templates look correct to me, but I’ve stared at them so long I can’t be sure anymore.
my best
MatocaYes, they do look good. You’ll need to add some debugging code to figure out what’s wrong. As you’re using 1.9.1, you can take advantage of the new action I added:
do_action( 'bbpnns_before_wp_mail', $user_info, $filtered_subject, $filtered_body, $recipient_headers );In your functions.php, add the following (replace
$post_idwith the ID that you’re testing against):function bbpnns_debug( $user_info, $filtered_subject, $filtered_body, $recipient_headers ) { error_log(__LINE__ . ' before sending mail: ' . print_r( array( 'user_id' => $user_info->ID, 'subject' => $filtered_subject, 'body' => $filtered_body, 'headers' => $recipient_headers, 'content' => bbp_get_topic_content( $post_id ) ),1) ); } add_action( 'bbpnns_before_wp_mail', 'bbpnns_debug', 10, 4 );That will show you whatever is being passed to
wp_mail(). Note thaterror_log()will print to your webserver’s log files. We’re also fetching the content that would replace the[topic-content]tag.Note: If you’re using Godaddy, I strongly recommend that you add the following 2 extra parameters:
error_log(__LINE__ . ' before sending mail: ' . print_r( array( 'user_id' => $user_info->ID, 'subject' => $filtered_subject, 'body' => $filtered_body, 'headers' => $recipient_headers, 'content' => bbp_get_topic_content( $post_id ) ),1), 3, dirname(__FILE__) . '/out.log');That makes the data be written to an
out.logfile next to your functions.php. Give it a few minutes to show, as Godaddy has some type of filesystem caching and it takes a while for new content to show up.Let me know how it goes.
Sorry for the delay in getting back. I needed to have some time to try this.
I have a question. I am in my functions.php file and I have the above code pasted. I understand that you want me to “replace $post_id with the ID that you’re testing against.” Exactly what do you require here?
I understand that each new topic is given an ID number (and I assume this is what you want), however I do have to make a new topic in order to get that number. How would this test work if I am using a number for a topic that has already been made and the notification email has already gone out?
I posted the new topic just now, but had not done anything yet to the functions.php file. And the notification worked properly, the content is in the body!
The last new topic was made on 9/25/15 and that had no content in the notification email.
What has happened that is different from 4 days ago?
thank you, MatocaHi Matoca,
There’s actually a bug in my debug. I forgot to add
global $post_id;at the top of the function. I don’t want you to replace anything – it’s just supposed to get the content to make sure there’s nothing in there that would break the message.As for changes in the last 4 days, there have been none. My latest update was on September 20th when I released version 1.9.1 which handles a fix for UTF-8 characters in the subject line, among other improvements.
Thanks for the quick reply!
Ok, I understand about the global $post_id. If I need to use this I will make that change.
Perhaps just installing the version update was enough to fix the topic problem? (The replies have been working fine.)
You added a fix for the UTF-8 characters in the subject line. However you can see from this topic notification email from today that I am still having this problem. It’s not a huge problem for me personally. I just want the content! And why is the content text in the email there twice?
my best
MatocaSubject: [Second Chance AIH=?UTF-8?Q?A=20Dogs]?= New topic: Test Topi=?UTF-8?Q?c=20Notif?=ication
Date: Sep 29, 2015 1:27 PMHello!
A new topic has been posted by Patrice.
Topic title: Test Topic Notification
Topic url: http://www.secondchanceaihadogs.com/forums/topic/test-topic-notification/Content: Obtain post ID
Obtain post ID
- I need to see the headers that are being passed through via the debugging snippet I posted above.
- Check your topic template. You probably have an extra [topic-content] tag in there
- Having the full email headers would probably help, too.
Ok, I will have to actually add that to the functions.php file and post another new topic. Will get to it as soon as I can.
I’ll get the headers too for you and check my tag as well.
matocaI added the code above to the functions.php file, plus the code
global $post_id;at the very top line and then saved. Is this correct?Then I wrote a new topic and saved that. In my cpanel, I opened the Error Log and have searched carefully for anything that might be related. I don’t see anything.
Either I didn’t put
global $post_id;in the correct place or this is the wrong log?If you wanted to work in the dashboard would there be a way to accomplish this?
MatocaMatoca, please contact me directly via email in order to try to get to the bottom of this. I’ll update the ticket with the solution.
vinny [at] usestrict [dot] net
I see that I may have put this in the wrong functions.php file. Am I looking to put this in a bbpress file, for instance bbPress User Functions?
Look for the functions.php inside the theme that you are currently using.
Ok, I was in the right place to start. I’ll go back and try it again.
The topic ‘New Topic Notification: No Content’ is closed to new replies.