{REQUEST} - Topics Anywhere for phpBB 3.x.

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Get Involved
midwestbonsai
Registered User
Posts: 177
Joined: Sat May 28, 2005 12:48 am
Location: Wisconsin USA
Contact:

Re: [REQUEST] Recent Posts on Home Page

Post by midwestbonsai »

Also johnnyvang any way to get it to show

Title of latest post
Last post by user, date post was made
User avatar
IoanFilipov
Translator
Posts: 40
Joined: Wed May 02, 2007 7:40 pm

Re: [REQUEST] Recent Posts on Home Page

Post by IoanFilipov »

midwestbonsai wrote: @IoanFilipov

This did not work for me at all, nothing but errors.

Thanks
Check the prefix, in my example is phpbb333_.
midwestbonsai
Registered User
Posts: 177
Joined: Sat May 28, 2005 12:48 am
Location: Wisconsin USA
Contact:

Re: [REQUEST] Recent Posts on Home Page

Post by midwestbonsai »

IoanFilipov wrote:
midwestbonsai wrote: @IoanFilipov

This did not work for me at all, nothing but errors.

Thanks
Check the prefix, in my example is phpbb333_.
Perfect!
Is there a way to get the date of the last post?
Thanks
User avatar
IoanFilipov
Translator
Posts: 40
Joined: Wed May 02, 2007 7:40 pm

Re: [REQUEST] Recent Posts on Home Page

Post by IoanFilipov »

midwestbonsai wrote:
IoanFilipov wrote:
midwestbonsai wrote: @IoanFilipov

This did not work for me at all, nothing but errors.

Thanks
Check the prefix, in my example is phpbb333_.
Perfect!
Is there a way to get the date of the last post?
Thanks
Yes, after

Code: Select all

while ($row=mysql_fetch_array($result)) {
extract($row);
add

Code: Select all

$date = date("d.m.Y", $topic_last_post_time );
find inline

Code: Select all

, topic last poster: ".$topic_last_poster_name."
add after

Code: Select all

, topic last post time: ".$date."
midwestbonsai
Registered User
Posts: 177
Joined: Sat May 28, 2005 12:48 am
Location: Wisconsin USA
Contact:

Re: [REQUEST] Recent Posts on Home Page

Post by midwestbonsai »

Something is not right, thisis what shows up
31.12.1969

When I would like it to look like it does in the forum (besides it being the wrong date, and the date is right in the forum).

Tue Jun 05, 2007 10:27 pm
User avatar
IoanFilipov
Translator
Posts: 40
Joined: Wed May 02, 2007 7:40 pm

Re: [REQUEST] Recent Posts on Home Page

Post by IoanFilipov »

Replace old $date line with this

Code: Select all

$date = date("F j, Y, g:i a", $topic_last_post_time );
midwestbonsai
Registered User
Posts: 177
Joined: Sat May 28, 2005 12:48 am
Location: Wisconsin USA
Contact:

Re: [REQUEST] Recent Posts on Home Page

Post by midwestbonsai »

Any thoughts as to why it is saying all of the dates are December 31, 1969, 6:00 pm
when they are right within the forum?

Thanks for the help.
starry-eyed
Registered User
Posts: 9
Joined: Sun May 27, 2007 3:55 am

Re: [REQUEST] Recent Posts on Home Page

Post by starry-eyed »

@IoanFilipov

Great code to display topics.

Could you add a code where we can specify which forums to display? Some of our forums are private in nature where topics herein we don't want to display in the home page.

Thanks.
midwestbonsai
Registered User
Posts: 177
Joined: Sat May 28, 2005 12:48 am
Location: Wisconsin USA
Contact:

Re: [REQUEST] Recent Posts on Home Page

Post by midwestbonsai »

starry-eyed wrote:@IoanFilipov

Great code to display topics.

Could you add a code where we can specify which forums to display? Some of our forums are private in nature where topics herein we don't want to display in the home page.

Thanks.
Good point! Or only display the public forums?
GhostPool
Registered User
Posts: 20
Joined: Wed Feb 01, 2006 9:14 am
Contact:

Re: [REQUEST] Recent Posts on Home Page

Post by GhostPool »

In addition to excluding certain boards, could you see about making the links go to the latest post rather than the first page of a topic IoanFilipov. I've tried to implement the post_id tag myself but I've been unsuccessful.
User avatar
IoanFilipov
Translator
Posts: 40
Joined: Wed May 02, 2007 7:40 pm

Re: [REQUEST] Recent Posts on Home Page

Post by IoanFilipov »

starry-eyed wrote:@IoanFilipov

Great code to display topics.

Could you add a code where we can specify which forums to display? Some of our forums are private in nature where topics herein we don't want to display in the home page.

Thanks.

Code: Select all

<?
    /*** phpBB3 - Last Active Topics System ***/

    //Author: Ioan Filipov

    //Email: jonidev@gmail.com

    //Date: 04.06.2007

    //------------------------------

    //Edit these parameters:

    //MySQL server adress
    $host="localhost";

    //Username
    $user="";

    //Password
    $pass="";

    //Database
    $db="";

    //Table prefix
    $table="phpbb3_";

    //Show last x topics
    $laforums="10";


    $link=mysql_connect($host, $user, $pass);
    $db=mysql_select_db($db);
    $query="select * from $table".topics."  WHERE topic_approved = '1' order by topic_last_post_time desc limit 0,$laforums";
    $query2="select config_name,config_value from $table".config." where config_name = 'server_name' limit 0,1";
	$result2=mysql_query($query2);
    $row2 = mysql_fetch_array($result2);
    extract($row2);
    $result=mysql_query($query);
    while ($row=mysql_fetch_array($result)) {
    extract($row);
    $date = date("F j, Y, g:i a", $topic_last_post_time );
	$query3="select forum_name from $table".forums." WHERE forum_id = ".$forum_id."";
	$result3=mysql_query($query3);
	$row2 = mysql_fetch_array($result3);
  echo "<a href='http://".$config_value."/viewforum.php?f=".$forum_id."' target='_blank'>".$row2[forum_name].":</a> <a href='http://".$config_value."/viewtopic.php?f=".$forum_id."&t=".$topic_id."' target='_blank'>".$topic_title."</a> view: ".$topic_views.", replies: ".$topic_replies.", topic first poster: ".$topic_first_poster_name.", topic last poster: ".$topic_last_poster_name.", topic last post time: ".$date."<br>\n";
    }

    //-------------------------- END
    ?>
This code shows the forum name next to topic name.
I'm working on (disable) showing topics in private forums.

GhostPool - i can't understand very well, please give an example.
GhostPool
Registered User
Posts: 20
Joined: Wed Feb 01, 2006 9:14 am
Contact:

Re: [REQUEST] Recent Posts on Home Page

Post by GhostPool »

IoanFilipov wrote:This code shows the forum name next to topic name.
I'm working on (disable) showing topics in private forums.

GhostPool - i can't understand very well, please give an example.
As well as not showing topics in private forums, could you allow us to specify which forums we don't want included. I have some boards that are not private but I don't want them shown.

Well, maybe it's just me, but when I click on a topic link generated by your coding it takes me to the first page of the topic and not the latest post in that topic. So I was wondering if you could add something like this, I've bolded the part I'm referring to.

echo "<a href='http://.../fanforum/viewtopic.php?f=".$forum_id."&t=".$topic_id."."#p=".$post_id."' target='_blank'>
Vinyard_X43q
Registered User
Posts: 19
Joined: Wed Jun 06, 2007 8:14 am

Re: [REQUEST] Recent Posts on Home Page

Post by Vinyard_X43q »

I added this to IoanFilipov's code so that on click it will go to the lastest post in the topic.
just add after

Code: Select all

    //Show last x topics
    $recent_topics_limit="10";
add this

Code: Select all

	//post per page 10 is default
	$posts_per_page = '10';
and after

Code: Select all

    while ($row=mysql_fetch_array($result)) {
		extract($row);
add this

Code: Select all

		$topic_posts_sum = $topic_replies + 1;
		$page_start_post = '0';
		$counter = $posts_per_page;
		do {
			$page_start_post += $posts_per_page;
			$counter += $posts_per_page;
		} while ($counter < $topic_posts_sum);
finally replace

Code: Select all

    echo "<a href='http://".$config_value."/viewtopic.php?f=".$forum_id."&t=".$topic_id."' target='_blank'>".$topic_title."</a> view: ".$topic_views.", replies: ".$topic_replies.", topic first poster: ".$topic_first_poster_name.", topic last poster: ".$topic_last_poster_name."<br>";
with this

Code: Select all

		if ($topic_posts_sum > $posts_per_page) {
			echo "<a href='http://".$config_value."/viewtopic.php?f=".$forum_id."&t=".$topic_id."&start=".$page_start_post."#p".$topic_last_post_id."' target='_blank'>";
		} else {
			echo "<a href='http://".$config_value."/viewtopic.php?f=".$forum_id."&t=".$topic_id."#p".$topic_last_post_id."' target='_blank'>";
		}
      echo $topic_title."</a> view: ".$topic_views.", replies: ".$topic_replies.", topic first poster: ".$topic_first_poster_name.", topic last poster: ".$topic_last_poster_name."<br />";
I hope IoanFilipov doesn't mind me helping him out.

Edit: Use IoanFilipov's new code its shorter and it works just as good if not better.
Last edited by Vinyard_X43q on Thu Jun 07, 2007 9:49 am, edited 1 time in total.
GhostPool
Registered User
Posts: 20
Joined: Wed Feb 01, 2006 9:14 am
Contact:

Re: [REQUEST] Recent Posts on Home Page

Post by GhostPool »

Works great Vinyard_X43q. Thanks!

Now we just need to be able to exclude certain forums from showing their topics in the list.
midwestbonsai
Registered User
Posts: 177
Joined: Sat May 28, 2005 12:48 am
Location: Wisconsin USA
Contact:

Re: [REQUEST] Recent Posts on Home Page

Post by midwestbonsai »

midwestbonsai wrote:Any thoughts as to why it is saying all of the dates are December 31, 1969, 6:00 pm
when they are right within the forum?

Thanks for the help.
I take it that none of you are having this problem?
Locked

Return to “[3.0.x] MOD Requests”