pmpro_db_widget

Widget with latest news from PaidMembershipsPro.com for dashbaord.

Description

pmpro_db_widget(); 

Usage

  1. if ( !function_exists( 'pmpro_db_widget' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/adminpages/dashboard.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_db_widget(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/adminpages/dashboard.php  
  1. function pmpro_db_widget() 
  2. global $pmpro_feed; 
  3.  
  4. $options = get_option('pmpro_pmprodbwidget'); 
  5.  
  6. $network = ''; 
  7. if ( function_exists('is_network_admin') && is_network_admin() ) 
  8. $network = '_network'; 
  9.  
  10. if (isset($_POST['pmpro_removedbwidget'])) { 
  11. $options['removedbwidget'.$network] = true; 
  12. update_option('pmpro_pmprodbwidget', $options); 
  13. if ( isset($options['removedbwidget'.$network]) && $options['removedbwidget'.$network] ) { 
  14. echo "If you reload, this widget will be gone and never appear again, unless you decide to delete the database option 'pmpro_pmprodbwidget'."; 
  15. return; 
  16.  
  17. $rss_items = pmpro_fetch_rss_items( 3 ); 
  18.  
  19. echo "<ul>"; 
  20.  
  21. if ( !$rss_items ) { 
  22. echo '<li class="pmpro_news">no news items, feed might be broken...</li>'; 
  23. } else { 
  24. foreach ( $rss_items as $item ) { 
  25. echo '<li class="pmpro_news">'; 
  26. echo '<a class="rsswidget" href="'.esc_url( $item->get_permalink(), $protocolls=null, 'display' ).'">'. esc_html( $item->get_title() ) .'</a>'; 
  27. echo ' <span class="rss-date">'. $item->get_date(get_option('date_format')) .'</span>'; 
  28. echo '<div class="rssSummary">'. esc_html( pmpro_text_limit( strip_tags( $item->get_description() ), 150 ) ).'</div>'; 
  29. echo '</li>'; 
  30.  
  31. echo '</ul>'; 
  32. echo '<br class="clear"/><div style="margin-top:10px;border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">'; 
  33. echo '<a target="_blank" href="'.$pmpro_feed.'"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>'; 
  34. echo '       '; 
  35. echo '<a target="_blank" href="http://www.paidmembershipspro.com/blog/">View Online</a>'; 
  36. echo '<form class="alignright" method="post"><input type="hidden" name="pmpro_removedbwidget" value="true"/><input title="Remove this widget from all users dashboards" class="button" type="submit" value="X"/></form>'; 
  37. echo '</div>';