Skip to content

Instantly share code, notes, and snippets.

@verygoodplugins
Created June 2, 2022 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save verygoodplugins/8865f873dca846273dccd166bd183f70 to your computer and use it in GitHub Desktop.
Save verygoodplugins/8865f873dca846273dccd166bd183f70 to your computer and use it in GitHub Desktop.
Re-susbscribes an unsubscribed contact to the selected list when their profile is updated
<?php
// This runs whenever WP Fusion updates an existing contact record. It re-subscribes them to the list ID specified.
function re_subscribe_to_list( $args ) {
$list_id = 1; // Update this with your list ID.
$args[1][ 'p[' . $list_id . ']' ] = $list_id;
$args[1][ 'status[' . $list_id . ']' ] = 1;
return $args;
}
add_filter( 'wpf_api_update_contact_args', 're_subscribe_to_list' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment