Separate Subscription Options, and only allow subscription via invite code.

Can I separate subscription level options to certain pages, instead of all subscription level options on one page?

Is it possible to restrict a member from subscribing without an invite code?
- this user would likely be already registered and the only option for this I see is at the registration level.

Thank you

  • Mason

    Hiya hypermediadotca,

    Check out the file membership/membershipincludes/addons/extra.shortcodes.php

    There are several shortcodes you can use to output the specific title, description, and subscription buttons so that you can provide for separate pages for each subscription. I know Barry's working on this process to make it a bit easier, but for now creating separate WordPress pages with these codes should do the trick.

    Thanks!

  • brianmyrick

    Here's the code to get the extra short codes to show up in the Access Level rules. I just created a new file in /wp-content/plugins/membership/membershipincludes/addons called fixextrashortcodes.php

    Here's the PHP to put in that file:

    <?php
    /*
    Addon Name: Fix Extra Shortcodes
    Author: Brian (Interversant)
    Author URI: http://interversant.com
    
    The extra shortcodes provided by the Extra Shortcodes add-on do not
    show up in the list for Shortcodes in the Membership Access Level rules.
    
    This add-on resolves that issue.
    */
    
    // subscriptiontitle shortcode
    add_action('init', 'M_setup_subscriptiontitle_shortcode');
    
    function M_setup_subscriptiontitle_shortcode() {
    	if(is_admin()) {
    		add_shortcode('subscriptiontitle', 'M_fakesubscriptiontitleshortcode');
    	}
    }
    
    function M_fakesubscriptiontitleshortcode($atts, $content = null, $code = "") {
    	return '';
    }
    
    // subscriptiondetails shortcode
    add_action('init', 'M_setup_subscriptiondetails_shortcode');
    
    function M_setup_subscriptiondetails_shortcode() {
    	if(is_admin()) {
    		add_shortcode('subscriptiondetails', 'M_fakesubscriptiondetailsshortcode');
    	}
    }
    
    function M_fakesubscriptiondetailsshortcode($atts, $content = null, $code = "") {
    	return '';
    }
    
    // subscriptionprice shortcode
    add_action('init', 'M_setup_subscriptionprice_shortcode');
    
    function M_setup_subscriptionprice_shortcode() {
    	if(is_admin()) {
    		add_shortcode('subscriptionprice', 'M_fakesubscriptionpriceshortcode');
    	}
    }
    
    function M_fakesubscriptionpriceshortcode($atts, $content = null, $code = "") {
    	return '';
    }
    
    ?>
  • brianmyrick

    Now, back to the originators post: part 1 of the question was how do I create a separate registration page for different subscriptions?

    @masonjames: I don't understand how using those short codes helps that. All I see is that it displays the title, details and price on a page. But how do I create a registration page that has only a single option? Do I pass the registration form an option like [subscriptionform subscription="2"] ??

    I'll dig into this now as time allows. Any help would be appreciated.

  • brianmyrick

    I've learned there's a reason that the Extra Shortcode add-on is marked as deprecated - they have been added to the main codebase. And while pouring through the main codebase, I found a reference to the subscription button short code.

    But, like the other short codes, it doesn't show up in the rules list for access levels. So, after adding it to the Fix Extra Shortcodes in Access Rules add-on that I wrote (above) this is what is displayed when using it:

    [button class='popover' link='http://localhost/wp-admin/admin-ajax.php?action=buynow&subscription=1']Buy Now[/button]

    Obviously a reference to a shortcode plugin that I don't have.

    So I tried that link manually, and it returns -1 and otherwise does nothing.

    I feel like I'm making progress, but slowly. Can you guys help me out?

  • brianmyrick

    I didn't edit the short code. I found the reference to the short code in membershippublic.php. I'm using short code rules in my access levels, but it doesn't load in the list (like wpaudio) so I created an add-on based on wpaudioshortcode.php that does the same thing for the subscription short codes in membershippublic.php.

    After I did that, I get the popover shortcode. And that link does nothing. So I looked into admin-ajax.php but wasn't able to figure out how that link is supposed to work.

  • Barry

    Oops, looks like i missed adding these to the admin area as well. I've set them to be unprotected in the next release, but the the current release the easiest way to getting them to show is to remove them from membershippublic.php and then use the add-on instead and they'll show in both areas.

    To remove them from membershippublic.php, edit the file (it's in the classes directory) and find the function called initialise_plugin (it'll be around line 76). Look for and delete the following lines:

    // Moved extra shortcodes over to the main plugin for new registration forms
    			add_shortcode('subscriptiontitle', array(&$this, 'do_subscriptiontitle_shortcode') );
    			add_shortcode('subscriptiondetails', array(&$this, 'do_subscriptiondetails_shortcode') );
    			add_shortcode('subscriptionprice', array(&$this, 'do_subscriptionprice_shortcode') );
    			add_shortcode('subscriptionbutton', array(&$this, 'do_subscriptionbutton_shortcode') );

    Save the file and then activate the extra shortcodes add-on.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.