Please or Register to create posts and topics.

Receive notification for all new post

Page 1 of 3Next

Hi,

My boss (who is also admin of the site) want receive à mail notification for all answer in every post.
The same mail notification which the “new topic” mail.

It is possible? I don’t know how to use hook, and i think it’s the solution…
Can you give directly the code to put in my function.php ?

Thank you very much !

Hello,

you can try to add the following code to your themes functions.php file:

function custom_mails($mails) {
  $mails[] = 'mymail@example.com';
  return $mails;
}
add_filter('asgarosforum_subscriber_mails_new_post', 'custom_mails');

 

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

Hi!

Thanks for the answer.
This function doen’t work, i have White Screen when i added it to theme’s functions.php :/

Please try it again. There was a missing semicolon.

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

Hi !

This code works! Thank you! It’s possible to add a mail? with $additional_headers = ?

 

Also, i want to activate the autosubscribe too. But the code here (https://asgaros.com/support/?view=thread&id=337) doesn’t work :/

Can you check the code again? It automatically subscribes you but without checking the checkbox in the editor. But you will see that you have a subscription after creating the topic.

You can add more mails when you repeat that line of code:

$mails[] = 'mymail1@example.com';
$mails[] = 'mymail2@example.com';
$mails[] = 'mymail3@example.com';

 

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

Yeah, its okay for the multiple mail.

For the auto subscribe, i confirm:

USER1 create a post(mail to admin for new subject only). AUTHOR1 reply (mail to admin for new subject only). No mail to User1.

The code used is: function auto_subscribe($postID, $topicID) {
AsgarosForumNotifications::subscribeTopic();
}
add_action(‘asgarosforum_after_add_thread_submit’, ‘auto_subscribe’, 10, 2);

thanks!

Does USER1 creates a post or a topic? Because this code is only working for topics which are created by USER1 and not for posts he is adding to an already existing topic. Please also keep in mind that a user does not get mails for his own answers/topics.

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

Hi!
Yes, USER1 created the topic.

Author1 reply to this topic.

User1 receive nothing.

For receive, he have to suscribe…

Please try it again with the following code:

function auto_subscribe($postID, $topicID) {
 global $asgarosforum;
 $asgarosforum->notifications->subscribe_topic();
}
add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2);

 

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