(Solved) Last Thread Certain Users (PORTAL)
#1
Hi Guys,

Im trying to show in the "last threads" of the portal, only the last thread of certain users, I know you can filter by forum you want to show, but I want to select the last threads of some users.-

Thanks!


Thanks SvePu!  Big Grin
Reply
#2
The simplest way is to edit the portal.php file in forum root direction.

Search script part (line #353)
$query = $db->query("
		SELECT t.tid, t.fid, t.uid, t.lastpost, t.lastposteruid, t.lastposter, t.subject, t.replies, t.views, u.username, u.usergroup, u.displaygroup
		FROM ".TABLE_PREFIX."threads t
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
		WHERE 1=1 {$excludeforums}{$tunviewwhere}{$tinactivewhere} AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
		ORDER BY t.lastpost DESC
		LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
	);

Replace this part with:
$query = $db->query("
		SELECT t.tid, t.fid, t.uid, t.lastpost, t.lastposteruid, t.lastposter, t.subject, t.replies, t.views, u.username, u.usergroup, u.displaygroup
		FROM ".TABLE_PREFIX."threads t
		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
		WHERE 1=1 {$excludeforums}{$tunviewwhere}{$tinactivewhere} AND t.visible='1' AND t.uid IN ('UIDs YOU WANT Display') AND t.closed NOT LIKE 'moved|%'
		ORDER BY t.lastpost DESC
		LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
	);

Replace "UIDs YOU WANT Display" with the UIDs of users (separated by comma) which topics you want list.

eg.: 3,4,5 to list threads by user id number 3,4 and 5

Hope you know what I mean Smile
Greetings Sven (ps: Sorry for my bad english!!)

My plugins - [email protected]
Reply
#3
Thank you SvePu, well you almost got it! jaja - The line its 518 its about the announcements so you put:

Original Code:

		$query = $db->query("
			SELECT t.*, t.username AS threadusername, u.username, u.avatar, u.avatardimensions
			FROM ".TABLE_PREFIX."threads t
			LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
			WHERE t.tid IN (0{$tids}){$annfidswhere} AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
			ORDER BY t.dateline DESC
			LIMIT 0, {$numannouncements}"
		);

Change With:

		$query = $db->query("
			SELECT t.*, t.username AS threadusername, u.username, u.avatar, u.avatardimensions
			FROM ".TABLE_PREFIX."threads t
			LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
			WHERE t.tid IN (0{$tids}){$annfidswhere} AND t.visible='1' AND t.uid IN ('Example Users ID') AND t.closed NOT LIKE 'moved|%'
			ORDER BY t.dateline DESC
			LIMIT 0, {$numannouncements}"
		);

Thanks to you, and a last little thing to not open a new thread, im not very familiar with CSS, but I want to change the width of the container of the portal, its in the global .CSS in the line:

#container {
        bla
        bla
        bla
	width: 1200px;
}

Its some way to call another function of the .css for example #container_portal in the portal.php or in the portal template?

Thanks!
Reply
#4
1.)
Maybe your code is only an example but to be sure.

Insert the numbers without any other text....ok?!
AND t.uid IN ('1,2,3,4')

2.)
The container div is defined in the header template for the whole forum. It's too much work to rebuild.
But you can add a new stylesheet which is only attached to the portal.php site. There you can style the portal container width as you like.

   
Greetings Sven (ps: Sorry for my bad english!!)

My plugins - [email protected]
Reply
#5
SvePu,
The numbers and letters in my code was an was an example of the users ID for someone who need the code Smile, and I use the code you give me and use it in the Announcements at line 518, and works like I want! And discover I can do the same with usersgroups so its fantastic - Thanks to you for give me idea.-

Yes I see that about the global.css its in the header Sad - Oh I never know about that posiblity to add to specific files.-
I try it and works fantastic! - That was my idea have the original global.css for the forum and a new .css for the portal.php

Well, thank you very much to you SvePu, for your time and very good help!
Reply
#6
It was my pleasure to help you.

Now it's sleep time - it's 3am here in Germany. Wink
Greetings Sven (ps: Sorry for my bad english!!)

My plugins - [email protected]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)