| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
/** |
| 4 |
* Function that creates the "Paid Accounts" submenu page |
| 5 |
* |
| 6 |
* @since v.2.0 |
| 7 |
* |
| 8 |
* @return void |
| 9 |
*/ |
| 10 |
function wppb_register_pms_cross_promo() { |
| 11 |
add_submenu_page( '', __( 'Paid Accounts', 'profile-builder' ), __( 'Paid Accounts', 'profile-builder' ), 'manage_options', 'profile-builder-pms-promo', 'wppb_pms_cross_promo' ); |
| 12 |
} |
| 13 |
add_action( 'admin_menu', 'wppb_register_pms_cross_promo', 2 ); |
| 14 |
|
| 15 |
/** |
| 16 |
* Function that adds content to the "Paid Accounts" submenu page |
| 17 |
* |
| 18 |
* @since v.2.0 |
| 19 |
* |
| 20 |
* @return string |
| 21 |
*/ |
| 22 |
function wppb_pms_cross_promo() { |
| 23 |
?> |
| 24 |
<div class="wrap wppb-wrap wppb-info-wrap"> |
| 25 |
<div class="wppb-badge wppb-pb-pms"></div> |
| 26 |
<h1>Users can pay for an account with<br/> <small style="font-size: 30px; letter-spacing: 0.008em;">Profile Builder and Paid Member Subscriptions</small></h1> |
| 27 |
<hr /> |
| 28 |
<div class="wppb-row"> |
| 29 |
<p>One of the most requested features in Profile Builder was for users to be able to pay for an account.</p> |
| 30 |
<p>Now that's possible using the free WordPress plugin - <a href="https://www.cozmoslabs.com/wordpress-paid-member-subscriptions/?utm_source=wpbackend&utm_medium=clientsite&utm_content=pb-pms-promo&utm_campaign=PBFree">Paid Member Subscriptions</a>.</p> |
| 31 |
</div> |
| 32 |
|
| 33 |
|
| 34 |
<h2 class="wppb-callout"><?php esc_html_e( 'Paid Member Subscriptions - a free WordPress plugin', 'profile-builder' ); ?></h2> |
| 35 |
<hr/> |
| 36 |
<div class="wppb-row wppb-2-col"> |
| 37 |
<div> |
| 38 |
<p><?php esc_html_e( 'With the new Subscriptions Field in Profile Builder, your registration forms will allow your users to sign up for paid accounts.', 'profile-builder' ); ?></p> |
| 39 |
<p>Other features of Paid Member Subscriptions are:</p> |
| 40 |
<ul> |
| 41 |
<li><?php esc_html_e( 'Paid & Free Subscriptions', 'profile-builder' ); ?></li> |
| 42 |
<li><?php esc_html_e( 'Restrict Content', 'profile-builder' ); ?></li> |
| 43 |
<li><?php esc_html_e( 'Member Management', 'profile-builder' ); ?></li> |
| 44 |
<li><?php esc_html_e( 'Email Templates', 'profile-builder' ); ?> </li> |
| 45 |
<li><?php esc_html_e( 'Account Management', 'profile-builder' ); ?> </li> |
| 46 |
<li><?php esc_html_e( 'Subscription Management', 'profile-builder' ); ?> </li> |
| 47 |
<li><?php esc_html_e( 'Payment Management', 'profile-builder' ); ?> </li> |
| 48 |
</ul> |
| 49 |
</div> |
| 50 |
<div> |
| 51 |
|
| 52 |
<div> |
| 53 |
<?php |
| 54 |
$wppb_get_all_plugins = get_plugins(); |
| 55 |
$wppb_get_active_plugins = get_option('active_plugins'); |
| 56 |
|
| 57 |
$ajax_nonce = wp_create_nonce("wppb-activate-addon"); |
| 58 |
|
| 59 |
$pms_add_on_exists = 0; |
| 60 |
$pms_add_on_is_active = 0; |
| 61 |
$pms_add_on_is_network_active = 0; |
| 62 |
// Check to see if add-on is in the plugins folder |
| 63 |
foreach ($wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin) { |
| 64 |
if( strtolower($wppb_plugin['Name']) == strtolower( 'Paid Member Subscriptions' ) && strpos(strtolower($wppb_plugin['AuthorName']), strtolower('Cozmoslabs')) !== false) { |
| 65 |
$pms_add_on_exists = 1; |
| 66 |
if (in_array($wppb_plugin_key, $wppb_get_active_plugins)) { |
| 67 |
$pms_add_on_is_active = 1; |
| 68 |
} |
| 69 |
// Consider the add-on active if it's network active |
| 70 |
if (is_plugin_active_for_network($wppb_plugin_key)) { |
| 71 |
$pms_add_on_is_network_active = 1; |
| 72 |
$pms_add_on_is_active = 1; |
| 73 |
} |
| 74 |
$plugin_file = $wppb_plugin_key; |
| 75 |
} |
| 76 |
} |
| 77 |
?> |
| 78 |
|
| 79 |
<span id="wppb-add-on-activate-button-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Activate', 'profile-builder' ); ?></span> |
| 80 |
|
| 81 |
<span id="wppb-add-on-downloading-message-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Downloading and installing...', 'profile-builder' ); ?></span> |
| 82 |
<span id="wppb-add-on-download-finished-message-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Installation complete', 'profile-builder' ); ?></span> |
| 83 |
|
| 84 |
<span id="wppb-add-on-activated-button-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Plugin is Active', 'profile-builder' ); ?></span> |
| 85 |
<span id="wppb-add-on-activated-message-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Plugin has been activated', 'profile-builder' ) ?></span> |
| 86 |
<span id="wppb-add-on-activated-error-button-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Retry Install', 'profile-builder' ) ?></span> |
| 87 |
|
| 88 |
<span id="wppb-add-on-is-active-message-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Plugin is <strong>active</strong>', 'profile-builder' ); ?></span> |
| 89 |
<span id="wppb-add-on-is-not-active-message-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Plugin is <strong>inactive</strong>', 'profile-builder' ); ?></span> |
| 90 |
|
| 91 |
<span id="wppb-add-on-deactivate-button-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Deactivate', 'profile-builder' ) ?></span> |
| 92 |
<span id="wppb-add-on-deactivated-message-text" class="wppb-add-on-user-messages"><?php echo esc_html__( 'Plugin has been deactivated.', 'profile-builder' ) ?></span> |
| 93 |
|
| 94 |
|
| 95 |
<div class="plugin-card wppb-recommended-plugin wppb-add-on" style="width: 111%;"> |
| 96 |
<div class="plugin-card-top"> |
| 97 |
<a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/"> |
| 98 |
<img src="<?php echo esc_url( plugins_url( '../assets/images/pms-recommended.png', __FILE__ ) ); ?>" width="100%"> |
| 99 |
</a> |
| 100 |
<h3 class="wppb-add-on-title"> |
| 101 |
<a target="_blank" href="http://wordpress.org/plugins/paid-member-subscriptions/">Paid Member Subscriptions</a> |
| 102 |
</h3> |
| 103 |
<h3 class="wppb-add-on-price"><?php esc_html_e( 'Free', 'profile-builder' ) ?></h3> |
| 104 |
<p class="wppb-add-on-description"> |
| 105 |
<?php esc_html_e( 'Accept user payments, create subscription plans and restrict content on your website.', 'profile-builder' ) ?> |
| 106 |
<a href="<?php esc_url( admin_url() );?>plugin-install.php?tab=plugin-information&plugin=paid-member-subscriptions&TB_iframe=true&width=772&height=875" class="thickbox" aria-label="More information about Paid Member Subscriptions - membership & content restriction" data-title="Paid Member Subscriptions - membership & content restriction"><?php esc_html_e( 'More Details', 'profile-builder' ); ?></a> |
| 107 |
</p> |
| 108 |
</div> |
| 109 |
<div class="plugin-card-bottom wppb-add-on-compatible"> |
| 110 |
<?php |
| 111 |
if ($pms_add_on_exists) { |
| 112 |
|
| 113 |
// Display activate/deactivate buttons |
| 114 |
if (!$pms_add_on_is_active) { |
| 115 |
echo '<a class="wppb-add-on-activate right button button-primary" href="' . esc_url( $plugin_file ) . '" data-nonce="' . esc_attr( $ajax_nonce ) . '">' . esc_html__('Activate', 'profile-builder') . '</a>'; |
| 116 |
|
| 117 |
// If add-on is network activated don't allow deactivation |
| 118 |
} elseif (!$pms_add_on_is_network_active) { |
| 119 |
echo '<a class="wppb-add-on-deactivate right button button-primary" href="' . esc_url( $plugin_file ) . '" data-nonce="' . esc_attr( $ajax_nonce ) . '">' . esc_html__('Deactivate', 'profile-builder') . '</a>'; |
| 120 |
} |
| 121 |
|
| 122 |
// Display message to the user |
| 123 |
if( !$pms_add_on_is_active ){ |
| 124 |
echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . esc_html__('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>'; |
| 125 |
} else { |
| 126 |
echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . esc_html__('Plugin is <strong>active</strong>', 'profile-builder') . '</span>'; |
| 127 |
} |
| 128 |
|
| 129 |
} else { |
| 130 |
|
| 131 |
// If we're on a multisite don't add the wpp-add-on-download class to the button so we don't fire the js that |
| 132 |
// handles the in-page download |
| 133 |
if (is_multisite()) { |
| 134 |
$wppb_paid_link_class = 'button-primary'; |
| 135 |
$wppb_paid_link_text = esc_html__('Download Now', 'profile-builder' ); |
| 136 |
} else { |
| 137 |
$wppb_paid_link_class = 'button-primary wppb-add-on-download'; |
| 138 |
$wppb_paid_link_text = esc_html__('Install Now', 'profile-builder'); |
| 139 |
} |
| 140 |
|
| 141 |
echo '<a target="_blank" class="right button ' . esc_attr( $wppb_paid_link_class ) . '" href="https://downloads.wordpress.org/plugin/paid-member-subscriptions.zip" data-add-on-slug="paid-member-subscriptions" data-add-on-name="Paid Member Subscriptions" data-nonce="' . esc_attr( $ajax_nonce ) . '">' . esc_html( $wppb_paid_link_text ) . '</a>'; |
| 142 |
echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . esc_html__('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>'; |
| 143 |
|
| 144 |
} |
| 145 |
?> |
| 146 |
<div class="spinner"></div> |
| 147 |
<span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(esc_html__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'http://www.wordpress.org/plugins/paid-member-subscriptions' )) ?></a>.</span> |
| 148 |
</div> |
| 149 |
</div> |
| 150 |
</div> |
| 151 |
|
| 152 |
|
| 153 |
</div> |
| 154 |
</div> |
| 155 |
|
| 156 |
<h2 class="wppb-callout"><?php esc_html_e( 'Step by Step Quick Setup', 'profile-builder' ); ?></h2> |
| 157 |
<hr/> |
| 158 |
<p>Setting up Paid Member Subscriptions opens the door to paid user accounts. </p> |
| 159 |
<div class="wrap wppb-wrap wppb-1-3-col"> |
| 160 |
<div><h3>Create Subscription Plans</h3> |
| 161 |
<p>With Paid Member Subscriptions it’s fairly easy to create tiered subscription plans for your users. </p> |
| 162 |
<p>Adding a new subscription gives you access to the following options to set up: subscription name, description, duration, the price, status and user role.</p> |
| 163 |
</div> |
| 164 |
<div style="text-align: right"> |
| 165 |
<p><img src="<?php echo esc_url( WPPB_PLUGIN_URL ); ?>assets/images/pms_all_subscriptions-600x336.jpg" alt="paid subscription plans"/></p> |
| 166 |
</div> |
| 167 |
</div> |
| 168 |
<div class="wrap wppb-wrap wppb-1-3-col"> |
| 169 |
<div><h3>Add Subscriptions field to Profile Builder -> Manage Fields</h3> |
| 170 |
<p>The new Subscription Plans field will add a list of radio buttons with membership details to Profile Builder registration forms.</p> |
| 171 |
</div> |
| 172 |
<div style="text-align: right"> |
| 173 |
<p><img src="<?php echo esc_url( WPPB_PLUGIN_URL ); ?>assets/images/pms_pb_add_subscription-600x471.png" alt="manage fields subscription plans"/></p> |
| 174 |
</div> |
| 175 |
</div> |
| 176 |
<div class="wrap wppb-wrap wppb-1-3-col"> |
| 177 |
<div><h3>Start getting user payments</h3> |
| 178 |
<p>To finalize registration for a paid account, users will need to complete the payment.</p> |
| 179 |
<p>Members created with Profile Builder registration form will have the user role of the selected subscription.</p> |
| 180 |
</div> |
| 181 |
<div style="text-align: right"> |
| 182 |
<p><img src="<?php echo esc_url( WPPB_PLUGIN_URL ); ?>assets/images/pms_pb_register_page-600x618.png" alt="register payed accounts"/></p> |
| 183 |
</div> |
| 184 |
</div> |
| 185 |
|
| 186 |
|
| 187 |
<div id="pms-bottom-install" class="wppb-add-on"> |
| 188 |
<div class="plugin-card-bottom wppb-add-on-compatible"> |
| 189 |
<?php |
| 190 |
if ($pms_add_on_exists) { |
| 191 |
|
| 192 |
// Display activate/deactivate buttons |
| 193 |
if (!$pms_add_on_is_active) { |
| 194 |
echo '<a class="wppb-add-on-activate right button button-secondary" href="' . esc_url( $plugin_file ) . '" data-nonce="' . esc_attr( $ajax_nonce ) . '">' . esc_html__('Activate', 'profile-builder') . '</a>'; |
| 195 |
|
| 196 |
// If add-on is network activated don't allow deactivation |
| 197 |
} elseif (!$pms_add_on_is_network_active) { |
| 198 |
echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . esc_url( $plugin_file ) . '" data-nonce="' . esc_attr( $ajax_nonce ) . '">' . esc_html__('Deactivate', 'profile-builder') . '</a>'; |
| 199 |
} |
| 200 |
|
| 201 |
// Display message to the user |
| 202 |
if( !$pms_add_on_is_active ){ |
| 203 |
echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . esc_html__('Plugin is <strong>inactive</strong>', 'profile-builder') . '</span>'; |
| 204 |
} else { |
| 205 |
echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . esc_html__('Plugin is <strong>active</strong>', 'profile-builder') . '</span>'; |
| 206 |
} |
| 207 |
|
| 208 |
} else { |
| 209 |
|
| 210 |
// If we're on a multisite don't add the wpp-add-on-download class to the button so we don't fire the js that |
| 211 |
// handles the in-page download |
| 212 |
if (is_multisite()) { |
| 213 |
$wppb_paid_link_class = 'button-secondary'; |
| 214 |
$wppb_paid_link_text = __('Download Now', 'profile-builder' ); |
| 215 |
} else { |
| 216 |
$wppb_paid_link_class = 'button-secondary wppb-add-on-download'; |
| 217 |
$wppb_paid_link_text = __('Install Now', 'profile-builder'); |
| 218 |
} |
| 219 |
|
| 220 |
echo '<a target="_blank" class="right button ' . esc_attr( $wppb_paid_link_class ) . '" href="https://downloads.wordpress.org/plugin/paid-member-subscriptions.zip" data-add-on-slug="paid-member-subscriptions" data-add-on-name="Paid Member Subscriptions" data-nonce="' . esc_attr( $ajax_nonce ) . '">' . esc_html( $wppb_paid_link_text ) . '</a>'; |
| 221 |
echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . esc_html__('Compatible with your version of Profile Builder.', 'profile-builder') . '</span>'; |
| 222 |
} |
| 223 |
?> |
| 224 |
<div class="spinner"></div> |
| 225 |
<?php /* <span class="wppb-add-on-user-messages wppb-error-manual-install"><?php printf(__('Could not install plugin. Retry or <a href="%s" target="_blank">install manually</a>.', 'profile-builder'), esc_url( 'http://www.wordpress.org/plugins/paid-member-subscriptions' )) ?></a>.</span> */ ?> |
| 226 |
</div> |
| 227 |
</div> |
| 228 |
|
| 229 |
|
| 230 |
</div> |
| 231 |
<?php |
| 232 |
} |
| 233 |
/* |
| 234 |
* Instantiate a new notification for the PMS cross Promotion |
| 235 |
* |
| 236 |
* @Since 2.2.5 |
| 237 |
*/ |
| 238 |
if ( ( !isset($_GET['page']) || $_GET['page'] != 'profile-builder-pms-promo' ) && function_exists('is_plugin_active') && !is_plugin_active( 'paid-member-subscriptions/index.php' ) ){ |
| 239 |
new WPPB_Add_General_Notices('wppb_pms_cross_promo', |
| 240 |
sprintf(__('Allow your users to have <strong>paid accounts with Profile Builder</strong>. %1$sFind out how >%2$s %3$sDismiss%4$s', 'profile-builder'), "<a href='" . esc_url( admin_url('options.php?page=profile-builder-pms-promo') ) . "'>", "</a>", "<a class='wppb-dismiss-notification' href='" . esc_url( add_query_arg('wppb_pms_cross_promo_dismiss_notification', '0') ) . "'>", "</a>"), |
| 241 |
'pms-cross-promo'); |
| 242 |
} |
| 243 |
|