} } $community_id = 0; $query = "\tSELECT a.* FROM `community_mailing_list_members` AS a\n\t\t\t\t\t\t\t\t\t\tJOIN `community_mailing_lists` AS b\n\t\t\t\t\t\t\t\t\t\tON a.`community_id` = b.`community_id`\n\t\t\t\t\t\t\t\t\t\tWHERE a.`list_administrator` = '-1'\n\t\t\t\t\t\t\t\t\t\tAND a.`member_active` = '1'\n\t\t\t\t\t\t\t\t\t\tAND b.`list_type` != 'inactive'\n\t\t\t\t\t\t\t\t\t\tORDER BY a.`community_id` ASC"; if ($members = $db->GetAll($query)) { foreach ($members as $member) { if ($community_id != (int) $member["community_id"]) { $community_id = (int) $member["community_id"]; $list = new MailingList($community_id); $list->fetch_current_list(); $current_users = array_merge($list->current_owners, $list->current_members); } echo "Demote: " . $member["email"] . " -> " . $community_id . "<br/>"; if (in_array($member["email"], $current_users)) { try { $list->remove($member["email"]); $list->add($member["email"]); $list->base_edit_member($member["proxy_id"], "0", "1"); } catch (Exception $e) { echo $e->getMessage(); if ($e->getCode() == "502") { exit; } application_log("notice", "An issue was encountered while attempting to demote a user's email [" . $member["email"] . "] to owner on a community [" . $community_id . "] mailing list. The server said: " . $e->getCode() . " - " . $e->getMessage()); } } else { $list->base_edit_member($member["proxy_id"], "0", "1"); application_log("notice", "An issue was encountered while attempting to demote a user's email [" . $member["email"] . "] to owner on a community [" . $community_id . "] mailing list. The user is not an owner."); } /** * Email limit so exit