New Topic Subscription Notification – Full topic article or excerpt
Quote from fernandolawl on July 12, 2018, 11:45 pmHi. I’ve received an email because I’m a subscriber for New Topics. However I noticed that it emailed me the whole post (although it was a short post).
If someone posts a New Topic that is long, I would only want an excerpt of it to show up in emails for people who subscribe for New Topics.
How can I set it to excerpts instead of sending out the whole post in the email to subscribers?
Thanks
Hi. I’ve received an email because I’m a subscriber for New Topics. However I noticed that it emailed me the whole post (although it was a short post).
If someone posts a New Topic that is long, I would only want an excerpt of it to show up in emails for people who subscribe for New Topics.
How can I set it to excerpts instead of sending out the whole post in the email to subscribers?
Thanks
Quote from Asgaros on July 18, 2018, 11:07 amHello @fernandolawl
You can use the following code-snippet to show (for example) onle the first 100 characters of an answer when a new topic is generated:
function my_excerpt($replacements, $user_object) { global $asgarosforum; if (isset($replacements['###CONTENT###'])) { $replacements['###CONTENT###'] = $asgarosforum->cut_string(strip_tags($replacements['###CONTENT###']), 100); } return $replacements; } add_filter('asgarosforum_user_replacements', 'my_excerpt', 10, 2);Please add the code to your themes functions.php file.
Hello @fernandolawl
You can use the following code-snippet to show (for example) onle the first 100 characters of an answer when a new topic is generated:
function my_excerpt($replacements, $user_object) { global $asgarosforum; if (isset($replacements['###CONTENT###'])) { $replacements['###CONTENT###'] = $asgarosforum->cut_string(strip_tags($replacements['###CONTENT###']), 100); } return $replacements; } add_filter('asgarosforum_user_replacements', 'my_excerpt', 10, 2);
Please add the code to your themes functions.php file.
Quote from fernandolawl on July 19, 2018, 11:35 pmThank you so much!
How about for when someone posts a reply to a topic?
Thank you so much!
How about for when someone posts a reply to a topic?
Quote from Asgaros on July 25, 2018, 12:38 amThere is also a filter for this which is called asgarosforum_filter_notify_topic_subscribers_message. The code should be almost the same but you have to play around a little bit with the message-text.
There is also a filter for this which is called asgarosforum_filter_notify_topic_subscribers_message. The code should be almost the same but you have to play around a little bit with the message-text.
Quote from fernandolawl on August 3, 2018, 6:26 pmThank you for the reply. I’m not familiar with filters. So I googled “asgarosforum_filter_notify_topic_subscribers_message” and found other forums which you contributed to that has the same question I had. As other people said, I do not have the experience to create a plugin thus this may seem like a difficult task for me to accomplish.
I hope you’ll be able to add the option for us to manage the email reply topics lengths in a future update.
Thank you for your help
Best regards!
Thank you for the reply. I’m not familiar with filters. So I googled “asgarosforum_filter_notify_topic_subscribers_message” and found other forums which you contributed to that has the same question I had. As other people said, I do not have the experience to create a plugin thus this may seem like a difficult task for me to accomplish.
I hope you’ll be able to add the option for us to manage the email reply topics lengths in a future update.
Thank you for your help
Best regards!
Quote from Asgaros on August 4, 2018, 10:11 pmHello @fernandolawl
Thanks for your reply. Yes, I am aware that the current state of modifying the notification-logic is not really straight-forward. I will try to implement more configuration possibilities in a future update.
Hello @fernandolawl
Thanks for your reply. Yes, I am aware that the current state of modifying the notification-logic is not really straight-forward. I will try to implement more configuration possibilities in a future update.
Quote from heinz@omnivision.co.za on December 6, 2018, 12:58 pmHi
I added this code via code snippets but the desired result is not achieved
This is what I get in email instead of an 100 word excerpt
all blank fields with no link
regards
Heinz
Hello,
You received this message because there is a new forum-topic:
ArrayAuthor:
Text:
Link to the new topic:
Hi
I added this code via code snippets but the desired result is not achieved
This is what I get in email instead of an 100 word excerpt
all blank fields with no link
regards
Heinz
Hello,
You received this message because there is a new forum-topic:
Array
Author:
Text:
Link to the new topic:
Quote from Asgaros on December 6, 2018, 2:50 pmHello @heinzomnivision-co-za
Yes, the code has changed. Please try to use the following one:
function my_excerpt($replacements, $user_object) { global $asgarosforum; if (isset($replacements['###CONTENT###'])) { $replacements['###CONTENT###'] = $asgarosforum->cut_string(strip_tags($replacements['###CONTENT###']), 100); } return $replacements; } add_filter('asgarosforum_user_replacements', 'my_excerpt', 10, 2);
Hello @heinzomnivision-co-za
Yes, the code has changed. Please try to use the following one:
function my_excerpt($replacements, $user_object) { global $asgarosforum; if (isset($replacements['###CONTENT###'])) { $replacements['###CONTENT###'] = $asgarosforum->cut_string(strip_tags($replacements['###CONTENT###']), 100); } return $replacements; } add_filter('asgarosforum_user_replacements', 'my_excerpt', 10, 2);