MyBB Community Forums

Full Version: Member's All Threads On Profile Page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

I want to show every members' all threads as a list on profile page.

How can I do that?

Thank you.
You want to show all the threads of a user in their profile? That will mess up a lot. i mean a long list that will not help in anything as it gets longer and longer.
How about "only last 10 threads" or if possible "most viewed 10 threads"? If possible both of two?
Alright then..

Open member.php

find

eval("\$profile = \"".$templates->get("member_profile")."\";");
Above it add

$threadlist = '';
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads WHERE uid='".$memprofile['uid']."' AND visible='1' ORDER by dateline DESC LIMIT 0,10");
	while($threads = $db->fetch_array($query))
	{
		$threadlist .= "<a href=\"showthread.php?tid=".$threads['tid']."\">".$threads['subject']."</a><br />";
	}
Now in the profile template

Just add anywhere you like the following
<br /><table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" width="100%" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>Latest threads</strong></td>
</tr>
<tr>
<td class="trow1">
{$threadlist}
</td>
</tr>
</table>
This will show the links to the latest threads by this user we are visiting his profile in a box.

Regards
Thank you so much.

Is it possible to show "most viewed 10 threads" of a member on profile page too?
Sure.. with a little modification tho.., but anyway i will put the full codes and steps for future reference.

Open member.php

find

eval("\$profile = \"".$templates->get("member_profile")."\";"); 
Above it add
$mostviewed = '';
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads WHERE uid='".$memprofile['uid']."' AND visible='1' ORDER by views DESC LIMIT 0,10");
	while($viewedthreads = $db->fetch_array($query))
	{
		$mostviewed .= "<a href=\"showthread.php?tid=".$viewedthreads['tid']."\">".$viewedthreads['subject']."</a><br />";
	}

Now in the member_profile template put the following anywhere

<br /><table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" width="100%" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>Most viewed threads by user</strong></td>
</tr>
<tr>
<td class="trow1">
{$mostviewed}
</td>
</tr>
</table>