function sf_recent_posts_sidebar($limit=5, $whichforum=0) { global $wpdb, $user_ID; include_once 'wp-content/plugins/simple-forum/forum/sf-page.php'; include_once 'wp-content/plugins/simple-forum/forum/sf-pagecomponents.php'; include_once 'wp-content/plugins/simple-forum/forum/sf-forumcomponents.php'; include_once 'wp-content/plugins/simple-forum/forum/sf-database.php'; get_currentuserinfo(); if ($whichforum > 0) { $whichforum = "AND wp_sfposts.forum_id = $whichforum "; } else { $whichforum = ""; } $peter_query = "SELECT DISTINCT wp_sfposts.topic_id, wp_sfposts.forum_id, wp_sfposts.post_id, wp_sfposts.post_index, wp_sfforums.forum_slug, wp_sftopics.topic_slug FROM wp_sfposts LEFT JOIN wp_sfforums ON wp_sfposts.forum_id = wp_sfforums.forum_id LEFT JOIN wp_sftopics ON wp_sfposts.topic_id = wp_sftopics.topic_id WHERE wp_sfposts.post_id = (SELECT MAX(b.post_id) FROM wp_sfposts as b WHERE wp_sfposts.topic_id = b.topic_id) $whichforum ORDER BY wp_sfposts.post_id DESC LIMIT $limit"; $sfposts = $wpdb->get_results($peter_query); if($sfposts) { //== DISPLAY TOPIC LIST HEADINGS $out = '
'.__("Forum/Topic", "sforum").' | '.__("Last Post", "sforum").' | '.__("Posts", "sforum").' | '."\n"; $out.= ''.sf_get_topic_name($sfpost->topic_slug).' | '; $postcount = sf_get_posts_count_in_topic($sfpost->topic_id); $out.= ''.sf_render_inline_pagelinks($sfpost->forum_slug, $sfpost->topic_slug, $stats[0]['post_index'], 0, '', '', true).''."\n"; # Display last poster $out.= ''."\n";
$poster = sf_filter_user($stats[0]['user_id'], stripslashes($stats[0]['display_name']));
if(empty($poster)) $poster = apply_filters('sf_show_post_name', stripslashes($stats[0]['guest_name']));
$out.= ' '.mysql2date(SFDATES, $stats[0]['post_date'])."-".mysql2date(SFTIMES,$stats[0]['post_date']).' '.__("by", "sforum").' '.$poster.sf_get_post_url($sfpost->forum_slug, $sfpost->topic_slug, $stats[0]['post_id'], $stats[0]['post_index']).' '."\n"; $out.=' | '."\n";
//== DISPLAY POST COUNT IN TOPIC
$out.= ''.$postcount.' | '."\n"; $out.= ''."\n"; } $out.= '
---|