setting up Free plan on prosite

Hello,

How do i setup a free plan, not free trial. i want to be able to have a free plan and limit the upload quota space, limit plugin access and theme access for the Free Plan.

i deactivated "Pay To Blog" because i think it will block free users.
i have "Upload Quota, Premium Themes, Premium Plugins" activated.

  • Ash
    • WordPress Hacker

    Hello @Thomas Whittaker

    I hope you are well today and thanks for asking the question.

    You can use is_pro_site function, like:

    if( is_pro_site( $site_id ) ) {
      // The site is pro
    }else{
      // The site is not pro
    }

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Tom Whittaker
    • The Crimson Coder

    Thanks. sorry for the late reply, i get to write the custom code for a specific post type. in my case was woocommerce, because the blog post limit isnt working for woocommerce product postype, it will only work if woocommerce is network activated or if woocommerce is install in the main site. so i basically wanted to have an upgrade button when user reach to their limit.

    add_action( 'post_submitbox_misc_actions', 'upgrade_button' );
    function upgrade_button (){
    //prosite & WP global variables
    global $psts, $current_screen, $level, $blog_id;
    //assigned the current blog id to $level variable
    $level = $psts->get_level($blog_id);
    //that's where you limit the number of post/items
    $limit ="100";//limit product for BASIC USERS
    $limit2 ="500";//limit product for PRO USERS
    $limit3="2";//limit product for free users
    //thats where you defined the posttype, in this case. postype is product.
    $post_type ="product";
    /* here, we get the current screen that the user is viewing, then the postype which we have assigned "product" to,
    then we tell it, to make sure that the user is able to manage_option. by default administrator manage_option is assigned to administrator
    Please view WP codex :https://codex.wordpress.org/Roles_and_Capabilities
    */
    if ( in_array( $current_screen->id, array( $post_type, 'edit-' . $post_type ) ) && current_user_can('manage_options') ) {
    /*
    This is very important: this where you check the blog level and the total # of product
    that this blog level can add before you tell them they need to upgrade.
    in this example, we check for blog with LEVEL 1 and We tell that blog you can only have 100 products.
    */
    if ( ($level=="1" && is_numeric($limit ) && wp_count_posts( $post_type )->publish >= $limit )
    || ($level=="2" && is_numeric($limit2 ) && wp_count_posts( $post_type )->publish >= $limit2 )
    || ($level < 1 && wp_count_posts( $post_type )->publish >= $limit3 )
    ) {
    ?>
    <style>
    #publishing-action { display: none; }
    #publish-action { display: none;}
    #psts-upgrade { margin-top: 4px;display: block;text-align: center; }
    </style>
    <div class="misc-pub-section">
    <a id="psts-upgrade" class="button button-primary button-large" target="_blank"
    href="<?php echo $psts->checkout_url( get_current_blog_id() ); ?>"><?php _e( 'Upgrade Your Account', 'psts' ); ?>
    </div>
    <?php
    }
    }
    }

  • Tom Whittaker
    • The Crimson Coder

    Hello again,

    I;ve been testing pro site from 3.0 to the current version.
    so what's happening with the latest for me, when i activate the free plan is that after user finish signup,login etc.. they are able to access their free items only however when that user decided to upgrade to a higher plan, the payment go through, i see the changes in paypal sandbox and prosite management section that the user has subscribe to a particular plan, however even though all that happened the user pro site level still not upgrading, so when i manually activate the user prosite level for the first time, then the user is able to upgrade and downgrade their plan. is there a way you can help me to get it to update the user pro site level upon the first payment. if that can happn then it will solve my problem. all i will have to do is copy the coupon codes from V.3.5.1.2 because i see that the coupon applied in that version perfectly.

    Thanks.

  • Tom Whittaker
    • The Crimson Coder

    Am on localhost, can reproduce it on your system. Use the latest version of prosites, setup a free plan , then signup a site using the free plan and them try to make your first purchase/upgrade to a higher plan. Then you will see that its not updating the site level, it only work when you manually update the site level and then the site can freely upgrade/downgrade.

    Thanks, please do that ASAP before my wpmu dev membership expired.

  • Hoang Ngo
    • Code Slayer

    Hi @Thomas Whittaker,

    I hope you are well today.

    Pro Sites payment won't work if you are setting it up on a local host, this will happen to other plugins, which having subscription model.

    The reason is we will rely on IPN (PayPal), or webhooks (Stripe). The gateway API will need to post back to your site for subscription data, and your site will listen to the data, and finishing the process when they received.

    If you are on your local, which mean you separate with the rest of the world => IPN can't reach to your site, the process never complete, so it won't work properly.

    Please upload your site on a live server, and see if that works for you :slight_smile:

    I use a live server for test, and it still works for me.

    Best regards,
    Hoang

  • Ash
    • WordPress Hacker

    Hi @Thomas Whittaker

    I have talked to the developer and the reason is, the subscription will not work in local site.

    You must need a live site and you have to set IPN in the paypal account.

    Would you please try in a live site?

    I have just tested in a live site and worked fine for me.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.