Jump to content

Comments: email notifications to varios admin


Recommended Posts

Three solutions immediately spring to mind:

a) Create different comments fields for each group of pages (downsides: you have to keep other settings in sync and page queries may have to run over both fields)

b) If all comments pages are at the same depth (or not too deeply nested) and each has a unique (might also be grand-) parent, you can create a field on those ancestors that holds the admin contact email and use the "field:" syntax in Admin notification email:

field:parent.adminemail
// or, for grandchildren
field:parent.parent.adminemail

You could even set multiple sources this way if the adminemail might be either on the parent or the grandparent (just make sure it isn't set on both). The comments field will only use valid emails, so if a parent or grandparent doesn't have the field (or doesn't exist), that entry will be ignored.

field:parent.adminemail,field:parent.parent.adminemail

c) In some scenarios, you want to send notifications to the user that created the page. In that case, you can use

field:createdUser.email

The big downside of that approach is that when the creator of the page is no longer available to approve comments, the createdUser field has to be changed or a different email address assigned in their profile settings (and comment notifications might get lost if nobody thinks of that).

It should also be possible to populate $field->notificationEmail through a hook, but from the top of my head, I can't name a convenient method to hook into.

  • Like 2
Link to comment
Share on other sites

  • 7 months later...
On 6/1/2018 at 5:19 PM, BitPoet said:

b) If all comments pages are at the same depth (or not too deeply nested) and each has a unique (might also be grand-) parent, you can create a field on those ancestors that holds the admin contact email and use the "field:" syntax in Admin notification email:

@BitPoet I have totally missed this "field:createdUser.email" syntax. Is this documented somewhere and what are all the places that it can be used? Is it only module/field configs or some other places also?

Link to comment
Share on other sites

  • 8 months later...
  • 9 months later...
On 6/1/2018 at 3:19 PM, BitPoet said:

field:parent.adminemail
// or, for grandchildren
field:parent.parent.adminemail

 

Can I ask if you had success with this approach...

field:parent.email_field

Currently, I can only get this to work with an email field on the current page... but really need to get the value from the immediate parent page.

=========UPDATE1==============

I can see from this page: https://processwire.com/api/ref/page/get/  that the$page->get('parent.title') should work. But I can't get it to work even in a straight forward template - so the issue isn't with the comments module. Thanks 

=========UPDATE2==============

In case it helps anyone else... no idea why, but the only way I can get this to work is $page->get('{parent.title}') or in the context of the comments module field:{parent.emailfield}

Thanks
Nik

Link to comment
Share on other sites

  • 1 year later...
On 6/1/2018 at 4:19 PM, BitPoet said:

Three solutions immediately spring to mind:

a) Create different comments fields for each group of pages (downsides: you have to keep other settings in sync and page queries may have to run over both fields)

b) If all comments pages are at the same depth (or not too deeply nested) and each has a unique (might also be grand-) parent, you can create a field on those ancestors that holds the admin contact email and use the "field:" syntax in Admin notification email:

field:parent.adminemail
// or, for grandchildren
field:parent.parent.adminemail

You could even set multiple sources this way if the adminemail might be either on the parent or the grandparent (just make sure it isn't set on both). The comments field will only use valid emails, so if a parent or grandparent doesn't have the field (or doesn't exist), that entry will be ignored.

field:parent.adminemail,field:parent.parent.adminemail

c) In some scenarios, you want to send notifications to the user that created the page. In that case, you can use

field:createdUser.email

The big downside of that approach is that when the creator of the page is no longer available to approve comments, the createdUser field has to be changed or a different email address assigned in their profile settings (and comment notifications might get lost if nobody thinks of that).

It should also be possible to populate $field->notificationEmail through a hook, but from the top of my head, I can't name a convenient method to hook into.

I have been trying to send email notifications but for some reason no email has ever been sent, even though I might have try all these different options I still can't get it to work.

I am currently working on a forum and need to notify the createdUser of the page as well as all the people that commented (I've let the option to disable the notification).

In the admin panel, under the Comments category, emails are there, and notify is set on All as it should.

I there some settings somewhere I might have missed? Something to edit in the module itself?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...