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) »
  • CiviPetition, and more generally writing a new component for civi
Pages: 1 [2]

Author Topic: CiviPetition, and more generally writing a new component for civi  (Read 4289 times)

jsherk

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 0
Re: CiviPetition, and more generally writing a new component for civi
April 24, 2010, 06:42:14 pm
Tiggr asked the question above:
"How may I use CiviCRM-Hooks from inside a component, not an module?"

I am wondering about the same thing... is it possible? Any examples?

Thanks

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: CiviPetition, and more generally writing a new component for civi
April 24, 2010, 07:08:05 pm

can you elaborate a bit more on what component you are writing and your use case?

thanx

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

jsherk

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 0
Re: CiviPetition, and more generally writing a new component for civi
April 24, 2010, 07:28:11 pm
Yes... the use case is what I posted here:
http://forum.civicrm.org/index.php?topic=13447

I actually got a very simple Drupal module working already...
Whenever a Contact is created or edited it will:
(1) send me an email and
(2) it checks my phpList database to see if the email address exists already, and if not it adds the email to that db (we currently use phplist for email newsletters).

So what I am wondering is if the hooks (like hook_civicrm_post) can be setup to work from a component instead of a Drupal module. Correct me if I am wrong, but (in theory) a component could be used by either Drupal or Joomla where as the Drupal module is obviously only available to Drupal users.

Having never worked with either Drupal or CiviCRM until a couple of days ago, I found setting up the Drupal module was suprisingly easy... probably took me less than 3 hours from start to finish including reading the docs.

I am however having a little more difficulty with setting up a component! So are the hooks are available to a component? And if they are, how would you set it up within that component.

Once I get it working (if its possible) I will contribute my example to the documentation so there is a basic model for others to work from.

Thanks

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: CiviPetition, and more generally writing a new component for civi
April 24, 2010, 10:20:59 pm

The component architecture is not anywhere close to being as well defined  as the drupal module structure. we do recommend that for use cases like your folks do it in drupal modules.

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

jsherk

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 0
Re: CiviPetition, and more generally writing a new component for civi
April 25, 2010, 04:59:00 am
Ok, I will post my Drupal module code in the other post mentioned above.

Thanks

jsherk

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 0
Re: CiviPetition, and more generally writing a new component for civi
May 06, 2010, 05:48:42 am
I posted simple module that will send you an email whenever an Individual Contact is either Added, Edited or Deleted. See this thread:
http://forum.civicrm.org/index.php/topic,13447.0.html

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • CiviPetition, and more generally writing a new component for civi

This forum was archived on 2017-11-26.