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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Need help with civicrm_custom_group_create, created_id and created_date
Pages: [1]

Author Topic: Need help with civicrm_custom_group_create, created_id and created_date  (Read 1226 times)

hlevinson

  • I post occasionally
  • **
  • Posts: 53
  • Karma: 3
Need help with civicrm_custom_group_create, created_id and created_date
January 08, 2010, 04:46:31 pm
When I run the following test code

Code: [Select]
require_once("api/v2/CustomGroup.php");

$params = array(
'title'            => 'test1',
'name'             => 'test1',
'extends'          => array('Organization', array('Organizational', 'Individual_level', 'Associate_level')),
'weight'           => 1,
'collapse_display' => 0,
'style'            => 'Tab',
'help_pre'         => '',
'help_post'        => '',
'is_active'        => 1
);

$custom_group = &civicrm_custom_group_create($params);
$group_id = $custom_group['id'];
print_r($group_id);

My group gets created as desired, except for these two fields:  created_id and created_date

Is there some other parameter I need to pass, or are those related to the creation of the custom fields?



Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Need help with civicrm_custom_group_create, created_id and created_date
January 09, 2010, 12:41:08 am
If I'm not wrong -

created_date and created_id being used to track the date and user who created custom group.
Basically created_id is mapped to contact id from civicrm_contact table and which is suppose to be logged in user.

To store these values at the time of new custom group creation you need to pass its values w/ params array.
But make sure created_id should be present as id in civicrm_contact table.

format might be like :

$params['created_id']      = pass appropriate contact id here;
$params['created_date']  = date('YmdHis');
 
hope this help

kiran
You Are Designed To Choose... Defined By Choice.

hlevinson

  • I post occasionally
  • **
  • Posts: 53
  • Karma: 3
Re: Need help with civicrm_custom_group_create, created_id and created_date
January 11, 2010, 10:14:59 am
Thanks, that worked great!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Need help with civicrm_custom_group_create, created_id and created_date

This forum was archived on 2017-11-26.