Last active
March 8, 2023 11:45
-
-
Save jack-arturo/5e2c7c64012442e3b67e196a3bb14985 to your computer and use it in GitHub Desktop.
Blocks incoming webhooks for a user for one minute after tags were applied to them (to prevent loopbacks)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Sets a transient to lock a user from receiving webhooks from the CRM for one minute | |
| * after tags have been applied by WP Fusion. | |
| * | |
| * @param int $user_id The user ID. | |
| */ | |
| function wpf_lock_user( $user_id ) { | |
| $contact_id = wpf_get_contact_id( $user_id ); | |
| set_transient( 'wpf_api_lock_' . $contact_id, 'update', MINUTE_IN_SECONDS ); | |
| } | |
| add_action( 'wpf_tags_applied', 'wpf_lock_user' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment