[ABD] Latest Posts

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Locked
updown
Registered User
Posts: 542
Joined: Sat Jan 05, 2008 6:53 am

Re: [RC] Latest Posts

Post by updown » Wed Jul 09, 2008 12:07 pm

I did an unoptimized but very well working hack for myself:

In the modded index.php
FIND:

Code: Select all

	//the sql query... we combine data from the 3 tables (for data about post subject, poster, time ... username, user colour ...
	//and forum name)
	//only approved posts from readable forums are chosen
	//user can view the subject, username, forum name and post time along with appropriate links...
	if ($first_readable_forum)
	{
ADD AFTER:

Code: Select all

		$max_post_number = '';
		$sql = 'SELECT MAX(post_id) AS max_post_number
			FROM ' . POSTS_TABLE;
		$result = $db->sql_query($sql);
		$max_post_number = (int) $db->sql_fetchfield('max_post_number');
		$db->sql_freeresult($result);

FIND:

Code: Select all

		$sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.poster_id, p.icon_id, p.post_time, p.post_subject, u.username, u.user_colour, f.forum_name
			FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . FORUMS_TABLE . ' f 
			WHERE p.post_approved = 1
				AND p.poster_id = u.user_id ' . '			
				AND (p.forum_id = f.forum_id OR (p.forum_id = 0 AND f.forum_id = ' . $first_readable_forum . ')) ' . $forum_sql .
		' ORDER BY p.post_id DESC';
		
		//query the db
		$result = $db->sql_query_limit($sql, $config['latest_posts']);
		
		$latest_posts = array();
REPLACE WITH:

Code: Select all

		$sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.poster_id, p.post_time, p.post_subject, u.username, u.user_colour, f.forum_name
			FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . FORUMS_TABLE . ' f
			WHERE p.post_approved = 1
				AND p.poster_id = u.user_id
				AND p.post_id > (' . $max_post_number . ' - 200)
				AND (p.forum_id = f.forum_id OR (p.forum_id = 0 AND f.forum_id = ' . $first_readable_forum . ')) ' . $forum_sql .
		' ORDER BY p.post_id DESC';

		//query the db
		$result = $db->sql_query_limit($sql, $config['latest_posts']);
		$latest_posts = array();
		unset($max_post_number);

Effectively, I have changed only 2 things:

1.) get the latest post-id-number with an additional fast query

2.) Since we only need the ~10 (or so, depending on your settings in ACP) latest posts, stop querying ALL posts! Instead, I used the lastest post-number 'max_post_number' MINUS an empirical value, in my case 200:

Code: Select all

				AND p.post_id > (' . $max_post_number . ' - 200)
So, since this hack only checks posts from the last post-number to this value minus 200, there may be the following individual issues:

possible problems to think about for yourself:
a) If you will delete many newer posts before the last posts, the mod may not output all wanted newest posts (since there may be not enough post-ids left to select)

b) If you have many forums with special user-rights for reading its posts, this value '200' may not be sufficiant to let them output the wanted number of newest posts (since there may be much posts that they are not allowed to read).

So, feel free to optimize the value '200' individually for your board by changing it to greater values, to get your own matching solution for showing the newest posts right for every thinkable group, but not wasting too much time for querying. The worst thing to happen is, that the mod shows less posts than you set in ACP.

In my special case, the query-time changed from 1.350 secs to 0.006 secs (!!!) :o


PS: This surely is not optimal, but better than before. If someone sees a possibility to optimize this, I'm grateful to read a solution.

blusterblade
Registered User
Posts: 3
Joined: Tue Jul 01, 2008 8:15 am
Location: Belgium
Contact:

Re: [RC] Latest Posts

Post by blusterblade » Thu Jul 10, 2008 7:51 am

After installing this MOD (which i realy like..so thanks :) )
i get a blanc page when i want to open my
* Board settings
* Board features
* Avatar settings
* Private message settings
* Post settings
* Signature settings
* User registration settings
* Visual confirmation settings

in the ACP (under general-board config)

Anyone else having this problem? ..and how do i solve this :)

Thanks

updown
Registered User
Posts: 542
Joined: Sat Jan 05, 2008 6:53 am

Re: [RC] Latest Posts

Post by updown » Thu Jul 10, 2008 9:09 pm

sounds like a problem with your language-files:

check your edits it there are any blank spaces or text before '<?php' and '?>' and remove them! - and be shure to make your edits with a functional editor (e.g. NOT NOTEPAD!), and save the files in UFT-8 without BOMs.

by the way: Where is the Mod-author? :roll:

blusterblade
Registered User
Posts: 3
Joined: Tue Jul 01, 2008 8:15 am
Location: Belgium
Contact:

Re: [RC] Latest Posts

Post by blusterblade » Fri Jul 11, 2008 7:52 am

updown wrote:sounds like a problem with your language-files:

check your edits it there are any blank spaces or text before '<?php' and '?>' and remove them! - and be shure to make your edits with a functional editor (e.g. NOT NOTEPAD!), and save the files in UFT-8 without BOMs.

by the way: Where is the Mod-author? :roll:
thanks :)
It was a problem in the language file 'board.php' ..fixed now

yeah seems like the MOD author is MIA..

User avatar
kicky
Registered User
Posts: 166
Joined: Wed Feb 27, 2008 11:49 am

Re: [RC] Latest Posts

Post by kicky » Sun Sep 07, 2008 3:03 am

Just install to my web

Work perfect....... ;)

But I hate it showed Re : xxxxxxx
Please see attachment
Image

Can you help me to make the subject without Re : ?? ;)

Thanks
Be a part of solution better than be part of problems

User avatar
kicky
Registered User
Posts: 166
Joined: Wed Feb 27, 2008 11:49 am

Re: [RC] Latest Posts

Post by kicky » Sun Sep 07, 2008 2:44 pm

Just realized......
I can not open some of function in my ACP under Board Configuration after I install this mod.

Code: Select all

Open: includes/acp/acp_board.php
Find
Tip: This may be a partial find and not the whole line.

Code: Select All
						'override_user_style'	=> array('lang' => 'OVERRIDE_STYLE',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),
Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Code: Select All
						// MOD Latest Posts
						'latest_posts' => array('lang' => 'ACP_LATEST_POSTS', 'validate' => 'int', 'type' => 'text:3:2', 'explain' => true),
						'allow_guests_latest_posts' => array('lang' => 'ACP_GUESTS_LATEST_POSTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
						// END MOD
In this edit, I should find new ACP, but I couldn't. Even some of my ACP can not opened. Please see the ACP that I can not open
Image ;)
Be a part of solution better than be part of problems

barraz
Registered User
Posts: 3
Joined: Sun Aug 03, 2008 7:00 am

Re: [RC] Latest Posts

Post by barraz » Wed Sep 10, 2008 4:07 pm

Hi everybody,

I can see the latest post only when Im logged in. Quests cant see the mod. How can I change this so everybody van see the latest posts?

Richazey
Registered User
Posts: 823
Joined: Mon Oct 27, 2008 9:03 pm

Re: [RC] Latest Posts

Post by Richazey » Tue Dec 23, 2008 8:46 pm

Works Great!!!!

User avatar
wtf-bollos
Registered User
Posts: 26
Joined: Mon Aug 21, 2006 3:33 pm
Location: the garden of england

Re: [RC] Latest Posts

Post by wtf-bollos » Mon Jan 12, 2009 5:28 pm

hi,

nice little mod..

my advice is to not forget to change the actual number of posts from 0 (der!) to whatever value you want, say 5 or 10. like i didn't.. :roll:

i had installed this mod and NOTHING was happening, so if you have the same thing, you can set the value on the board settings page. latest posts becomes something that you can edit there

The number of readable latest posts to be shown on Board Index:

kinda obvious ;)


bbbut, the first time i pressed that, i got this:

Code: Select all

SQL ERROR [ mysql4 ]

Duplicate entry 'allow_guests_latest_posts' for key 1 [1062]

SQL

INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('allow_guests_latest_posts', 0, 0)

BACKTRACE

FILE: includes/db/mysql.php
LINE: 174
CALL: dbal->sql_error()

FILE: includes/functions.php
LINE: 156
CALL: dbal_mysql->sql_query()

FILE: includes/acp/acp_board.php
LINE: 425
CALL: set_config()

FILE: includes/functions_module.php
LINE: 507
CALL: acp_board->main()

FILE: adm/index.php
LINE: 74
CALL: p_master->load_active()
if anyone can advise, i'd appreciate it :)

i note that the exact same problem was outlined here:
http://www.phpbb.com/community/viewtopi ... 2#p5607425

by CrossoverX..

also to the mod author TheUniqueTiger (great work btw!), regarding that optimised SQL query above, by updown, can this be added to the mod?

cheers,
bill

p.s. stuff and nonsense: [removed]
Last edited by camm15h on Sun Jun 07, 2009 2:22 pm, edited 1 time in total.
Reason: Code tags added, link not necessary, thanks!

andy2295
Registered User
Posts: 519
Joined: Tue Mar 25, 2008 4:36 pm

Re: [RC] Latest Posts

Post by andy2295 » Wed Feb 25, 2009 3:21 pm

Please note i have now officially taken this mod over. Further info in due course

User avatar
InternetMafia
Registered User
Posts: 146
Joined: Sun Apr 06, 2008 4:55 pm
Location: New York
Contact:

Re: [RC] Latest Posts

Post by InternetMafia » Mon Mar 02, 2009 8:20 pm

Cool. Let us know Any. I have been looking for something like this for a long time.
Dangerous But Worth The Risk

mobile_mania
I've Been Banned!
Posts: 5
Joined: Wed Apr 22, 2009 5:08 am

Re: [RC] Latest Posts

Post by mobile_mania » Fri Apr 24, 2009 7:50 am

this is my first MOD that i install as i am new user to phpbb but it was so easy and simple and work fine
thank you

theblase
Registered User
Posts: 14
Joined: Sat Jul 26, 2008 11:41 am

Re: [RC] Latest Posts

Post by theblase » Sat Sep 04, 2010 8:12 pm

Hi,

Is this mod compatible with the latest version of phpBB 3.0.7-PL1?

Thanks in advance,
theblase

Locked

Return to “[3.0.x] Abandoned MODs”