Pro-sites free & paid

I am trying to create a site with two options,

one a free option, one a paid for option.
The free option has a basic theme, the paid for option has a prmeium theme and is fully populated with plugins / example data etc.
There is a free trial period for the premium theme.

At first glance, you would think pro-sites combined with 'template sites' can do this, but I have discovered this is not so.
1. if you set a free trail, the option to that a 'free' level gets shut off
2. if you uses template sites, giving a selection of two at sign-up
2a) with a free level enabled (no free trial) the selection of the premium theme simply 'gives it away'
2b) with a free TRIAL the selection of the 'free' theme results in a request for payment for the free theme after the trail ends (as with free trial there is NO free level)
3. If you used the pro-site option at sign-up to offer 'upgrade or free'
3a) with free trail turned on, this just doesn't work - as the free option is turned off, if you set 'free' you acutally get a free trail (sames as selecting upgrade)
3b) with free trial turned OFF, this works, but template site only has ONE default, so if you set the default to be the 'free' template you get that whether you want it or want teh paid one, and you get no free trial.

So what seems fairly basic requirements, offer a free site or a free trail of a premium site, with one click at signup, doen't seem possible.
Have I missed something?

What I am thinking is with some tweaks it might be able to make it work as I want.

Something along teh lines of modifying 'pay per blog' to not shut down the free option, and to add a speccific blog_option to the free / and or premium themes' so that logic an be appiled

Obviously, I would need to start tweaking prosites - so before I do that I would like some input / thoughts

  • Paul Barthmaier

    Hi there,

    I know this can be confusing, but what you are wanting to do is possible and expected. The thing that gets complicated is where and how ProSites fits in. Right now, I don't have a ton of time, but I'd like to offer some thoughts to get you started and then someone from the staff can chime in.

    To start, when you have MultiSite installed, the site creation functionality is built in and all new sites are free. The reason why you want to install ProSites is to offer value-added themes, plugins, etc. These upgrades can be offered on a Trial basis, after which your user sites will revert to the free level if they don't pay the premium.

    But here's where you may be getting stuck. If you have your plugins and themes Network-enabled, then that means they are available for everyone for free, if you have a free level. Be sure that you don't network-enable, but rather associate the Premium plugins, themes, etc with your upgraded level.

    How about you confirm that you've done the above and then let us know how you are going?

  • Fullworks

    Thanks guys. I have spent a while testing this and trying to solve it, so I appreciate breaking it down into chunks. I also need to double check each step.

    My hypothesises are that
    'blog templates' gives away premium themes'.
    'free trial of pro-sites removes the free option' (I saw this mentioned on another thread too)

    Let see if I am wrong.

    Step 1.
    Setup:
    Premium theme is NOT network enabled.
    Premium theme appears in Premium Theme screen and is assigned to pro-sites level 1
    Free trial is disabled.

    Test 1
    create new user & blog with signup.php showing the 'blog template choices'
    select premium theme based template

    Results 1
    blog created
    visit site -> site immediately available
    login as new user -> straight in, NO payment account page
    new site 'status' is Manage Site : "testsite" has never been a Pro Site.

    Conclusion
    Template Blog has given away a premium theme.

  • Kimberly

    @ROIBOT

    I think there is a bit of a misunderstanding in what the plugins do and how they interact. Let's see if I can explain the logic of what is happening...

    'blog templates' gives away premium themes'.

    no it does not. this is because Blog Templates is meant to do one thing and one thing only, that is to create clones of a particular site. It is no way Integrated with Pro Sites, it is only integrated into the site creation process.

    If you have a theme marked as a premium theme, then that theme would not be available for you to choose in a list of themes on your template site, as it would not be network activated. Unless you made that site a ProSite. In either case, Blog Templates would do exactly what it's designed to do, which is create a copy of the template site.

    So the logic in the new site being created is
    A: Blogs Template is only doing it's job, it's not designed to police ProSites
    and
    B: why would a premium theme be available in a site that you are using to create a free trial site to begin with? as all premium themes are network de-activated

    As for your paid/free issue

    Pro Sites ships with a free basic blog. The free trial is only the option to put a time-limit on that free basic blog. Not to disable the free basic blog. That is what the "pay to blog" module is used for.

    That is why there was no action to pay to use the blog on your trial and why the premium theme you set up was visible.

    I hope this helps to explain a bit. Please let me know if I can clarify anything else.

    Best,

    Kimberly

  • Fullworks

    That is why there was no action to pay to use the blog on your trial and why the premium theme you set up was visible.

    I had free trial turned off so I don't understand this comment

    Simply put Pro-Sites appears to fails police premium themes that are created at signup through blog template.

    Is it meant to?

    My hypothesises are modified to
    pro-sites does not police premium themes. ( a good question here, or an easy test, is create a site with a premium theme and down grade the site level, I'll test that in a minute )
    'free trial of pro-sites removes the free option' (confirmed?)

  • Fullworks

    I dont understand

    If you have a theme marked as a premium theme, then that theme would not be available for you to choose in a list of themes on your template site, as it would not be network activated.

    As a superuser/network admin creating default sites, all themes are are available to be added as premium themes, regardless. Once created, as superuser, you can then configure 'template blogs' to be selectable on the signup page. I don't understand the unavailability comment.

    B: why would a premium theme be available in a site that you are using to create a free trial site to begin with? as all premium themes are network de-activated

    I perhaps need to explain what I am trying to achieve, I understand this MAY not be what the wpmudev plugins are designed to do, I am trying to eliminate missing something before creating code that will achieve it.

    I want to have two 'sites' that the user can choose at sign-up
    1. site A is pretty basic theme and will be free to the user
    2. site B is pretty customisable theme , it has advanced features AND it is pre-populated with example images, pages, posts, menus so it creates a 'pro forma' website. And the user can get a free trial for 7 days to customise their site, there after they have to pay for it.

    So what I think you are confirming is Blog Templates, used in this manner appears to give away at signup the premium theme and there is nothing in Pro-Sites that checks that a if a site has been created via Blog Templates that polices this after the fact.

    The free trial is only the option to put a time-limit on that free basic blog.

    And that free trial applies to the free level, despite in the settings it would appear that free trial would apply to a pro-sites level (the dropdown afterwards), this is just misleading me. So when rather than the free blog gets upgraded to a pro-site level and reverts to free, it is in essence removes the built in free blog and just gives a pro-site level.

    So if I understand you correctly I will need to make the following enhancements to pro-sites
    1. police what level a theme is allowed to be used at, that should be fairly easy, as the pro-site level of premium themes are held somewhere, and 'pay to blog' has blocking code
    2. Create some sort of option that allows free trail and free sites. One thought is to forget the free blog option, and to create 2 pro-site levels 1 - would be 'free' and 2 would be paid for and then make changes so the payment gateway calls are not made for the 'free' level 1.

    It looks like I will be dinging into pro-sites code then, as there is no 'out of the box' solution for my setup.

    Let me know if I have mis-understood

  • Fullworks

    pro-sites does not police premium themes. ( a good question here, or an easy test, is create a site with a premium theme and down grade the site level, I'll test that in a minute )

    OK, it took longer than a minute, as I had to test on a site without template blogs too.

    On a site without template blogs, the functionality is quite neat.

    When you add a site that isn't pro-sites obviously you don't have premium themes to choose from.

    When you upgrade to pro-sites and add a premium theme it is good.

    When you downgrade it changes you to the network's default theme.

    This is good.

    With Blog Templates, the same thing happens, except as mentioned before, the issue that a premiium theme can (and wants to be used) but payment isn't asked for by pro-sites.

  • Kimberly

    I had free trial turned off so I don't understand this comment

    The only way to turn off the free site option is to enable Pay to Blog.

    The free trial is only a time quantifier for the Free usage, not an on off switch. If you set the trial to disabled that means the Free site usage is still available, just with no deadline for use. It does and will work to have a time sensitive pro site trial as well as a free blog option on the same site.

    I think our difference is a matter of perspective here :slight_smile: What you want it to do vs. what it does.

    The intended use and functionality of the designs is:

    User signs up for a site. If Free site then they must upgrade for premium theme. If ProSite then they have access to premium theme already.

    Blog Templates really isn't supposed to be part of the equation (from our design perspective). So, again I think it's a matter of what your looking for vs what it is designed to do.

    It sounds like a very interesting project. It will function the way you need it to, just that user will have to upgrade the way ProSites requires. It won't be instantaneous through Blog Templates.

    I'm very interested to know how you get along! If you need anything please let us know :slight_smile:

    Best!

    Kimberly

  • Fullworks

    It does and will work to have a time sensitive pro site trial as well as a free blog option on the same site.

    Yes, I had a bug in my configuration, where the default theme was incorrectly spelt in the wp-config.php. At the end of the free trial any premium themes automatically revert to the default (twentyeleven or as specified in wp-config). Due to the error in wp-config at the end of the trial the user gets to 'keep' the premium theme, as it can't be down graded to the 'mising' default theme.

    Blog Templates really isn't supposed to be part of the equation (from our design perspective). So, again I think it's a matter of what your looking for vs what it is designed to do..

    I understand that now, however I do need to an instant creation of a premium site, so I will have to add some additional logic to pro-sites to make sure that the equivalent of pay-per-blog kicks in only for the premium themes. It is just tricky working out the best approach that will minimise code change and avoid breaking other functionality.

  • Fullworks

    @kimberly are you getting bored with this one yet!

    I am certainly getting board with creating blogs, changing setting, installing / uninstalling plugins.

    OK, now I know why I was getting resistance.

    If I start from a fresh, pro-sites works pretty much perfectly as designed, i.e. free trail, end of free trail, theme gets down graded option to pay or stay on free. Wonderful.

    Install 'New Blog Template' and set up a blog and none of that works any more.

    I think this is an operability bug between new blog templates and pro-sites.

    I think what happens is as you set up the new blog template as network administrator, something gets copied across in the options that makes you a superuser and hence 'turns off' pro-sites payment request / theme downgrades on expiry of free trial.

    I do believe that is a bug, not a design feature. I have tested it on two different wpmu networks and get the same result.

    I will endeavour to continue look for root bug, however I would appreciate if someone who knows the internals of pro-sites and new-blog-template can take a look at this too, as they probably could identify the cause / solution much quicker (I haven't yet even looked into the code of new-blog-template)

  • Fullworks

    OK thanks.

    Here you go. Although I have down graded my YIPPEEEEE to , hmmmm,.

    I will be giving your cookies back at this rate, hope they don't go stale!

    My manual work around doesn't work! (well it does but it really would be a manual intervention every time a blog is created).

    The option Psts Signed Up [option 'psts_signed_up'] is always set to 0 (false) on a blog that is created via blog templates.

    This seems to stop the automated redirect to payment page on expiry of trial.

    By manually setting Psts Signed Up to 1, (network>sites>click on site>settings) on the blog that has been created makes the payment page work.

    The code and logic in pro-sites is quite complex

    around line 3545 of pro-sites.php the copy of psts_signed_up

    /* exclude option from New Site Template plugin copy */
    	function blog_template_settings( $and ) {
    		$and .= " AND <code>option_name</code> != 'psts_signed_up' AND <code>option_name</code> != 'psts_action_log' AND <code>option_name</code> != 'psts_waiting_step' AND <code>option_name</code> != 'psts_payments_log' AND <code>option_name</code> != 'psts_used_coupons' AND <code>option_name</code> != 'psts_paypal_profile_id' AND <code>option_name</code> != 'psts_stripe_canceled'";
    		return $and;
    	}

    is specifically excluded from the blog template creation (through the filter applied on line 88

    add_filter( 'blog_template_exclude_settings', array(&$this, 'blog_template_settings') ); // exclude pro site setting from blog template copies

    There must be a reason why it is excluded, perhaps it is to do with the logic of the optional

    Show Option On Signup Display an option on the signup page
    You can force and hide the signup option by linking to the signup page like this: wp-signup.php?account=1

    I don't really know, but I do know that because it is not copied across the payment page doesn't appear.

    I will remove this option from the exclude list in my copy of pro-sites.php and do further testing and let you know I spot any unexpected impact (p.s. I believe I can tweak the code by removing and adding this filter, i'll give it a go anyway, better than hacking plugin code)

  • Fullworks

    OK,

    I have tried removing the 'Psts Signed Up' exclude from the pro-site code (hard coding it to be sure its not my filter code)

    And still a site that is Psts Signed Up = 1 that is used as a template ends up as a new site with 'Psts Signed Up' = 0

    So I still don't have a fix for this issue.

    I will continue to look, but would appreciate of some one that understand what and where 'Psts Signed Up' is set and used could take a look, too.

    Alan

  • Fullworks

    I'm struggling now .....

    In pro-sites.php it is clear the intent is that psts_signed_up is set to 1 (yes converts to 1) when a new blog is set up and sign-up option is not displayed or sign up option is display and 'interested' is selected.

    So logically it is correct to exclude psts_signed_up from the copy of the template.

    What I don't understand is why psts_signed_up is set to zero when I use blog templates. I guess I am going to have to dig further into the code - is there something that overrides the functions in pro-sites? I am not sure.

    function signup_output() {
    
    	  if ($this->get_setting('show_signup') && !isset($_GET[sanitize_title($this->get_setting('rebrand'))]) && !isset($_POST['psts_signed_up_override'])) {
    	  ?>
    	  <div class="register-section clear" id="supporter">
    			<label class="label"><?php echo $this->get_setting('rebrand'); ?></label>
    	    <?php echo $this->get_setting('signup_message'); ?>
    
    			<label class="checkbox" for="psts_signed_up_yes">
    				<input type="radio" id="psts_signed_up_yes" name="psts_signed_up" value="yes"<?php echo (!isset($_POST['psts_signed_up']) || $_POST['psts_signed_up']=='yes') ? ' checked="checked"' : ''; ?> />
    				<strong><?php _e( "I'm Interested", 'psts' ); ?></strong>
    			</label>
    			<label class="checkbox" for="psts_signed_up_no">
    				<input type="radio" id="psts_signed_up_no" name="psts_signed_up" value="no"<?php echo (isset($_POST['psts_signed_up']) && $_POST['psts_signed_up']=='no') ? ' checked="checked"' : ''; ?> />
    				<strong><?php _e( "Not Now", 'psts' ); ?></strong>
    			</label>
    		</div>
    
    	  <?php
    	  } else if (isset($_GET[sanitize_title($this->get_setting('rebrand'))]) || isset($_POST['psts_signed_up_override'])) {
    	    echo '<input type="hidden" name="psts_signed_up" value="yes" />';
    	    echo '<input type="hidden" name="psts_signed_up_override" value="1" />';
    	  }
    
    	}
    
    	function signup_override() {
    	  //carries the hidden signup field over from user to blog signup
    	  if (isset($_GET[sanitize_title($this->get_setting('rebrand'))]) || isset($_POST['psts_signed_up_override'])) {
    	    echo '<input type="hidden" name="psts_signed_up_override" value="1" />';
    	  }
    	}
    
    	function signup_save($meta) {
    	  if (isset($_POST['psts_signed_up'])) {
    	    $meta['psts_signed_up'] = ($_POST['psts_signed_up']=='yes') ? 1 : 0;
    	  }
    
    	  return $meta;
    	}
  • Aaron

    I think you are just misinterpreting Pro Sites expected behavior.

    By default psts_signed_up option in never setup for new blog signups, and they will not redirect to the checkout page on first login. This is why it is skipped from new blog templates so that the new blog will behave correctly at creation.

    Here are the things that will cause the redirect to checkout:
    - If pay to blog module in enabled
    - When paid period expires (after they've checked out previously, or manually extended)
    - When free trial expires (if you are using this)

    The only time they will get the redirect on first login:
    - pay to blog enabled
    - Or the signup option enabled, and they choose "interested" on signup
    - Signup option enabled, and they use the signup for following the special link

    As far as your premium theme issue with NBT, NBT is the ultimate authority, it will override any protections/settings put in place by any other plugin unless specifically filtered out. Pro sites only checks and disabled active themes when a paid for period expires, or level is changed. Otherwise it simply prevents the premium theme from being activated by normal WP means.

  • Fullworks

    I think you are just misinterpreting Pro Sites expected behavior.

    No I understand! I might be mis-understanding the variable psts_signed_up as it cropped up as a possible solution when I compared settings side by side between a blog that worked and one that didn't, but it may not be the solution due to the limitation of my comparision.

    and they will not redirect to the checkout page on first login.

    I am only interested in free trial. You may have read some of my earlier posts, but that was a separate issue relating to default themes in wp-config, now fixed.

    It is late, here so I probably won't be able to cover all the bases here.

    If you read back through my long list, you will see
    1. without NBT, pro-sites works correctly, when free trial expires you get redirected to payment pages
    2. with NBT, pro-sites does not work correctly, when free trail exires you do not get redirect to payment pages

    Simple as that.

    the rest of my wittering is me trying to solve this bug, with limited input from WPMUdev, apart from ' you don't understand' it does work', but it doesn't, try it. It is time consuming to test as you have to adjust the expiry date timestamp in the database (or wait :slight_smile:

    I have tested this on two implementations.

  • Fullworks

    @Aaron & @Kimberly

    finally, after creating a 3rd WPMU environment from scratch and stepping through and checking carefully each stage.

    Here goes this is the problem:

    The setting psts_withdrawn is copied across from the template to the new site by NBT

    The setting psts_withdrawn being true stops the payment page from displaying (presumably to stop being repeatedly asked for payment)

    If you set up pro-sites with a free trial period (e.g. 7 days) and set up you template blog and it expires, you can get the situation where the psts_withdrawn is set to true, this is the situation I had.

    As NBT copies across psts_withdrawn, no payment page appears for my created blogs at expiry of trial.

    The solution was simple, set the template sites (even the free one) to permanent pro-site level. That way when the trial expires, you get the payment page (with option to go 'free')

    Now, I fully expect you to tell me that is in the NBT documentation somewhere :slight_smile: i.e. always set your templates to pro-site level permanently if you want free trail to work

    (You can't manually set the template site setting of psts_withdrawn to false in this situation, as the next time you log in the prro-site logic resets it to true.)

    I'm guess you probably should add psts_withdrawn to the NBT excluded list of setting, but of course that would need some full regression testing.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.