Community

How to send an email when a block is created

I am creating a block in the highlight area to announce something on my site. I want to send an email to users to notify them about this event. I can't figure out how to use rules to accomplish this; a block doesn't seem to be "content" that can trigger an event, and I'm not sure how else to approach this.

Just as an fyi, I'm looking for something module related or built-in; coding a method is not something I'm really capable of.

Comments

Blocks are not considered as

Blocks are not considered as entities and hence their are no hooks invoked for save of block. If you are going to create this event block frequently then you can have a content type as Event and create a content of this content type. You can then use hook_entity_insert to mail every user in the system. For displaying the event as a block, create a block using views and set filters as content of Event content type. Number of items to 1, sort by date (newest first). This will automatically change the block content with newly posted event every-time you create a new event.

Hth,
Sadashiv.

Thank you, however I have no

Thank you, however I have no idea how or where to use hook_entity_insert. The information on the page link assumes I know something I don't know, so it's gibberish to me.

You need to write a custom

You need to write a custom module and write hook_entity_insert in it.

Refer http://drupal.org/node/361112.

Hth,
Sadashiv

Thanks for the lead.

Thanks for the lead.

nobody click here