Are there Shortcodes for Pro Site?

Hi,

just wondered if there are any shortcodes for Pro Sites? Integration to my site would be much more easy if I could use a shortcode.

Regards

Benny

  • Creatura

    I was searching for the same, and there is a thread in here somewhere regarding this issue, anyways, they provided a code in that thread, and it can easy be used as a shortcode, just add this to a php file, place it the mu-plugins folder, and then you can use the shortcode: [subscriptioninfo] and it will display the subscription info for the current logged in user. It will also add a widget on the dashboard with the info.

    <?php 
    
    /*
    Plugin Name: YourSubscriptionInfo
    */
    
    defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    
    add_action( 'wp_dashboard_setup', 'register_wpmu_psi_dashboard_widget' );
    
    function register_wpmu_psi_dashboard_widget() {
    wp_add_dashboard_widget(
    'wpmu_psi_dashboard_widget',
    'Your Subscription',
    'wpmu_psi_dashboard_widget_display'
    );
    }
    function wpmu_psi_dashboard_widget_display() {
    global $psts, $wpdb, $current_site, $blog_id;
      		$levels = (array)get_site_option('psts_levels');
      		$current_level = $psts->get_level($blog_id);
          $expire = $psts->get_expire($blog_id);
          $result = $wpdb->get_row("SELECT * FROM {$wpdb->base_prefix}pro_sites WHERE blog_ID = '$blog_id'");
          if ($result) {
    				if ($result->term == 1 || $result->term == 3 || $result->term == 12)
    	        $term = sprintf(__('Every %s. month', 'psts'), $result->term);
    	      else
    	        $term = $result->term;
    			} else {
    				$term = 0;
    			}
    
          if ($expire && $expire > time()) {
            echo '<p><strong>'.__('Current Pro Site', 'psts').'</strong></p>';
    
            echo '<ul>';
    				if ($expire > 2147483647)
    					echo '<li>'.__('Expires: <strong>Aldri</strong>', 'psts').'</li>';
    				else
            	echo '<li>'.sprintf(__('Expires: <strong>%s</strong>', 'psts'), date(get_option('date_format'), $expire)).'</li>';
    
            echo '<li>'.sprintf(__('Subscription: <strong>%s</strong>', 'psts'), $current_level . ' - ' . @$levels[$current_level]['name']).'</li>';
            if ($result->gateway)
    					echo '<li>'.sprintf(__('Payment Gateway: <strong>%s</strong>', 'psts'), $result->gateway).'</li>';
            if ($term)
            	echo '<li>'.sprintf(__('Payment Term: <strong>%s</strong>', 'psts'), $term).'</li>';
            echo '</ul>';
    
          } else if ($expire && $expire <= time()) {
            echo '<p><strong>'.__('Expired Pro Site', 'psts').'</strong></p>';
    
            echo '<ul>';
            echo '<li>'.sprintf(__('Pro Site priviledges expired on: <strong>%s</strong>', 'psts'), date(get_option('date_format'), $expire)).'</li>';
    
            echo '<li>'.sprintf(__('Previous Level: <strong>%s</strong>', 'psts'), $current_level . ' - ' . @$levels[$current_level]['name']).'</li>';
            if ($result->gateway)
    					echo '<li>'.sprintf(__('Previous Payment Gateway: <strong>%s</strong>', 'psts'), $result->gateway).'</li>';
            if ($term)
    					echo '<li>'.sprintf(__('Previous Payment Term: <strong>%s</strong>', 'psts'), $term).'</li>';
            echo '</ul>';
    
          } else {
            echo '<p><strong>"'.get_blog_option($blog_id, 'blogname').'" '.__('has never been a Pro Sites blog.', 'psts').'</strong></p>';
    		}
    }
    add_shortcode('subscriptioninfo', 'wpmu_psi_dashboard_widget_display');
  • Rupok

    Hi Creatura

    I hope you had a wonderful day.

    Thanks for sharing the code block. Yes, generates a custom shortcode and shows the subscription info. Please note, this is a custom hack and it isn't shipped with the plugin.

    So if you have any custom requirement for shortcode, please let us know. If it requires simple coding, we can help. If it requires mid-level coding, we can call for SLS (Second Level Support) team for help but in that case, it will take a little while.

    Have a nice day. Cheers!
    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.