diff --git a/CRM/Mailing/Event/BAO/Unsubscribe.php b/CRM/Mailing/Event/BAO/Unsubscribe.php index f6c4771e28f5..55ca19c0d34c 100644 --- a/CRM/Mailing/Event/BAO/Unsubscribe.php +++ b/CRM/Mailing/Event/BAO/Unsubscribe.php @@ -220,10 +220,10 @@ public static function &unsub_from_mailing($job_id, $queue_id, $hash, $return = // list. while (!empty($mailings)) { - $do->query(" + $do = CRM_Core_DAO::executeQuery(" SELECT $mg.entity_table as entity_table, $mg.entity_id as entity_id - FROM $mg + FROM civicrm_mailing_group $mg WHERE $mg.mailing_id IN (" . implode(', ', $mailings) . ") AND $mg.group_type = 'Include'"); @@ -258,12 +258,12 @@ public static function &unsub_from_mailing($job_id, $queue_id, $hash, $return = if ($groupIds || $baseGroupIds) { $groupIdClause = "AND $group.id IN (" . implode(', ', array_merge($groupIds, $baseGroupIds)) . ")"; } - $do->query(" + $do = CRM_Core_DAO::executeQuery(" SELECT $group.id as group_id, $group.title as title, $group.description as description - FROM $group - LEFT JOIN $gc + FROM civicrm_group $group + LEFT JOIN civicrm_group_contact $gc ON $gc.group_id = $group.id WHERE $group.is_hidden = 0 $groupIdClause