Bad link generated upon Prosite upgrade

In using the Stripe gateway and upgrading a Prosite level from free trial to paid, it shows the following after the payment is successful on a live test:

“Your subscription was successful! You should be receiving an email receipt shortly.

Thank you for your purchase! Your payment was received!

Visit your newly upgraded site »”

Cool, it works… However, the link on “Visit your newly upgraded site »” is a broken link and points to for example:

https://multisite.com/premium/testsite1.multisite.comwp-admin/

As you can see, that link is all messed up, it sticks a malformed version of the admin url and places it behind the address of the ‘checkout’ page.

This is a no-no as it’s the obvious link that points them back to their account to see their upgrades. Does this have anything to do with an https backend? Any suggestions?

Thanks!

  • Vinod Dalvi
    • WP Unicorn

    Hi @carmelo,

    Sorry to hear of the problem you are having.

    I checked the Pro Sites plugin code and found the following code that is generating the link “Visit your newly upgraded site »”

    $content .= '<p><a href="' . get_admin_url( $blog_id, '', 'http' ) . '">' . __( 'Visit your newly upgraded site »', 'psts' ) . '</a></p>';

    There doesn’t seem any wrong with the code but yes it seems it has something to do with the https used in the backend.

    Could you please try using the attached small plugin that will generate the same link “Visit your newly upgraded site »” in the bottom of your site using the following code so that we can troubleshoot and change the code if it’s causing any?

    function check_pro_site_link(){
    $blog_id = get_current_blog_id();
    echo '<p><a href="' . get_admin_url( $blog_id, '', 'http' ) . '">' . __( 'Visit your newly upgraded site »', 'psts' ) . '</a></p>';
    }
    add_action("wp_footer", "check_pro_site_link");

    Also would you mind if I logged in to your site and did some troubleshooting? This might help get to the bottom of this faster. If this is ok, just grant me temporary admin access to your site by clicking “Grant Access” button in the WPMU DEV Dashboard Settings as described on the following page and reply on this thread after granting it?

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Kind Regards,

    Vinod Dalvi

  • Carmelo
    • Site Builder, Child of Zeus

    Your plugin shows the correct link, and doesn’t have any https in the link, which in my case is fine as it gets redirected to https in the admin.

    The script you gave looks nearly identical in function as prosites script line, why doesn’t it show up correctly with prosites after payment?

    I will leave my servers up for another 8 or so hours and I just pushed the grant access button.

  • Carmelo
    • Site Builder, Child of Zeus

    I use a near default one:

    RewriteEngine On

    RewriteBase /

    RewriteRule ^index.php$ – [L]

    #My edits

    RewriteRule ^login$ /wp-login.php [NC,L]

    RewriteRule ^signup$ /wp-signup.php [NC,L]

    # add a trailing slash to /wp-admin

    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]

    RewriteCond %{REQUEST_FILENAME} -d

    RewriteRule ^ – [L]

    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]

    RewriteRule ^(.*.php)$ $1 [L]

    RewriteRule . index.php [L]

  • Carmelo
    • Site Builder, Child of Zeus

    I tried it again earlier today and it showed the incorrect link after a stripe purchase like expected.

    So after turning off all plugins except Prosites, then trying again with stripe purchasing, it started showing the correct link! Then I eventually enabled all my plugins, and now the link is still showing correctly! Good?

    I tried about 5 or 6 times to make it show the incorrect link, but it keeps showing the correct link!

    I spent the last hour trying to figure out what made it keep not showing up correctly, but I can’t figure out.

    It works now, cool, but any ideas why/how this happened? I’d hate for this to happen again while site is live.

    Thanks for your help!

  • Vinod Dalvi
    • WP Unicorn

    Hi @carmelo,

    That’s great news! Glad it’s working fine for you now :slight_smile:

    I am not exactly sure what was causing the issue on your site but it seems it’s the plugin activation priority conflict issue which gets resolved when you can activate Pro Sites plugin first and then other plugins.

    Thanks,

    Vinod Dalvi

  • Ash
    • WordPress Hacker

    Hello @carmelo

    I hope you are well today.

    So does it matter that Prosites is activated first before any other plugins?

    Well, it should not be any matter on activation order of plugins, and to be honest, I never saw any issue like this.

    Maybe one of your other plugin was causing some hiccup and used some sort of caching so the URL was changed, and it’s fixed without leaving any clue!

    If you face the similar issue again, please feel free to let us know.

    Cheers

    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.