Last poster avatar in forumlist
martec Offline
Junior Member
**
Posts: 3
Joined: Jun 2012
Post: #1
Last poster avatar in forumlist
I'm trying put last poster avatar in forumlist, but i donĀ“t want increase query.

So i make modification in index.php

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if($mybb->user['uid'] == 0)
{
	// Build a forum cache.
	$query = $db->query("
		SELECT *
		FROM ".TABLE_PREFIX."forums
		WHERE active != 0
		ORDER BY pid, disporder
	");
	
	$forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
}
else
{
	// Build a forum cache.
	$query = $db->query("
		SELECT f.*, fr.dateline AS lastread
		FROM ".TABLE_PREFIX."forums f
		LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')
		WHERE f.active != 0
		ORDER BY pid, disporder
	");
}


to

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
if($mybb->user['uid'] == 0)
{
	// Build a forum cache.
	$query = $db->query("
		SELECT *, f.*,  lp.avatar
		FROM ".TABLE_PREFIX."forums f
                LEFT JOIN ".TABLE_PREFIX."users lp ON (lp.uid=f.lastposteruid)
		WHERE active != 0
		ORDER BY pid, disporder
	");
	
	$forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
}
else
{
	// Build a forum cache.
	$query = $db->query("
		SELECT f.*, fr.dateline AS lastread, lp.avatar
		FROM ".TABLE_PREFIX."forums f
		LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')
		LEFT JOIN ".TABLE_PREFIX."users lp ON (lp.uid=f.lastposteruid)
		WHERE f.active != 0
		ORDER BY pid, disporder
	");
}


But I do not know if these changes will cause some problem in the functionality of the forum.

especially in this modification

FROM ".TABLE_PREFIX."forums to FROM ".TABLE_PREFIX."forums f

thanks....

06-13-2012 10:43 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Last poster avatar in forumlist - martec - 06-13-2012 10:43 PM

 Standard Tools
Forum Jump: