Documentation

GroupContact.php

This api exposes CiviCRM GroupContact records.

This api is for adding/removing contacts from a group, or fetching a list of groups for a contact.

Important note: This api does not fetch smart groups for a contact. To fetch all contacts in a smart group, use the Contact api passing a contact_id and group_id.

To create/delete groups, use the group api instead.

Table of Contents

Functions

civicrm_api3_group_contact_get()  : array<string|int, mixed>
Fetch a list of groups for a contact, or contacts for a group.
_civicrm_api3_group_contact_create_spec()  : mixed
Adjust metadata for Create action.
civicrm_api3_group_contact_create()  : array<string|int, mixed>
Add contact(s) to group(s).
civicrm_api3_group_contact_delete()  : array<string|int, mixed>
Delete group contact record.
_civicrm_api3_group_contact_delete_spec()  : mixed
Adjust metadata.
civicrm_api3_group_contact_pending()  : array<string|int, mixed>|int
Get pending group contacts.
_civicrm_api3_group_contact_common()  : array<string|int, mixed>
Group contact helper function.
civicrm_api3_group_contact_update_status()  : bool
Update group contact status.
_civicrm_api3_group_contact_deprecation()  : array<string|int, mixed>
Deprecated function notices.

Functions

civicrm_api3_group_contact_get()

Fetch a list of groups for a contact, or contacts for a group.

civicrm_api3_group_contact_get(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Name value pair of contact information.

Tags
Note:

this only applies to static groups, not smart groups. To fetch all contacts in a smart group, use the Contact api passing a contact_id and group_id.

If no status mentioned in params, by default 'added' will be used to fetch the records

Return values
array<string|int, mixed>

list of groups, given contact subsribed to

_civicrm_api3_group_contact_create_spec()

Adjust metadata for Create action.

_civicrm_api3_group_contact_create_spec(array<string|int, mixed> &$params) : mixed
Parameters
$params : array<string|int, mixed>

civicrm_api3_group_contact_create()

Add contact(s) to group(s).

civicrm_api3_group_contact_create(array<string|int, mixed> $params) : array<string|int, mixed>

This api has a legacy/nonstandard signature. On success, the return array will be structured as follows:

array(
  "is_error" => 0,
  "version"  => 3,
  "count"    => 3,
  "values" => array(
    "not_added"   => integer,
    "added"       => integer,
    "total_count" => integer
  )
)

On failure, the return array will be structured as follows:

array(
  'is_error' => 1,
  'error_message' = string,
  'error_data' = mixed or undefined
)
Parameters
$params : array<string|int, mixed>

Input parameters:

  • "contact_id" (required): First contact to add, or array of Contact IDs
  • "group_id" (required): First group to add contact(s) to, or array of Group IDs
  • "status" (optional): "Added" (default), "Pending" or "Removed" Legacy input parameters (will be deprecated):
  • "contact_id.1" etc. (optional): Additional contact_id to add to group(s)
  • "group_id.1" etc. (optional): Additional groups to add contact(s) to
Return values
array<string|int, mixed>

Information about operation results

civicrm_api3_group_contact_delete()

Delete group contact record.

civicrm_api3_group_contact_delete(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

_civicrm_api3_group_contact_delete_spec()

Adjust metadata.

_civicrm_api3_group_contact_delete_spec(array<string|int, mixed> &$params) : mixed
Parameters
$params : array<string|int, mixed>

civicrm_api3_group_contact_pending()

Get pending group contacts.

civicrm_api3_group_contact_pending(array<string|int, mixed> $params) : array<string|int, mixed>|int
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>|int

_civicrm_api3_group_contact_common()

Group contact helper function.

_civicrm_api3_group_contact_common(array<string|int, mixed> $params[, string $op = 'Added' ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
$op : string = 'Added'
Tags
todo

behaviour is highly non-standard - need to figure out how to make this 'behave' & at the very least return IDs & details of the groups created / changed

Return values
array<string|int, mixed>

civicrm_api3_group_contact_update_status()

Update group contact status.

  • this should be part of create but need to know we aren't missing something
civicrm_api3_group_contact_update_status(array<string|int, mixed> $params) : bool
Parameters
$params : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
Return values
bool

_civicrm_api3_group_contact_deprecation()

Deprecated function notices.

api notice

_civicrm_api3_group_contact_deprecation() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of deprecated actions


        
On this page

Search results