Pro Sites - Get subscription status

Hello
I am wondering how I can get the subscription status of a pro site. I want to be able to restrict the json api based on a users subscription.

    Luís

    Hi Greg ,

    Hope you're doing well today!

    Unfortunately, we don't have any documentation about the API of Pro sites. I think it would be a great feature, so, I've just moved this over to our Features and Feedback section, so it can be taken into consideration.

    However, if you are having doubts/difficulties, can you give us more information about what you want to check (i.e. the status like "expired", "active", trial, or a Pro Site level) and I can ping the developer or our SLS team (our code experts ) to provide more informations and "use cases".

    Cheers, Luís

    Panos

    Hi Greg ,

    Not sure what you need to achieve, but if you want to check if blog is pro site, you can use the function that my colleague Jude mentioned in his reply. Here is an example:

    global $psts;
    $blog_id = 204;
    $is_pro_site = $psts->is_pro_site( $blog_id );

    I have included some basic functions in the following snippet which contain how to get the level of a blog, how to get expiration date and how to check if is pro site:

    function ps_blog_status_sh( $atts ){
    	global $psts;
    
    	$blog_id = isset( $atts['blog_id'] ) && is_numeric( $atts['blog_id'] ) ? $atts['blog_id'] : get_current_blog_id();
    
    	$levels 		= (array) get_site_option( 'psts_levels' );
    	$blog_level_id 	= $psts->get_level( $blog_id );
    	$blog_level 	= $levels[ $blog_level_id ]['name'];
    	$expire 		= $psts->get_expire( $blog_id );
    	$date_format 	= get_option( 'date_format' );
    	$expire_date 	= date( $date_format, $expire );
    	$is_pro_site 	= $psts->is_pro_site( $blog_id ) ? 'YES' : 'NO';
    
    	if ( $expire > 2147483647 ) $expire_date = 'Never';
    
    	ob_start();
    	?>
    
    	<div>
    		Blog <strong>#<?php echo $blog_id; ?></strong> level : <strong><?php echo $blog_level; ?></strong>
    	</div>
    	<div>
    		<?php if ( $expire && $expire <= time() ):?>
    		Expired
    		<?php else: ?>
    		Expire date: <strong><?php echo $expire_date; ?></strong>
    		<?php endif; ?>
    	</div>
    	<div>
    	Is blog pro site: <strong><?php echo $is_pro_site; ?></strong>
    	</div>
    
    	<?php
    	return ob_get_clean();
    
    }
    
    add_shortcode( 'ps_blog_status', 'ps_blog_status_sh' );

    You can check the outputs in any page by using the following shortcode:
    [ps_blog_status blog_id="48"]

    Hope this helps you on your work Please let me know if you need any other function that is not included in the snippet above.

    Thanks!
    Panos