Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include sync_tags option #136

Closed
wants to merge 1 commit into from
Closed

Include sync_tags option #136

wants to merge 1 commit into from

Conversation

efc
Copy link
Contributor

@efc efc commented Nov 15, 2023

Allows users who add tags with the pmpromc_user_data filter to also have these tags properly synced by MailChimp. Changes nothing if the users are not adding tags with a filter.

Right now it is possible for users of this add-on to ask MailChimp to include tags by creating a filter like this:

function add_my_tags( $user_data, $user ) {
	$data = get_object_vars( $user_data );
	$data['tags'] = get_my_tags_for_user($user);
	$user_data = (object) $data;
	return $user_data;
}
add_filter('pmpromc_user_data', 'add_my_tags', 10, 2);

The problem is that MailChimp will, by default, only add tags to a list member. If a user of this add-on is going to the trouble to add tags at all, then the more likely case is that they intend for MailChimp to sync these tags for the member. In fact this is analogous to the fact that the add-on already assumes we want to update the existing user on line 172. All we are suggesting is that this updating should extend to tags as well, if tags are supplied.

An acceptable alternative would be to provide a filter for the $data being created on line 170, but that seems to us to be be overkill in this instance. It is hard to imagine use cases where someone goes to the trouble of specifying tags and does not want them synced.

Note that this, in part, would help satisfy this enhancement request for users who are comfortable using filters.

Allows users who add tags with the pmpromc_user_data filter to also have these tags properly synced by MailChimp. Changes nothing if the users are not adding tags with a filter.
@efc efc changed the title include sync_tags option Include sync_tags option Nov 15, 2023
@efc
Copy link
Contributor Author

efc commented Nov 16, 2023

Whoops, nevermind, further testing shows this is a terrible idea. I will work up the filter as an alternative that works!

@efc efc closed this Nov 16, 2023
@efc efc deleted the patch-1 branch November 16, 2023 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant