This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Latest forum posts block


avatar
error 232
From: -
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

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Latest forum posts block
avatar
Editor
0
From: -
You need to remove the / after board from your forum path (e.g. yourdomain.tld/board/ to yourdomain.tld/board)
1 Re: Latest forum posts block
avatar
OP 232
From: -
IPB 3.1.3 - Latest Forum Posts doesn't work after upgrade.

<?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;

?>
1 Re: Latest forum posts block
avatar
Editor
0
From: -
This should work:

$ipb_latest .= "<li><a href=\"" . $preferences['website_uwrapper_forumpath'] . "/topic/" . $threadid . "-" . $title_seo . "/page__view__getnewpost\">" . $title . "</a></li>";
1 Re: Latest forum posts block
avatar
OP 232
From: -
It works but not goes to last post instead goes to first post in topic. Thanks.
1 Re: Latest forum posts block
avatar
Editor
0
From: -
The following modification should work for IPB 3.0.5:

    $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>";
}
}
1 Re: Latest forum posts block
avatar
OP 232
From: -
After upgrade to IPB 3.0.5 ipb latest doesn't work. Here is a 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&amp;f=" . $forum . "&amp;t=" . $threadid . "\">" . $title . "</a></li>";



}
}
$uwrapper -> bbclose();
$system -> datastoreput( "ipb_latest", $ipb_latest );
}

echo $ipb_latest;

?>
1 Re: Latest forum posts block
avatar
Editor
0
From: -
for the one for phpbb, could it also display the time of the last post, and who made it, and also the post count?


This should work:

    $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 .= "&middot; <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/viewtopic.php?f=" . $forum . "&amp;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);

}
}
1 Re: Latest forum posts block
avatar
17
From: -
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 Smiling Face
1 Re: Latest forum posts block
avatar
19
From: -
There is is a block available for SMF ?

Thank You,
1 Re: Latest forum posts block
avatar
Editor
0
From: -
This should work for phpBB 3:

<?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 .= "&middot; <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/viewtopic.php?f=" . $forum . "&amp;t=" . $threadid . "\">" . htmlspecialchars( $title ) . "</a><br />";

}
}
$uwrapper -> bbclose();
$system -> datastoreput( "pbb_latest", $pbb_latest );
}

echo $pbb_latest;

?>
1 Re: Latest forum posts block
avatar
4
From: -
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.
1 Re: Latest forum posts block
avatar
Editor
0
From: -
This following should work. Change:

            $ipb_latest .= "&middot; <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/index.php?act=ST&amp;f=" . $forum . "&amp;t=" . $threadid . "\">" . htmlspecialchars( $title ) . "</a><br />";


to:

            $ipb_latest .= "&middot; <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/index.php?act=ST&amp;f=" . $forum . "&amp;t=" . $threadid . "\">" . $title . "</a><br />";
1 Re: Latest forum posts block
avatar
OP 232
From: -
can& # 3 9 ;t restart Windows from DOS


You see now?

It shows & # 3 9 ;

instead of '
1 Re: Latest forum posts block
avatar
Editor
0
From: -
can't restart Windows from DOS

instead of

can't restart Windows from DOS

I don't see a difference Confused Face
1 Re: Latest forum posts block
avatar
OP 232
From: -
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?
1 Re: Latest forum posts block
avatar
Editor
0
From: -
Create a new blocks/ipb_latest.php file with the following content:

<?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 .= "&middot; <a href=\"" . $preferences['website_uwrapper_forumpath'] . "/index.php?act=ST&amp;f=" . $forum . "&amp;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:

$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:

$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" );

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.