Please or Register to create posts and topics.

admin get notification for each reply

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 :

  1. function custom_mails($mails) {
  2. $mails[] = ‘mymail@example.com’;
  3. return $mails;
  4. }
  5. add_filter(‘asgarosforum_subscriber_mails_new_post’, ‘custom_mails’); but not working

Hello @we

The only thing you need to do is to go to the subscriptions-overview and activate notifications for “New Topics & Posts”.

we has reacted to this post.
we
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

i have removed the subscription menu button because client don’t want the subscription how can i do it

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);

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

EDIT: i had a question, but i think i might have misunderstood something, so taking it off and investigating more ๐Ÿ˜€

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! ๐Ÿ™‚

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.

Livi has reacted to this post.
Livi
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!