MyBB Community Forums

Full Version: How to get an email notification for every post?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need an email notification when somebody posts anything in my forum. I did not find the appropriate selection on the administrator panel. What did I overlook?
Look in your User CP
This is something I'm looking for, too.

lufbra Wrote:Look in your User CP

Looking is not everything, you also need to understand what you see, don't you?
if you want to make a email for every post made in a forum click the forum say eg chat

then at the top Subscribe to this forum

under the make that make a new thread

Big Grin

is this what you want to do ?
Subscribing to a forum only gives you a notification for a new thread, not every post.

I want a notification for new responses to existing threads, too!
well, but please remember for this your host should not have any restriction of php mail limit! as some hosts may have limit so it can be danger for your forum if limit exceeded, Your forum can go down too!
Faisal Shah Wrote:well, but please remember for this your host should not have any restriction of php mail limit! as some hosts may have limit so it can be danger for your forum if limit exceeded, Your forum can go down too!
yes
if you host as a email limed on your acount and you go over that they may close your acount down for a mouth or make you pay to get it up and running again you should check with them to see if this do this before you get an email for every post made at your forum
Don't worry, my forum has only a small number of users. So the expected amount of messages would be limited.

But this probably always true for moderated forums - otherwise the moderators would also be overloaded - not just your host server.Wink
Give this a shot (no guarantees that it'll work):
In inc/datahandlers/post.php, find:
			$plugins->run_hooks_by_ref("datahandler_post_insert_post", $this);

			$db->insert_query(TABLE_PREFIX."posts", $this->post_insert_data);
			$this->pid = $db->insert_id();
After the last line, add:
my_mail('[email protected]', "New post {$this->post_insert_data['subject']} by {$this->post_insert_data['username']}", "New post {$this->post_insert_data['subject']} by {$this->post_insert_data['username']}\n\nhttp://example.com/yourforum/showthread.php?tid={$this->post_insert_data['tid']}#pid{$this->pid}");

Find:
			$plugins->run_hooks_by_ref("datahandler_post_insert_thread_post", $this);

			$db->insert_query(TABLE_PREFIX."posts", $this->post_insert_data);
			$this->pid = $db->insert_id();
Make the same modification as the above.
Thanks, Denis, for your suggestion.

I looked into the code of post.php and after that, I am bit hesitant do make the change.

I' d rather want to tweek the "standard features" of subscription.

I found the section dealing with subscribed threads generating the notifications (couldn't find the code dealing with forum subscriptions and then generating notifications for new threads).

What we would have to do is automatically create subscriptions to new threads whenever a forum is subscribed to and then let the standard process work. Of course, subscription to a forum would also have to automatically subscribe to all existing threads.

Would you be able to help identify the pieces of code that would do this?