Created
July 26, 2017 05:13
-
-
Save appscreo/4df2197acf39051b79ceafc635f850d0 to your computer and use it in GitHub Desktop.
How to register a custom subscription module in Easy Social Share Buttons for WordPress - example
This file contains 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 | |
/* | |
* Plugin Name: Easy Social Share Buttons for WordPress Subscribe Connector - JetPack Subscriptions | |
* Description: Activate usage of JetPack Subscriptions in Opt-in Module | |
* Plugin URI: http://codecanyon.net/item/easy-social-share-buttons-for-wordpress/6394476?ref=appscreo | |
* Version: 1.0 | |
* Author: CreoApps | |
* Author URI: http://codecanyon.net/user/appscreo/portfolio?ref=appscreo | |
*/ | |
/* | |
* Register your service inside plugin menu to allow selection | |
*/ | |
add_filter('essb_external_subscribe_connectors', 'essb_subscribe_register_jetpack'); | |
function essb_subscribe_register_jetpack($connectors) { | |
$connectors['jetpack'] = __('JetPack Subscriptions', 'essb'); | |
return $connectors; | |
} | |
/* | |
* Execute filter on subscribe button press | |
*/ | |
add_filter('essb_subscribe_jetpack', 'essb_subscribe_jetpack', 10, 3); | |
function essb_subscribe_jetpack($email, $name, $output) { | |
if (class_exists('Jetpack_Subscriptions')) { | |
$subscribe = Jetpack_Subscriptions::subscribe($email, 0, false); | |
$output['code'] = '1'; | |
$output['message'] = __('Thank your for your subscribing', 'essb'); | |
} | |
else { | |
$output['exteranl_connection_message'] = __('JetPack Subscriptions is not activated', 'essb'); | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment