}
/**
- * Takes an associative array and creates / removes
- * contacts from the groups
- *
+ * Creates / removes contacts from the groups
*
* @param array $params
- * (reference ) an assoc array of name/value pairs.
- * @param array $contactId
+ * Name/value pairs.
+ * @param int $contactId
* Contact id.
*
- * @param bool $visibility
+ * @param bool $ignorePermission
+ * if ignorePermission is true we are coming in via profile mean $method = 'Web'
+ *
* @param string $method
*/
- public static function create(&$params, $contactId, $visibility = FALSE, $method = 'Admin') {
+ public static function create($params, $contactId, $ignorePermission = FALSE, $method = 'Admin') {
$contactIds = [];
$contactIds[] = $contactId;
- //if $visibility is true we are coming in via profile mean $method = 'Web'
- $ignorePermission = FALSE;
- if ($visibility) {
- $ignorePermission = TRUE;
- }
-
if ($contactId) {
$contactGroupList = CRM_Contact_BAO_GroupContact::getContactGroup($contactId, 'Added',
NULL, FALSE, $ignorePermission
}
// get the list of all the groups
- $allGroup = CRM_Contact_BAO_GroupContact::getGroupList(0, $visibility);
+ $allGroup = CRM_Contact_BAO_GroupContact::getGroupList(0, $ignorePermission);
// this fix is done to prevent warning generated by array_key_exits incase of empty array is given as input
if (!is_array($params)) {