CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Contact added to group => send email
Pages: [1]

Author Topic: Contact added to group => send email  (Read 1093 times)

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Contact added to group => send email
October 27, 2008, 05:18:57 am
hi,

my org wants an automated email to be sent every time a contact is added to a particular group. i am a bit stuck on how to do this. i believe i need to use hook_civicrm_post in a custom module with my $objectName as 'Group' and $op as 'create', but even getting beyond this i'm a bit stuck. there is also not an example on the wiki page for this one so i don't have much to go on in terms of an example.

i think i can handle the emailing code, it's more just getting the ifs together and writing the rest of this function properly. can anyone tell me if i'm on the right track and maybe supply me with some example code on how to do this? greatly appreciated.

i will be more than happy to post back my final example to the wiki pages for others to benefit.

emily

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Contact added to group => send email
October 27, 2008, 05:27:43 am
Are you looking for the email function when someone is added through the admin interface, or through a frontend profile? If just a frontend profile, you can have any profile send an email upon submission through the advanced settings for the profile.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Contact added to group => send email
October 27, 2008, 05:28:41 am
sorry, i should have made that clear initially. it's going to be through the administrative interface that contacts are added to the group.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contact added to group => send email
October 27, 2008, 05:42:59 am

1. check http://svn.civicrm.org/civicrm/trunk/drupal/civitest.module.sample, function civitest_civicrm_post

2. for group additions, your op == create or edit, objectName == GroupContact, objectId = groupId, objectRef = array of contactIds

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Contact added to group => send email

This forum was archived on 2017-11-26.