Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Last active September 10, 2018 06:58
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 wpmudev-sls/6c043e164626abaeddb0e961d58cd5f5 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/6c043e164626abaeddb0e961d58cd5f5 to your computer and use it in GitHub Desktop.
ProSite - Integration with Zapier for MailerLite
<?php
/**
* Plugin Name: ProSite - Integration with Zapier for MailerLite
* Plugin URI: https://premium.wpmudev.org/
* Description: Integration with Zapier for MailerLite
* Author: Ariful Islam @ WPMUDEV
* Author URI: https://premium.wpmudev.org/profile/itsarifulislam
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// This Test portion should be removed after testing the webhook,
// and the testing is necessary for loading the fields
// === Started Test Portion ===
// === Run this test portion just once, then remove the portion ===
add_action( 'init', function() {
$zapier_hook_url = 'YOUR_ZAPIER_HOOK_URL'; // Your zaiper hook url
if ( $zapier_hook_url !== 'YOUR_ZAPIER_HOOK_URL' ) {
$post_data = array(
"Email" => ''
);
wp_remote_post( $zapier_hook_url, array(
'body' => $post_data
));
}
});
// === End Test Portion ===
function prosite_admin_user_created( $user_id ) {
remove_action( 'wpmu_new_user', 'prosite_admin_user_created' );
$zapier_hook_url = 'YOUR_ZAPIER_HOOK_URL'; // Your zaiper hook url
if ( $zapier_hook_url !== 'YOUR_ZAPIER_HOOK_URL' ) {
$user_info = get_userdata( $user_id );
$post_data = array(
"Email" => $user_info->user_email
);
wp_remote_post( $zapier_hook_url, array(
'body' => $post_data
));
}
}
function signup_meta( $data ) {
add_action( 'wpmu_new_user', 'prosite_admin_user_created', 20, 1 );
return $data;
}
add_filter( 'add_signup_meta', 'signup_meta', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment