@Barry: Single Membership Subscription Buy Now Button

@Barry,

Just want to check if this is sort of the right direction for creating a buy now button? So that users can purchase single subs one at a time and thereby belong to multiple subscriptions

Basically I’m checking if using

<?php do_action('membership_purchase_button', $subscription, $pricing, $user_id); ?>

is the right direction???

I quickly created a short code to handle the buynow button here is the code and screen shots.

Read Me First:

I know shortcode buynow button isn’t ideal and the best solution would be to have a single buy now page that auto generates the subscription buy now button for specific subscription id

yourdomain.com/buy/?product=4

But I’m just testing the waters :wink:

Oh, love the private subscriptions – they work great :wink:

Here is BuyNow Shortcode:

add_shortcode('buynow', 'buynow_shortcode');
function buynow_shortcode( $atts, $content = null ) {

$defaults = array( "message" => 'you need an account',
"sub_id" => '',
);

extract(shortcode_atts($defaults, $atts));
if (function_exists(current_user_has_subscription)) {

if (!is_user_logged_in()) {
return $message;

} else {

$current_user = wp_get_current_user();
$user_id = $current_user->ID;

$subscription = new M_Subscription($sub_id);
?>
<div class='subscription'>
<div class='description'>
<h3><?php echo $subscription->sub_name(); ?></h3>
<p><?php echo $subscription->sub_description(); ?></p>
</div>

<?php
$pricing = $subscription->get_pricingarray();

if($pricing) {
?>
<div class='priceforms'>
<?php do_action('membership_purchase_button', $subscription, $pricing, $user_id); ?>
</div>
<?php
}
?>
</div>
<?php
}

}
}

Here Are Screenshots: