custom checkout url using prosites and pretty plugins

The checkout url for Prosite was changed to point to WHMCS in mu-plugin. However, it seems the url does not work for some sites - newly created accounts and old ones .

code used:

function override_checkout_url($url, $default){
return 'http://domainurlused/clientarea.php?action=products';
}
add_filter( 'psts_setting_checkout_url', 'override_checkout_url', 20, 2 );

For example, the account created by wpmudev has "your account" pointing to the prosite page even though I have updated the checkout url. It appears I might have gotten it right at some point because a few blogs redirect well.

To allow pretty plugin use the checkout link specified in my mu-plugin, I read from https://premium.wpmudev.org/forums/topic/using-pro-sites-and-whmcs-provisioning-usage-with-free-level-and-upgrade-links that section between lines 636 and 645 should be edited.
I would love it if the clean copy of the code to used can be provided as I appear not to be getting the desired results.

edited copy
--------------------------------------
if(!$plugin_prepare['isAvailable']) {
$plugin_prepare['ActionLinkText'] = sprintf( __('Upgrade to %s!', 'wmd_prettyplugins'), $this->prosite_plugin_required_level_name($plugin_path));
//$checkout_url = isset($this->pro_site_settings['checkout_url']) ? $this->pro_site_settings['checkout_url'] : '';
//if(apply_filters('psts_force_ssl', false))
//$checkout_url = str_replace('http://', 'https://', $checkout_url);
global $psts;
if( $psts && method_exists( $psts, 'checkout_url' )){
$checkout_url = $psts->checkout_url( $this->blog_id );
} else {
$checkout_url = isset($this->pro_site_settings['checkout_url']) ? $this->pro_site_settings['checkout_url'] : '';
if(apply_filters('psts_force_ssl', false))
$checkout_url = str_replace('http://', 'https://', $checkout_url);
$checkout_url = add_query_arg('bid', $this->blog_id, $checkout_url);
}
// $checkout_url_orginal = add_query_arg(array('bid' => $this->blog_id), $checkout_url);
//$checkout_url = add_query_arg(apply_filters('prettyplugins_checkout_args', array('bid' => $this->blog_id), $plugin_prepare), $checkout_url);
$plugin_prepare['ActionLink'] = $checkout_url;
$plugin_prepare['ActionLinkClass'] = 'upgrade';
}
------------------------------------------------------------------------------

Some sites still point to the prosite account page e.g When "your account" is clicked on.

How can the checkout url be changed for all accounts?

  • kate

    The thing is I have carried out several tests and made several changes since the first time it worked.

    Hence, I would prefer WPMUDev recommend what to do. That way, I would be sure that I am making the right changes, and it should hopefully reduce the time spent on fixing the issue.

    Thanks.
    ------------------------
    To allow pretty plugin use the custom checkout link specified in my mu-plugin, I read from https://premium.wpmudev.org/forums/topic/using-pro-sites-and-whmcs-provisioning-usage-with-free-level-and-upgrade-links that section between lines 636 and 645 should be edited.
    I would love it if the clean copy of the code to used can be provided as I appear not to be getting the desired results.
    --------------------

  • Rupok

    Hi kate

    I hope you had a wonderful day.

    If I understood your query properly, then there are two parts. First, you changed your checkout URL with the following code:

    function override_checkout_url($url, $default){
    return 'http://domainurlused/clientarea.php?action=products';
    }
    add_filter( 'psts_setting_checkout_url', 'override_checkout_url', 20, 2 );

    Is it working properly? As you said "the account created by wpmudev has "your account" pointing to the prosite page even though I have updated the checkout url", do you find the issue with any other account? Can you please give us the link of a page where the custom checkout URL is working and the link of a page where it isn't working?

    Secondly, as you said "To allow pretty plugin use the checkout link specified in my mu-plugin", I'm assuming you are confirmed that the code block in the first part works 100% perfect and that's why you are editing code for other plugins to use the custom checkout URL prepared by the first portion. If you are not sure if the first code block for making custom checkout URL works, how can you be sure your second thing (making custom checkout URL working with Pretty Plugins) will work? The code of your second portion may be perfect, but the result could not be as expected due to fault of the code in the first portion.

    Now considering the first code block works, the cleaner version found in the thread you mentioned will be the following:

    global $psts;
    if( $psts && method_exists( $psts, 'checkout_url' )){
    	$checkout_url = $psts->checkout_url( $this->blog_id );
    } else {
    	$checkout_url = isset($this->pro_site_settings['checkout_url']) ? $this->pro_site_settings['checkout_url'] : '';
    	if(apply_filters('psts_force_ssl', false))
    		$checkout_url = str_replace('http://', 'https://', $checkout_url);
    	$checkout_url = add_query_arg('bid', $this->blog_id, $checkout_url);
    }

    And if you want me to strip off the comments from your given code block, the cleaner code will be the following:

    <?php
    if(!$plugin_prepare['isAvailable']) {
    	$plugin_prepare['ActionLinkText'] = sprintf( __('Upgrade to %s!', 'wmd_prettyplugins'), $this->prosite_plugin_required_level_name($plugin_path));
    	global $psts;
    	if( $psts && method_exists( $psts, 'checkout_url' )){
    		$checkout_url = $psts->checkout_url( $this->blog_id );
    	} else {
    		$checkout_url = isset($this->pro_site_settings['checkout_url']) ? $this->pro_site_settings['checkout_url'] : '';
    		if(apply_filters('psts_force_ssl', false))
    			$checkout_url = str_replace('http://', 'https://', $checkout_url);
    		$checkout_url = add_query_arg('bid', $this->blog_id, $checkout_url);
    	}
    	$plugin_prepare['ActionLink'] = $checkout_url;
    	$plugin_prepare['ActionLinkClass'] = 'upgrade';
    }

    Please let us know if you have any further query. We will be glad to help.

    Have a nice day. Cheers!
    Rupok

  • kate

    Hi, thanks for your response. I would prefer to give you blog ids to test the urls for pretty plugins page and Your Account.
    blog id 14 and 15 works. To test it, kindly reset the password for "blog id= 14" and log in using the username and password.
    blog id 21 and every other new account created do not redirect properly. I have made some changes since the time I first created blog id 14, 15, and 16. Hence, I might not be able to state what caused the change. Those accounts were provisioned using local installs of whmcs and wordpress.

    thanks

  • kate

    hi,

    I am sure my code works because when I removed the mu-plugin, blogs with id 14-16 behaved just like the rest. however, when the code was added back, the urls pointed to the expected new checkout location.
    Does wp/ wpmudev plugins hardcode the information (checkout url) in the database?

    Access has been granted to Support. please I would appreciate a speedy close to this issue. thanks.

  • Rupok

    Hi kate

    I hope you had a wonderful day and Merry Christmas.

    I do apologize for the delayed response but I'm willing to solve it as soon as possible.

    So far what I got is, blog id 14, 15, and 16 is redirecting to your custom URL properly, and other sites are not. You also said you made some changes after creating those 3 blogs, and now previous blogs redirects properly and new blogs are not? Please correct me if I missed something.

    So for testing, I tried to login with Support Access but it seems like Support Access is expired. Would you mind allowing support access once again so we can have a closer look at this?

    To enable support access you can follow this guide here:
    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Have a nice day. Cheers!
    Rupok

  • Rupok

    Hi kate

    I hope you had a wonderful day.

    Now I understand. So the custom code you are using, is not updating the custom checkout URLs created via WHMCS or from Dashboard. But I'm not a developer, so I'm afraid, I might not be able to give you the code that will also make the sites created with WHMCS or Backend use your customized checkout URL.

    So I'm calling our SLS (Second Level Support) for giving you a working code. Please keep in mind, our SLS team has to deal with lots of critical things. So it may take a little while for them work on this and give you the working code.

    Please let us know if you have any further confusion. We will be glad to help.

    Have a nice day. Cheers!
    Rupok

  • Panos

    Hello kate ,

    I see it's been a while, sincere apologies for such a delay, and I don't know if you have resolved this issue or not.

    In case you are still having it I would love to help out :slight_smile:

    It would be really helpful if you could also provide admin and ftp access so we can better understand what is causing this behaviour.

    You can send that privately through our contact form: https://premium.wpmudev.org/contact/

    Select "I have a different question?" for your topic - this and the subject line ensure that it gets assigned to me.

    Send in:Subject: "Attn: Panos Lyrakis"
    - WordPress admin username
    - WordPress admin password
    - login url
    - FTP credentials (host/username/password)
    - link back to this thread for reference : https://premium.wpmudev.org/forums/topic/custom-checkout-url-using-prosites-and-pretty-plugins
    - any other relevant urls

    Looking forward to your reply!

    Kind regards,
    Panos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.