Latest forum posts block I would like to see Latest 10 forum posts in a block. Similar to Latest News. Also with choice too limit text length. Thanks
Create a new blocks/ipb_latest.php file with the following content: PHP: <?php if( !defined( "CONTENTTELLER" ) ) { die( "Error" ); } $ipb_latest = ( isset( $datastore[ 'ipb_latest' ] ) ) ? $datastore[ 'ipb_latest' ] : "" ; if( !$ipb_latest ) { global $uwrapper; $ipb_latest = ""; $uwrapper -> bbconnect(); $results = $uwrapper -> bbquery( "SELECT tid, title, forum_id FROM " . $uwrapper -> bbescape( $preferences[ 'website_uwrapper_prefix' ] ) . "topics ORDER BY last_post DESC LIMIT 10" ); if( $uwrapper -> bbrows( $results ) ) { while( list( $threadid, $title, $forum ) = $database -> dbrow( $results ) ) { $length = 22; if ( strlen( $title ) > $length) { $title = substr ( $title, 0, $length ) . "..."; } $ipb_latest .= "· <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/index.php?act=ST&f=" . $forum . "&t=" . $threadid . "\">" . htmlspecialchars( $title ) . "</a><br />"; } } $uwrapper -> bbclose(); $system -> datastoreput( "ipb_latest", $ipb_latest ); } echo $ipb_latest; ?> You may need to adjust this SQL query to exclude private forums: PHP: $results = $uwrapper -> bbquery( "SELECT tid, title, forum_id FROM " . $uwrapper -> bbescape( $preferences[ 'website_uwrapper_prefix' ] ) . "topics ORDER BY last_post DESC LIMIT 10" ); For example, if you like to exclude forum 10 and 15 from the list just change the query to: PHP: $results = $uwrapper -> bbquery( "SELECT tid, title, forum_id FROM " . $uwrapper -> bbescape( $preferences[ 'website_uwrapper_prefix' ] ) . "topics WHERE NOT(forum_id = '10') AND NOT(forum_id = '15') ORDER BY last_post DESC LIMIT 10" );
It works well. I get only one issue. can't restart Windows from DOS instead of can't restart Windows from DOS What can be problem?
This following should work. Change: PHP: $ipb_latest .= "· <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/index.php?act=ST&f=" . $forum . "&t=" . $threadid . "\">" . htmlspecialchars( $title ) . "</a><br />"; to: PHP: $ipb_latest .= "· <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/index.php?act=ST&f=" . $forum . "&t=" . $threadid . "\">" . $title . "</a><br />";
Hi there, could you possibly whip up a similar block for phpbb3 recent articles too please? IPB was nice until they made you start paying for it. I don't want to pay just for a clan website with 30 members.
This should work for phpBB 3: PHP: <?php if( !defined( "CONTENTTELLER" ) ) { die( "Error" ); } $pbb_latest = ( isset( $datastore[ 'pbb_latest' ] ) ) ? $datastore[ 'pbb_latest' ] : "" ; if( !$pbb_latest ) { global $uwrapper; $pbb_latest = ""; $uwrapper -> bbconnect(); $results = $uwrapper -> bbquery( "SELECT topic_id, topic_title, forum_id FROM " . $uwrapper -> bbescape( $preferences[ 'website_uwrapper_prefix' ] ) . "topics WHERE topic_approved = '1' ORDER BY topic_last_post_time DESC LIMIT 10" ); if( $uwrapper -> bbrows( $results ) ) { while( list( $threadid, $title, $forum ) = $database -> dbrow( $results ) ) { $length = 22; if ( strlen( $title ) > $length) { $title = substr ( $title, 0, $length ) . "..."; } $pbb_latest .= "· <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/viewtopic.php?f=" . $forum . "&t=" . $threadid . "\">" . htmlspecialchars( $title ) . "</a><br />"; } } $uwrapper -> bbclose(); $system -> datastoreput( "pbb_latest", $pbb_latest ); } echo $pbb_latest; ?>
for the one for phpbb, could it also display the time of the last post, and who made it, and also the post count? You made one before for storyteller like this
This should work: PHP: $results = $uwrapper -> bbquery( "SELECT topic_id, topic_title, forum_id, topic_last_post_time, topic_last_poster_name, topic_replies FROM " . $uwrapper -> bbescape( $preferences[ 'website_uwrapper_prefix' ] ) . "topics WHERE topic_approved = '1' ORDER BY topic_last_post_time DESC LIMIT 10" ); if( $uwrapper -> bbrows( $results ) ) { while( list( $threadid, $title, $forum, $topic_last_post_time, $topic_last_poster_name, $topic_replies ) = $database -> dbrow( $results ) ) { $length = 22; if ( strlen( $title ) > $length) { $title = substr ( $title, 0, $length ) . "..."; } $pbb_latest .= "· <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/viewtopic.php?f=" . $forum . "&t=" . $threadid . "\">" . htmlspecialchars( $title ) . "</a> (" . htmlspecialchars( $topic_replies ) ." replies)<br />Posted by " . htmlspecialchars( $topic_last_poster_name) . " on: " . date("m/d/y H:i:s", $topic_last_post_time); } }
After upgrade to IPB 3.0.5 ipb latest doesn't work. Here is a code: Code: <?php if( !defined( "CONTENTTELLER" ) ) { die( "Error" ); } $ipb_latest = ( isset( $datastore[ 'ipb_latest' ] ) ) ? $datastore[ 'ipb_latest' ] : "" ; if( !$ipb_latest ) { global $uwrapper; $ipb_latest = ""; $uwrapper -> bbconnect(); $results = $uwrapper -> bbquery( "SELECT tid, title, forum_id FROM " . $uwrapper -> bbescape( $preferences[ 'website_uwrapper_prefix' ] ) . "topics WHERE NOT(forum_id = '83') AND NOT (forum_id = '51') AND NOT (forum_id = '79') ORDER BY last_post DESC LIMIT 5" ); if( $uwrapper -> bbrows( $results ) ) { while( list( $threadid, $title, $forum ) = $database -> dbrow( $results ) ) { $length = 23; if ( strlen( $title ) > $length) { $title = substr ( $title, 0, $length ) . "..."; } $ipb_latest .= "<li><a href=\"" . $preferences['website_uwrapper_forumpath'] . "/index.php?act=ST&f=" . $forum . "&t=" . $threadid . "\">" . $title . "</a></li>"; } } $uwrapper -> bbclose(); $system -> datastoreput( "ipb_latest", $ipb_latest ); } echo $ipb_latest; ?>
The following modification should work for IPB 3.0.5: PHP: $results = $uwrapper -> bbquery( "SELECT tid, title, forum_id, title_seo FROM " . $uwrapper -> bbescape( $preferences[ 'website_uwrapper_prefix' ] ) . "topics WHERE NOT(forum_id = '83') AND NOT (forum_id = '51') AND NOT (forum_id = '79') ORDER BY last_post DESC LIMIT 5" ); if( $uwrapper -> bbrows( $results ) ) { while( list( $threadid, $title, $forum, $title_seo ) = $database -> dbrow( $results ) ) { $length = 23; if ( strlen( $title ) > $length) { $title = substr ( $title, 0, $length ) . "..."; } $ipb_latest .= "<li><a href=\"" . $preferences['website_uwrapper_forumpath'] . "/topic/" . $threadid . "-" . $title_seo . "\">" . $title . "</a></li>"; } }
This should work: PHP: $ipb_latest .= "<li><a href=\"" . $preferences['website_uwrapper_forumpath'] . "/topic/" . $threadid . "-" . $title_seo . "/page__view__getnewpost\">" . $title . "</a></li>";
Thanks. This one works. Now I only need to fix this cookie issue with CT. http://community.contentteller.com/f6/338_cookies_issue,4.html
IPB 3.1.3 - Latest Forum Posts doesn't work after upgrade. Code: <?php if( !defined( "CONTENTTELLER" ) ) { die( "Error" ); } $ipb_latest = ( isset( $datastore[ 'ipb_latest' ] ) ) ? $datastore[ 'ipb_latest' ] : "" ; if( !$ipb_latest ) { global $uwrapper; $ipb_latest = ""; $uwrapper -> bbconnect(); $results = $uwrapper -> bbquery( "SELECT tid, title, forum_id, title_seo FROM " . $uwrapper -> bbescape( $preferences[ 'website_uwrapper_prefix' ] ) . "topics WHERE NOT(forum_id = '83') AND NOT (forum_id = '51') AND NOT (forum_id = '79') ORDER BY last_post DESC LIMIT 5" ); if( $uwrapper -> bbrows( $results ) ) { while( list( $threadid, $title, $forum, $title_seo ) = $database -> dbrow( $results ) ) { $length = 23; if ( strlen( $title ) > $length) { $title = substr ( $title, 0, $length ) . "..."; } $ipb_latest .= "<li><a href=\"" . $preferences['website_uwrapper_forumpath'] . "/topic/" . $threadid . "-" . $title_seo . "/page__view__getnewpost\">" . $title . "</a></li>"; } } $uwrapper -> bbclose(); $system -> datastoreput( "ipb_latest", $ipb_latest ); } echo $ipb_latest; ?>
You need to remove the / after board from your forum path (e.g. yourdomain.tld/board/ to yourdomain.tld/board)