setting admin to receive email on any activity

Started by kofifus, April 23, 2016, 06:49:36 PM

Previous topic - Next topic

kofifus

Hi

I run a small forum, as the Admin, ATM I would like to receive an email on any forum activity, mainly:

- any new topics, and
- any new posts inside any topic

Can this be set up ?

thx!

Kindred

for the first one: turn on notifications for your account for every board...

as for the second one... not really any way to easily do that
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

I'd usually argue that any active admin would just be online and browsing periodically anyway and so wouldn't need notifications on everything...

kofifus

thx Arantor, I use SMF as the support platform for a small project I run, as this is the first releases and I'm the sole developer I want to be notified on ANY forum activity.

Kindred

As I have said, it's not really doable to be notified of every post.

Topics is easy as explained.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Especially as if it gets busy, dealing with 50+ emails just to tell you there is something to look at really gets to be not-fun, as I learned.

My experience is that it ends up being better f you check every so often and post if there is something to say, rather than setting up for what ends up being more work...

kofifus

Sorry but I asked how to do it, not if it is something you would like to have on your forums.

Of course it's doable, I just need one of the coders here to help me.

I tried:

in Sources/Display.php:

after:

if (!empty($row['id_topic']))
   $context['is_marked_notify'] = true;

I added:

if ($context['admin_features']) // admin always gets notifications
   $context['is_marked_notify'] = true;

and in Sources/MessageIndex.php:

after:

$context['is_marked_notify'] = $smcFunc['db_num_rows']($request) != 0;

I added:

if ($context['admin_features']) // admin always gets notifications
   $context['is_marked_notify'] = true;

but no luck.

Any other tips ?




Arantor

I'm trying to explain why it's a bad idea, and why SMF doesn't support it.

If you did want to mangle something together though, you wouldn't do it in Display.php, but in Post.php just after the createPost call, calling out to send_mail to send it. I don't have a copy of 2.0 handy (on iPad) so I can't just list what parameters you'd need to pass in...

Kindred

And that wouldn't be correct anyway, since, in the case you are referencing, context is referring to the current user, not the admin...   
Which means it would only turn on notify when YOU visit each thread...   High is what we are telling You to do anyway instead of turning on notify...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

kofifus

#9
thx Arantor, I can't find a call for send_mail anywhere ? where in the code are emails being sent ?

all I want to say is - if admin then  is_marked_notify = true

Arantor

No, you won't find a call, that's the point! SMF does not send emails every time a post is made, generally. I was trying to show you where you would add it yourself, i.e. adding a new call to send_mail after the call to createPost.

And no, it isn't too late in the process... Sending an email directly after the post makes it into the database, is the ideal time to do it. Especially for a process SMF explicitly doesn't do (auto notifying someone of everything)

Under what you suggest, it would force the posting user to get notifications of replies for their topic, not notify you of everything because SMF doesn't have that as an option to just do it rather than manual opt in.

But you seem to know what you want (even when veteran admins who've done this and learned the hard way why it doesn't work), and even how you think you should get it (despite having one of the former SMF dev team telling you how you might start going about it), so I think I will bow out at this point.

kofifus

I assume at some point, SMF gets a list of all users who have notify enabled for that post/forum and send them emails. Can you tell where is that point ?

If I understand what you say, at that point there is no way to know what additional admin email to mail to as I want. Fair enough. Can I hard code an extra email at that point to also email to ? yes this will be an ugly hack but that's ok if it gets me what I want.

Sorry if I sounded disrespectful as it was not my intention. But just answering 'not doable' and 'you don't want to do that' isn't very helpful.

Thx!


Arantor

What you just described as an ugly hack is precisely the best way to solve this problem, I even told you where you would put the code to do it. Trying to splice it into the main notify code is much, much harder than it sounds because the main notify code also handles people who want notifications in daily or weekly batches. So you do it separately just after a post is made and added to the database.

kofifus

Sorry I don't get it. I don't want to add sending the mail address, just add an email where SMF sends emails itself.

Can you tell where in SMF code are emails being sent ?

Arantor

No, because you don't understand why this is complicated. SMF's notify code does so much more than just send emails, it also moves stuff around the database so that people can have daily or weekly notifications, batching up all the things.

There is nowhere in SMF to just randomly add your email in when a new topic or post is created which fit replies to posts is what would need to happen (since the code as it stands only adds in the posting user details if they have the relevant option on)

Thus for you to get notifications on everything the quickest, easiest and simplest way is to just add the one line of code in the right place for it to just do that rather than trying to navigate the rest of the notifications system. Did I mention, I used to develop SMF itself? I don't get why you think you need to make this more complex than it needs to be: you want an email every time someone posts. Add a line of code to send an email just after the post is created, job done. Guaranteed to be smaller, faster and quicker than pushing it into the notifications queue.

kofifus

ok thx ! my issue is if I need to send the email myself at the point you mentioned, I need to figure out the subject and body and all email sending parameters. Can you help with that ?

That's why I thought I can evade all that by simply add an email address at the point where SMF is already sending email to the list of users that registered to be notified.


Arantor

That really depends whether you want it to have all the same wording as the normal email or just a bare email with a link to the post and maybe the post content. The former requires a bit more work (10 lines or so), the latter is still a one liner.

kofifus

link to the post post content will be enough :) can you help with this ?

Advertisement: