Pro Sites how to display level name

Is there any workaround to display which Pro sites levels are selected, for pro lever user, who's trying to upgrade to different pro level site.

For example, once an user has registered via pro sites. And then go to the check out page, /pro-site, and if a new pro site level is selected, would like to display the selected pro site level, with the following text:
You are upgrading site: {site name}

  • Nithin
    • Support Wizard

    Hello Iker,

    Hope you are doing good today. :slight_smile:

    I'm checking this with the developer to see whether there is any quick way to make this work via the Pro Sites plugin side. Will keep you posted regarding this once I get a feedback from our developer asap.

    Kind Regards,
    Nithin

  • Iker
    • SYMPTOM OF THE UNIVERSE

    I logged to the site you created and it is showing the name of the subsite being upgraded, I haven't been able to replicate this with the subsites I created.

    Did you use the admin "New Site" for creating the subsite?

  • Iker
    • SYMPTOM OF THE UNIVERSE

    The Subsite name wont show on other sites because they didn't get the "Free Plan" saved, the problem is not the upgrade page not showing the subsite name, but the checkout page not setting the "Free Plan" for newly created subsites.

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Iker !

    The 'Free Plans' are not registered via Pro-Sites, they act as normal blogs within a Multisite, this is the reason why the title + url is not showing when you're trying to upgrade to a Pro Site.

    We'll make sure to include an update for this, so the title + url will be available to Free Plans as well in the future release. In the meantime I can fix this on your installation so you don't have to wait for the update as well.

    If you'd like that, you can send the information needed privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question by following this example:

    Subject: "Attn: Konstantinos Xenos"
    
    - Admin login ( if Multisite please provide Super Admin details ):
    Admin Username:
    Admin Password:
    Login URL: 
    
    - FTP credentials
    Hostname:
    Username:
    Password:
    Port: 
    
    - Link back to this thread for reference
    - Any other relevant URLs -or- information regarding the issue that was not included in this thread

    Regards,
    Konstantinos

  • Iker
    • SYMPTOM OF THE UNIVERSE

    Hey Konstantinos Xenos thanks for the mod! the site being Upgraded is showing now.

    Will you please point me into the files you are editing? I would like to mod it further since I still need to display the "Current Plan" info. Is there any documentation for this files so I know what does every variable does?.

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Iker ,

    Where exactly would you like to show the current plan? Along with the title or inside the main content? The areas vary and the filters / ways of achieving this would be different or might need some custom coding as well, that's why I'm asking.

    As far as the title changes for example that would be within wp-content\plugins\pro-sites\pro-sites.php Line 2492 .

    You'll find a commented out section that checks if ( empty( $is_site ) ) {} so if you want to display the current / free plan we could utilize that part of the code as well again.

    Regards,
    Konstantinos

  • Iker
    • SYMPTOM OF THE UNIVERSE

    I want to replicate the same layout that shows when a plan is enabled for a subsite (not a free site) (aka when plan is being upgraded).

    Currently with your help it shows the name of the subsite we are upgrading

    Also, I found a problem when showing quota on "media" when on a subsite, the system offers an upgrade to the supposedly next level, but it's the "$0 Plan" made for emulating the "Free Plan"

    When I refer to "$0 Plan" I'm talking about the plan made so we can substitute the "Free Plan" link and make it look like the other plans on the "Pricing Table".
    ( https://premium.wpmudev.org/forums/topic/how-do-you-show-a-free-pricing-table-like-on-edublog )
    [image pos="0"]

    Is it possible to instead of making these mods, to make the "$0 Plan" Work as the Free Plan ??

    Thanks for you help Konstantinos Xenos

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Iker , I think I have a clear view of what you're trying to achieve from the screenshots so thank you!

    Let me say a couple of things first before diving into the code. As mentioned before a 'free plan' is not registered through Pro Sites it acts like a normal everyday site registered in a MultiSite, also a 0$ plan if 'billed' it would probably create various issues ( either logisticaly or if via PayPal / Stripe etc ), that's why the Free Plan comes into play, to avoid unwanted situations. This is why in the workaround post your read the button is hidden and replaced by the free-plan button as well to avoid the 0.00$ billing situation.

    Since the 'Free Plan' isn't considered a Pro-Sites Plan you'll have to add the 'above' information that you want yourself as there's no plan to actually read from. This can be done with this code:

    function ps_mark_free_plan( $content, $blog_id, $style ) {
    
    	/****** EDIT THIS TO ADD CUSTOM HTML BEFORE THE PRICING TABLE ******/
    	$html_before = '
    	<div id="psts_existing_info">
    		<h2>Your current plan</h2>
    		<ul class="psts-info-list">
    			<li class="psts-level">Level: <strong>Free</strong></li>
    		</ul>
    	</div>';
    	/************************** STOP EDITING  **************************/
    
    	$is_site        = ProSites_Helper_ProSite::get_site( $blog_id );
    	$css_fix_script = '<script>(function($){$(document).ready(function(){$(\'.pricing-column.psts-level-1\').addClass(\'chosen-plan\');});})(jQuery)</script>';
    
    	if ( ! empty( $blog_id ) && empty( $is_site ) && is_user_logged_in() ) {
    		$newcontent = $html_before . $content . $css_fix_script;
    		$content    = $newcontent;
    	}
    
    	return $content;
    }
    add_filter( 'psts_checkout_after_free', 'ps_mark_free_plan', 10, 3 );

    If you place this into your functions.php ( preferably your child themes ) you will have to change the HTML inside the $html_before variable. This will be shown 'above' your pricing table and the '0$ Plan' will automatically be highlighted for you if you are actually on a Free Plan.

    One notice: I'm not sure what you have done with the Free ( 0$ Plan ) buttons from the other post exactly but be careful when being in the 'upgrade' page to again hide the 0$ plan one to avoid any billing mistake.

    I'm attaching a screenshot from my tests so you can see the result.

    Give this a try ( please keep a backup before editing any code ) and tell me if this works for you!

    Regards,
    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.