Showing Pro-Sites information on users dashboard!?

Hey all,

I have been testing out the new Pro-Sites 3.0 BETA 6.

All looks GREAT!! Just what I have been after for some time and I can finally work towards getting my site up and running with this functionality now, so THANK YOU!

One thing I would like to be able to do, and I'm sure its probably simple enough for you guys.

Basically in the network admin when you view a supporters information page (settings.php?page=psts&bid=14), it shows all of the supporter info at the top:

Modify Site : test (Site ID: 14)

Current Pro Site

Pro Site priviledges will expire on: 9 September 2011
Level: 1 - Full access
Payment Gateway: Trial
Payment Term: Manual

This is great info to know, but is it possible for me to show this on each users dashboard? I have the dashboard widget plugin installed, and I have tried copying the code from the Pro-Sites plugin, but it doesnt work.

If I could get this showing, so that my users know their status each time they log in, it would be much apreciated

Thanks in advance!

  • DavidM

    Hi ffdltd,

    Cool idea! Perhaps trying this slightly edited version will work for ya in the custom dashboard widget:

    <?php
    
    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(__('%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>'.__('Pro Site priviledges will expire: <strong>Never</strong>', 'psts').'</li>';
    				else
            	echo '<li>'.sprintf(__('Pro Site priviledges will expire on: <strong>%s</strong>', 'psts'), date(get_option('date_format'), $expire)).'</li>';
    
            echo '<li>'.sprintf(__('Level: <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>';
    		}
    ?>

    Apart from the custom dashboard widget, you could also create your own dashboard widget using the code in the following:
    http://wp-snippets.com/82/add-a-dashboard-widget/

    Hope that helps!

    -David