Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Mailchimp_Helpers::compile_user_interests( mixed $existing_user, mixed $change_groups, $groups_list )
compile_user_interests
Contents
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Parameters Parameters
- $existing_user
(Required)
- $change_groups
(Required)
- $check_interests
(Required)
Return Return
(void)
Source Source
File: src/integrations/mailchimp/helpers/mailchimp-helpers.php
public function compile_user_interests( $existing_user, $change_groups, $groups_list ) { // Only add new interests if ( 'add-only' === $change_groups ) { if ( empty( $groups_list ) ) { // No interests to add return array(); } $add_interests = array(); foreach ( $groups_list as $interest_id ) { $add_interests[ $interest_id ] = true; } return $add_interests; } // Remove any matching interests if ( 'replace-matching' === $change_groups ) { if ( empty( $groups_list ) ) { // No interests to remove return array(); } $remove_interests = array(); foreach ( $groups_list as $interest_id ) { $remove_interests[ $interest_id ] = false; } return $remove_interests; } // Replace All. All of the subscriber's existing groups will be cleared, and replaced with the groups selected below. if ( 'replace-all' === $change_groups ) { $new_interests = array(); if ( ! empty( $existing_user['data']['interests'] ) ) { // First remove all interests foreach ( $existing_user['data']['interests'] as $interest_id => $status ) { $new_interests[ $interest_id ] = false; } } // Then add the new ones foreach ( $groups_list as $interest_id ) { $new_interests[ $interest_id ] = true; } return $new_interests; } return array(); }
Expand full source code Collapse full source code View on Github