admin get notification for each reply
Quote from we on June 23, 2018, 8:38 amis it possible to admin can get the each reply notification.
if yes then tell us the procedure for that
i have try the following function :
- function custom_mails($mails) {
- $mails[] = ‘mymail@example.com’;
- return $mails;
- }
- add_filter(‘asgarosforum_subscriber_mails_new_post’, ‘custom_mails’); but not working
is it possible to admin can get the each reply notification.
if yes then tell us the procedure for that
i have try the following function :
- function custom_mails($mails) {
- $mails[] = ‘mymail@example.com’;
- return $mails;
- }
- add_filter(‘asgarosforum_subscriber_mails_new_post’, ‘custom_mails’); but not working
Quote from Asgaros on June 23, 2018, 12:39 pmHello @we
The only thing you need to do is to go to the subscriptions-overview and activate notifications for “New Topics & Posts”.
Hello @we
The only thing you need to do is to go to the subscriptions-overview and activate notifications for “New Topics & Posts”.
Quote from we on June 23, 2018, 1:14 pmi have removed the subscription menu button because client don’t want the subscription how can i do it
i have removed the subscription menu button because client don’t want the subscription how can i do it
Quote from Asgaros on June 25, 2018, 8:11 pmHello again @we
You have to use theย asgarosforum_after_add_post_submit-hook. Please try the following code:
function send_mail($post_id, $topic_id, $subject, $text, $redirect) { global $asgarosforum; $topic_name = $subject; $author_name = $asgarosforum->getUsername($answer_author); $notification_subject = sprintf(__('New answer: %s', 'asgaros-forum'), wp_specialchars_decode(esc_html(stripslashes($subject)), ENT_QUOTES)); $notification_message = sprintf(__('Hello,<br /><br />You received this message because there is a new answer in a forum-topic you have subscribed to:<br />%s<br /><br />Author:<br />%s<br /><br />Answer:<br />%s<br /><br />Link to the new answer:<br /><a href="%s">%s</a><br /><br />You can unsubscribe from this topic using the unsubscribe-link at the end of the topic as a logged-in user. Please dont answer to this mail!', 'asgaros-forum'), esc_html(stripslashes($subject)), $author_name, wpautop(stripslashes($answer_text)), $text, $redirect); $this->send_notifications('mail@example.com', $notification_subject, $notification_message); } add_action('asgarosforum_after_add_post_submit', 'send_mail', 10, 5);
Hello again @we
You have to use theย asgarosforum_after_add_post_submit-hook. Please try the following code:
function send_mail($post_id, $topic_id, $subject, $text, $redirect) { global $asgarosforum; $topic_name = $subject; $author_name = $asgarosforum->getUsername($answer_author); $notification_subject = sprintf(__('New answer: %s', 'asgaros-forum'), wp_specialchars_decode(esc_html(stripslashes($subject)), ENT_QUOTES)); $notification_message = sprintf(__('Hello,<br /><br />You received this message because there is a new answer in a forum-topic you have subscribed to:<br />%s<br /><br />Author:<br />%s<br /><br />Answer:<br />%s<br /><br />Link to the new answer:<br /><a href="%s">%s</a><br /><br />You can unsubscribe from this topic using the unsubscribe-link at the end of the topic as a logged-in user. Please dont answer to this mail!', 'asgaros-forum'), esc_html(stripslashes($subject)), $author_name, wpautop(stripslashes($answer_text)), $text, $redirect); $this->send_notifications('mail@example.com', $notification_subject, $notification_message); } add_action('asgarosforum_after_add_post_submit', 'send_mail', 10, 5);
Quote from Livi on July 26, 2019, 4:13 pmEDIT: i had a question, but i think i might have misunderstood something, so taking it off and investigating more ๐
EDIT: i had a question, but i think i might have misunderstood something, so taking it off and investigating more ๐
Quote from Livi on July 26, 2019, 4:54 pmHello!
Let’s see if i understand what i am asking about now ๐I am reviving this old thread, since we have a similar need.
On our forums, we have subscriptions turned off, but would still want admins to receive email notifications on every new forum topic and reply.In the settings, we have enabled “Notify receivers of administrative notifications about new topics”, but this does not give notification on new replies to existing topics.
I tried the same piece of code as in the first post of this thread, with asgarosforum_subscriber_mails_new_post filter, but nothing happened. That, and looking at the php code around this filter lead me to assume “enable subscriptions” might need to be on for this to work, is this correct?
What would be the correct way for admins to receive email notifications of ALL new forum posts while still having subscriptions turned off?
I also tried the code in the post above, but it gave me this error:
PHP Fatal error: Uncaught Error: Using $this when not in object context in /path/to/file.php
As a side note, we are not adding these directly to functions.php, but instead we have created our own plugin file for these kinds of modifications. Not sure if this makes any difference here, though ๐
Thanks in advance! ๐
Hello!
Let’s see if i understand what i am asking about now ๐
I am reviving this old thread, since we have a similar need.
On our forums, we have subscriptions turned off, but would still want admins to receive email notifications on every new forum topic and reply.
In the settings, we have enabled “Notify receivers of administrative notifications about new topics”, but this does not give notification on new replies to existing topics.
I tried the same piece of code as in the first post of this thread, with asgarosforum_subscriber_mails_new_post filter, but nothing happened. That, and looking at the php code around this filter lead me to assume “enable subscriptions” might need to be on for this to work, is this correct?
What would be the correct way for admins to receive email notifications of ALL new forum posts while still having subscriptions turned off?
I also tried the code in the post above, but it gave me this error:
PHP Fatal error: Uncaught Error: Using $this when not in object context in /path/to/file.php
As a side note, we are not adding these directly to functions.php, but instead we have created our own plugin file for these kinds of modifications. Not sure if this makes any difference here, though ๐
Thanks in advance! ๐
Quote from Asgaros on July 26, 2019, 7:09 pmHello @livi
For posts there is currently no such functionality available to notify administrators. However, you can try the following workaround:
- Enable the subscriptions functionality
- Subscribe toย “New Topics & Posts” in the subscriptions-area
- After it you add the following custom css-code toย Forum – Appearance – Custom CSS without disabling the subscriptions functionality afterwards:
#bottom-navigation, a.subscriptions-link { display: none !important; }With this css-code the subscription-area is hidden from the frontend.
Hello @livi
For posts there is currently no such functionality available to notify administrators. However, you can try the following workaround:
- Enable the subscriptions functionality
- Subscribe toย “New Topics & Posts” in the subscriptions-area
- After it you add the following custom css-code toย Forum – Appearance – Custom CSS without disabling the subscriptions functionality afterwards:
#bottom-navigation, a.subscriptions-link { display: none !important; }
With this css-code the subscription-area is hidden from the frontend.