Using Pro sites and whmcs provisioning usage with free level and upgrade links.

Hello,
I am using WHMCS and want to use it to create sites on my WP MU and have two questions:
1. How whmcs provisioning designed to create free non-pro sites? I have created products in whmcs to match the pro sites levels and it all works fine, but how to setup free plan in whmcs, so it can be upgraded to pro site later? Can the free plan be registered on site and inserted in whmcs via api or all plans need to be created with whmsc?
2. Is Pro site have filter functions for upgrade links? I want to change upgrade links in admin menu and admin bar to point to whmcs?

  • aristath

    Hello again @Vitaliy,

    Once you setup the plugin, please follow the instructions on the usage page: https://premium.wpmudev.org/project/whmcs-multisite-provisioning/#usage

    I'm copying this excerpt from the docs:

    Integration with Pro Sites is an incredibly powerful feature that allows you to create separate products in WHMCS and associate them with Levels you create using Pro Sites. This lets you offer various plans through your WHMCS service, allowing clients to purchase additional features like Premium Plugins and Premium Themes.

    Simply install and configure Pro Sites, setting up various Levels as you want them, as per our Usage page.

    Then within the admin area of WHMCS, create a product for each Pro Sites Level (as detailed above). In each product, the ProSites ?eld should match the Level name in Pro Sites.

    Once that is done, clients will be able to purchase Pro Sites plans as products through WHMCS, upgrading, downgrading and canceling plans as they like.

    In other words, you duplicate your pro-sites levels in WHMCS as products and the plugin then takes care of upgrades etc. directly from WHMCS.

    Can the free plan be registered on site and inserted in whmcs via api or all plans need to be created with whmsc?

    All site registrations will have to be submitted on WHMCS, including free ones.

    2. Is Pro site have filter functions for upgrade links? I want to change upgrade links in admin menu and admin bar to point to whmcs?

    Unfortunately no, we currently don't have a filter to change these links.
    However, you could simply hide them and create your own. It shouldn't be too hard to accomplish with some custom code...

    I hope that helps!

    Cheers,
    Ari.

  • Michelle Shull

    Hey there, Vitaliy!

    Happy Sunday!

    Pro Sites creates a free level by default. You can change the default level for new sites to one of your own (free) levels, but you don't have to create one if the default free level meets your needs.

    Then, in WHMCS, you would add only the Pro Site levels you created, the default site won't need to be shown in WHMCS, since it's the default everyone gets when they sign up.

    Hope this helps!

  • Vitaliy

    Hi Michelle,

    I see your point, but there is small issue. When customer sign up for free account on site and than want to upgrade to pro site, he will need to fill the form in whmcs as he do not exists in whmcs database and this may put him off. The upgrade process should be simple.

    As Ari pointed- "All site registrations will have to be submitted on WHMCS, including free ones." and it make sence, but then the question arise how to add default free site plan to whmcs products?
    Should i create level with blank prices, or i just need to create product in whmcs with the same name as in pro sites settings, by default "Free"?

    I have tried to setup it the above way, but it doesn't look right.
    Here is what you see in site management window of newly created site:

    Manage Site
    Current Pro Site
    Pro Site privileges will expire on: 30th December 2014
    Level: 0 -

    When i create the site from signup on the site, not using whmcs, in site management window of newly created site i get this:

    Current Pro Site
    Pro Site privileges will expire on: 30th December 2014
    Level: 1 - Beginer
    Payment Gateway: Trial

    So i am getting first pro site level, but it should be free.

    I am missing something in setup. Can you explain in detail how to properly setup free level?

    I have granted access to my site, so you can look at my settings. Site address- fastwayweb.co.uk

  • Michelle Shull

    Hey there, Vitaliy

    I see your point as well, but let me counter with this - you need much more information from a paying customer than you do from a free member - do you want members on your free level who don't plan to upgrade to be required to create an WHMCS account they don't need or want?

    I'm happy to add a feature request to allow the default ProSite level to be added to WHMCS, so there's less friction at upgrade time.

    Have a great week!

  • Vitaliy

    Hey Mishelle,

    You will not win this one :slight_smile:. For free staff people do weird things and extra few fields will not make a difference, i think. And my aim to get paid, in most cases :slight_smile:.

    Anyway, it all sorted. When i disabled free trials in Pro sites plugin settings all began to work as i wanted.

    The thing i am missing so far is ability to change href of admin upgrade messages links like this one: "To publish more Posts, please upgrade to LEVEL »". By default it pointing to http://siteaddress/pro-site/?bid=xx.
    Is any way to point it to custom url? May be filters available?

  • Tyler Postle

    Hey Vitaliy,

    Hope you don't mind me chiming in here!

    So i am getting first pro site level, but it should be free.

    The reason this is happening is because you have a trial set. I've attached a screenshot to illustrate this. The "Free" level is "Level - 0" :slight_smile:

    You can only do the free trials if setup through Pro Sites.

    So, you should be able to upgrade from "level - 0" no problem as it looks like you already have that working properly on WHMCS.

    Hope this helps! Let me know if I'm missing anything here.

    Cheers,
    Tyler

  • Vitaliy

    Hi Jose,
    it very simple:

    <?php
    /*
    Plugin Name: Sitewide functions
    Description: customize behavor of the WP or add some sitewide functions
    Version: 1.0
    Author: Fast Way Web
    Author URI: http://www.fastwayweb.com
    
    */
    
    /*
     * change login url
     * */
    add_filter('site_url',  'wplogin_filter', 10, 3);
    function wplogin_filter( $url, $path, $orig_scheme )
    {
        $old  = array( &quot;/(wp-login\.php)/&quot;);
        $new  = array( &quot;login&quot;);
        return preg_replace( $old, $new, $url, 1);
    }
    
    /*
     * Pro sites plugin override popup admin url
     * */
    apply_filters( &quot;psts_setting_checkout_url&quot;, 'override_checkout_url', 20, 2 );
    function override_checkout_url($url, $default){
        return 'https://www.fastwayweb.com/members/clientarea.php?action=products';
    }

    I tried to find filter hook "psts_setting_checkout_url", but can't find in anywhere in pro sites plugin.
    Where is it used?

    I want to change URLs on admin messages, look at attached files,

  • Jose

    Hey @Vitaliy,

    Sorry about that. I must be running low in caffeine by the moment that I posted the snippet :slight_smile:

    apply_filters should be add_filter

    This is how the code should look:

    function override_checkout_url($url, $default){
        return 'https://www.fastwayweb.com/members/clientarea.php?action=products';
    }
    add_filter( 'psts_setting_checkout_url', 'override_checkout_url', 20, 2 );

    I tried to find filter hook "psts_setting_checkout_url", but can't find in anywhere in pro sites plugin.

    It is built dynamically, that's why you can't find it.
    The filter is declared in the file ../wp-content/plugins/pro-sites/pro-sites.php line 350:

    function get_setting($key, $default = null) {
        $settings = get_site_option( 'psts_settings' );
        $setting = isset($settings[$key]) ? $settings[$key] : $default;
    		return apply_filters( "psts_setting_$key", $setting, $default );
    	}

    Please let me know if it works fine now.

    Keep in mind that all the occurrences of the checkout link are retrieved using this function and therefore all the links will be overriden. You should double check that this doesn't affect any other feature. If that is the case, you might need to add some conditional logic before overriding the value.

    Cheers!
    Jose

  • Vitaliy

    It is works, but at the end of the link the get parameter "?bid=xx" added and i already have get parameters in the link, so i can't get to the page i want to. I need to strip the get parameter(?bid=xx) that pro sites adds to make it work properly. How to do that?

    On another side it will be much better If the blog_id and whmcs_service_id will match.
    On creation of blog via whmcs the whmcs_service_id parameter sent. Is it possible to make pro sites to register blog with the same id as whmcs_service_id parametr?
    here is my link to update product via whmcs:
    upgrade.php?type=package&id=22
    but the blog id, that was created is 15
    If the blog_id and whmcs_service_id will match i will be able to form dynamic link for upgrades, wich will remove one step when upgrading.

    Now i need to go this link:
    clientarea.php?action=products
    then I need to press upgrade button on the product I want to upgrade to get to the upgrade screen.

    Thanks for help Jose.

  • Jose

    Hi Vitaliy,

    I need to strip the get parameter(?bid=xx) that pro sites adds to make it work properly. How to do that?

    Unfortunately, there are no hooks available to achieve this externaly. You would need to hack the core of the plugin. Of course, this change will need to be re-applied after each update.
    You would need to get rid or comment out the following block in the file ../wp-content/plugins/pro-sites/pro-sites.php line 646:

    if ($blog_id)
    	$url .= '?bid=' . $blog_id;

    On creation of blog via whmcs the whmcs_service_id parameter sent. Is it possible to make pro sites to register blog with the same id as whmcs_service_id parametr?

    This wouldn't be a good idea since there might be a collision with an already created blog ID.
    That's why the plugin stores the associated WHMCS information as blog metadata.

    You can get the WHMCS client_id, service_id and product_id by doing the following:

    $whmcs_blog_meta = get_blog_option($blog_id, 'whmcs_settings');
    $client_id = $whmcs_blog_meta['client_id'];
    $service_id = $whmcs_blog_meta['service_id'];
    $product_id = $whmcs_blog_meta['product_id'];

    If i will use multi domains plugin, is it possible to specify which domain to use for new blog via whmcs blog creation?

    It is integrated to work with Domain Mapping plugin out of the box. For Multi Domains it should work straightforward if I recall correctly. Let me know if you find any issue in this regard and I'll take a closer look.

    Cheers!
    Jose

  • Vitaliy

    Thanks Jose, it do the same trick. I have done it with a hammer:slight_smile: and your way is much more intelligent.
    Can you ask developers to include it in next pretty plugins update, so i will not have to worry about it will stop working after upgrade?

    One more challenge:
    Is it possible to use a blog templates plugin with whmcs?
    I want give customers a choice between three site templates to start from.

  • Jose

    I'll try to include it in production version and let you know. :slight_smile:

    Is it possible to use a blog templates plugin with whmcs?

    New Blog Templates integrates with Pro Sites out of the box, but there is no integration using WHMCS. You would need to write a customization for that, and still the result wouldn't be exactly the same (you would lost the templates preview and maybe some other features).

    Considering all your requests, I'm wondering why are you tied to use WHMCS. I think that you could achieve all your request by using just Pro Sites to process your payments and get rid of the WHMCS integration.

    Thoughts?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.