value pairs. If $params is set * as null, all groups will be returned * * @return array Array of matching groups * @example GroupGet.php * {@getfields group_get} * @access public */ function civicrm_api3_group_get($params) { $options = _civicrm_api3_get_options_from_params($params, TRUE, 'group', 'get'); if (empty($options['return']) || !in_array('member_count', $options['return'])) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Group'); } $groups = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Group'); foreach ($groups as $id => $group) { $groups[$id]['member_count'] = CRM_Contact_BAO_Group::memberCount($id); } return civicrm_api3_create_success($groups, $params, 'group', 'get'); } /** * delete an existing group * * This method is used to delete any existing group. id of the group * to be deleted is required field in $params array * * @param array $params * Array containing id of the group. * to be deleted * * @return array API result array * @example GroupDelete.php * {@getfields group_delete} * * @access public */ function civicrm_api3_group_delete($params) { CRM_Contact_BAO_Group::discard($params['id']); return civicrm_api3_create_success(TRUE); }