View Full Version : Forum Home Enhancements - My Recent Posts on Forumhome
Mistah Roth
03-01-2007, 10:00 PM
This is my first released hack, so if you have any constructive suggestions or feedback, it'd be greatly appreciated. This is still a beta version of the hack, it doesnt support phrases or have any admin options yet, and needs a bit of optimization, I will add those in a later version.
DESCRIPTION
This adds a table onto your forumhome that shows information the last 5 threads the user has posted in, including the thread title, thread starter, last post date, last post username, replies, views, and what forum it is in.
INSTALL
1) Upload product-recentposts.xml
2) Add the following code to FORUMHOME:
Find:
<!-- what's going on box -->
Replace With:
<!-- recent posts -->
<if condition="$show['recentposts']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"><tbody>
<tr>
<td class="tcat" colspan="6">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_recentposts')"><img id="collapseimg_forumhome_recentposts" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_forumhome_recentposts].gif" alt="" border="0" /></a>
My Recent Posts
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_recentposts" style="$vbcollapse[collapseobj_forumhome_recentposts]">
<tr class="thead">
<td width="20"></td>
<td class="thead" width="40%"><b>Thread</b></td>
<td class="thead"><b>Last Post</b></td>
<td class="thead" align="center"><b>Replies</b></td>
<td class="thead" align="center"><b>Views</b></td>
<td class="thead" align="right"><b>Forum</b></td>
</tr>
$recentpostbits
</tbody>
</table>
<!-- /recent posts-->
<br />
</if>
<!-- what's going on box -->
This will place it above the What's Going On? box, you can put this anywhere you like really.
This has only been tested on vb 3.6.4
DEMO / EXAMPLE
http://forums.ffextreme.com/
You will have to register and post to actually see it working unfortunately hehe.
MODIFY NUMBER OF THREADS SHOWN (TEMP)
I will add admin cp options in the next update, but if you want to modify how many threads are shown on the list:
1) Goto the Plugin Manager
2) Click [Edit] for the Recent Posts by You on ForumHome plugin
3) In the text box, find where it says:
$getposts = $db->query_read("SELECT distinct threadid FROM post WHERE userid = $userid ORDER BY postid DESC LIMIT 5");
4) Change the end where it says DESC LIMIT 5, to whatever number you want to show (DESC LIMIT 10 etc)
BUGS / FIXES
0.14 --> Fixed font issues, issues involving deleted threads showing up.
0.13 --> Change font size to smallfont
0.12 --> Changed userid variable to proper variable, added alternating column colours.
0.11 --> Added TABLE_PREFIX to the queries
projectego
03-02-2007, 04:40 PM
Nice idea, Mistah Roth! ;)
ChurchMedia
03-02-2007, 06:08 PM
Nice hack. Needs a little tweaking. The query needs TABLE_PREFIX added before "post". Also, the variable you use ($userid) should be $bbuserinfo[userid]. I think that should fix it up. I'll install it just as soon as you've debugged it. I love the idea!
Keep up the great work! :)
Mistah Roth
03-02-2007, 10:31 PM
Nice hack. Needs a little tweaking. The query needs TABLE_PREFIX added before "post". Also, the variable you use ($userid) should be $bbuserinfo[userid]. I think that should fix it up. I'll install it just as soon as you've debugged it. I love the idea!
Keep up the great work! :)
I added the TABLE_PREFIX to the queries, thanks. I originally tried using bbuserinfo[userid] and it returns a NULL value in the hook (I'm not sure why)
ChurchMedia
03-02-2007, 11:21 PM
Sorry -- I should have known better. I haven't been coding enough!! You need to use $vbulletin->userinfo['userid']. So your query should look like this:
$getposts = $db->query_read("SELECT distinct threadid FROM ". TABLE_PREFIX . "post WHERE userid = " . $vbulletin->userinfo['userid'] . " ORDER BY postid DESC LIMIT 5");
The way you had it written it wasn't bringing up my posts. I don't know whose posts those were. Also, I took out your "if ($userid)" statement and inserted an "<if condition="bbuserinfo[userid]> (your template code) </if>" instead. I can send you my altered version if you want to see it. There was also a broken image on the thread status icon. I just fixed it to forum_old.gif.
Sorry for messing around with your hack. Nothing personal. I think it's an excellent idea and I probably couldn't have written it from scratch. So, great job! Installed and I love it!
:D
redtailboa
03-03-2007, 04:00 AM
I like the idea, but is it collapsible? I couldnt tell from the pic..
If not, how about a option to allow the user to enable/disable it? i only ask this because large forums can get crowded, and some people prefer to turn things like this off while others like these options :)
Mistah Roth
03-03-2007, 05:18 PM
Sorry -- I should have known better. I haven't been coding enough!! You need to use $vbulletin->userinfo['userid']. So your query should look like this:
The way you had it written it wasn't bringing up my posts. I don't know whose posts those were. Also, I took out your "if ($userid)" statement and inserted an "<if condition="bbuserinfo[userid]> (your template code) </if>" instead. I can send you my altered version if you want to see it. There was also a broken image on the thread status icon. I just fixed it to forum_old.gif.
Sorry for messing around with your hack. Nothing personal. I think it's an excellent idea and I probably couldn't have written it from scratch. So, great job! Installed and I love it!
:D
I fixed the userid issue, should work properly now thanks for pointing that out. I kept the if ($vbulletin->userinfo['userid']) in because theres no need to run all those queries if the user isn't logged on, also the userid will be NULL if the user isnt logged in, which will cause a database error.
And like I said, its my first released hack and the first time i've ever used the plugin / hook system, so I'll leave it in Beta until im sure all the little bugs are fixed, and I can add functionality to it. Thanks a lot for the support.
And what image was broken and how did you fix it?
I like the idea, but is it collapsible? I couldnt tell from the pic..
If not, how about a option to allow the user to enable/disable it? i only ask this because large forums can get crowded, and some people prefer to turn things like this off while others like these options :)
Yes it is collapsible.
ChurchMedia
03-03-2007, 05:24 PM
Great! I'm glad it worked out. I like feeling useful every once and a while :). Just for future reference, the IF statements in the templates don't create queries, so you can use them without worrying about that.
Again, very nice hack.
Cheers,
Tim
Mistah Roth
03-03-2007, 05:46 PM
Great! I'm glad it worked out. I like feeling useful every once and a while :). Just for future reference, the IF statements in the templates don't create queries, so you can use them without worrying about that.
Again, very nice hack.
Cheers,
Tim
What I meant was, without the if statement in the Plugin to stop the script from running if the user is not logged in, it will try to execute the queries with a NULL value userid.
Tom_S
03-03-2007, 07:22 PM
Nice job..I just would like the font to be sized down ;)
KrisP
03-04-2007, 05:31 PM
Good work,
perfphysio
03-04-2007, 06:11 PM
Nice job..I just would like the font to be sized down ;)
I agree with this one. The font on the rest of my board is smaller than this one. Is there a way that the code can assumen that which is the default already on the board?
Also an ability to colout the backround colour specifically for the title part would also be cool. E.g. my forum has everything with a blue background. To make this stand out it might be nice to add a different colour to the title background for this mod.
nice hack though :)
Mistah Roth
03-04-2007, 06:48 PM
Updated the font size.
I will add the option to excluse forum id's once I create the admincp options for it.
Also the title background colour is just set to match the rest of the layout, theres no real need to make it stand out.
perfphysio
03-04-2007, 07:35 PM
thanks, the font is better but still doesn't match the boards default one being used.
Mistah Roth
03-05-2007, 12:16 AM
Hmmm its fine for all of the forums I've tested it on, can you show me your forum?
Mistah Roth
03-06-2007, 04:13 AM
Okay I've found a bug in the first query of the script, and after working on it for two days I am officially stumped.
The following query:
SELECT distinct threadid FROM ". TABLE_PREFIX . "post WHERE userid = " . $vbulletin->userinfo['userid'] . " ORDER BY postid DESC LIMIT 5
Does not return the last 5 threads posted in. For some reason it skips any older thread. If I remove the distinct from the query, it shows the last 5 posts properly. The problem is we can't have repeats, so DISTINCT is supposed to solve that.
Anyone have any idea whats going wrong? If all else fails I'll just make it so that it filters out doubles with PHP code.... not as efficient as I'd like it though, there should be no reason the query doesnt work.
Installed thank you.
Small font update is not working for me though. Everything is in regular font.
FEATURE REQUEST: add "show all my posts" link/button at the end (somewhere) .-)
perfphysio
03-08-2007, 11:53 AM
Hmmm its fine for all of the forums I've tested it on, can you show me your forum?My board can be seen at http://www.physiochat.com. The header fonts are OK, it is the description of the forum that doesn't match i.e. that last post part and the username, e.g. Today at 01:33 PM, by physiobobGo to last post
vbuser99
03-12-2007, 07:40 PM
This also displays deleted threads.
To Fix, change the query in XML file:
from:
SELECT distinct threadid FROM ". TABLE_PREFIX . "post WHERE userid = " . $vbulletin->userinfo['userid'] . " ORDER BY postid DESC LIMIT 5
to:
SELECT distinct b.threadid FROM ". TABLE_PREFIX . "post a, ". TABLE_PREFIX . "thread b WHERE a.userid = " . $vbulletin->userinfo['userid'] . " AND b.visible = 1 AND a.threadid = b.threadid ORDER BY a.postid DESC LIMIT 5
Tom_S
03-12-2007, 08:51 PM
How about an update release with all fixes to include the font fix so the xml can overwrite the exisiting one please?
Tom_S
03-14-2007, 11:34 AM
Nothing yet?
The font issue is an easy one. In the XML
Find all instances of:
<smallfont>
Replace with:
<div class="smallfont">
Find all instances of:
</smallfont>
Replace with:
</div>
Reinstall and allow overwrite
Mistah Roth
03-14-2007, 08:36 PM
I will get those two fixes done, sorry I've been distracted trying to fix another bug that randomly doesn't show posts in really old threads. Trying to get some help with that in a seperate thread.
I'll get those two things fixed up and update it.
Tom_S
03-14-2007, 08:38 PM
kewl beans my friend :)
Cedric_FP
03-18-2007, 10:14 AM
Going to subscribe to this thread :)
harlita
03-19-2007, 05:59 AM
how's this one coming along? i'll install once completed ^_^
edit: installed and it works fine. love it *clicks installed with an excellent*
nautiqeman
03-27-2007, 08:17 PM
for the pepole that don't want to sign up for the site and make some posts, I'll provide a screen shot tonight
harlita
04-23-2007, 04:00 AM
Installed AGAIN after I had to reinstall forums (unrelated issue).
And I'll tell ya, we REALLY dig this hack.
Most people have been relying on subscribed threads for the sole purpose of reading responses to their posts. But the "latest posts" hack is REALLY REALLY convenient.
I love it. Thanks a bunch!
OH - if anyone wants to see a raw forum screenshot of what the hack looks like (i see the person above stated they'd upload one) you can view a screenshot here:
http://www.mangacult.net/recentposts.jpg
(we're just reinstalling tonight, so don't mind the lack of forum-ness ^_^)
sunrise2006
04-23-2007, 10:09 AM
It's very nice, but i think if you change the below code in 'forumhome_recentpostbits':
<a href="showthread.php?t=$rpthread[threadid]">
to
<a href="showthread.php?goto=newpost&t=$rpthread[threadid]">
will be more better, however I know that this is only a Beta version and I think you will add more features in next versions.
* Clicks Install *
sebbo
04-25-2007, 07:09 PM
I would like to allow this mod to only one usergroup. How can I do it?
troybtj
05-04-2007, 06:06 PM
Installed, works excellent!
Is there a way to make it a link? Like the "New Posts" on NavBar?
impuLsive
09-15-2007, 06:59 PM
How do I make this show for all user groups? Otherwise, good work!
harlita
12-20-2007, 07:17 AM
Lovely. Works wonderfully on 3.6.8 - new install - good to go.
ArnyVee
06-19-2008, 02:28 AM
Installed, works excellent!
Is there a way to make it a link? Like the "New Posts" on NavBar?
Good question. Does anyone use this in any other place on their site?
ArnyVee
06-19-2008, 02:44 AM
It seems to work on 3.7.1 P1 that I'm running.
Although, I'd like to do this mod as a navbar link as well. Anyone know how to do this?
harlita
07-23-2008, 05:12 PM
I'll be attempting install on new 3.7.2 spl 1 as well this evening. I'll post back if it's all good (security token bug, compatibility with all other forumhome hacks, etc etc) although I don't foresee any problems with the way this product is written.
cormee
08-06-2008, 10:59 AM
Great mod, works perfectly thanks. :)
Warlord
09-14-2008, 02:35 AM
Nice hack, seems to work just fine on 3.6.8. Good work! :)
*clicks install*
Outbackmark
10-05-2008, 12:12 PM
Nice hack and works well on 3.6.11 I have just installed on 3 sites no problems!
lnxtr
11-05-2008, 07:35 PM
hi
i want to my user kontrol panel wiev
Warlord
12-03-2008, 10:22 PM
Any idea on when the updated version will be out with the ability to exclude forums from this hack? I may take a stab at editing my forums to do this but if the update will be released soon I will just wait on that. :D
hi
i want to my user kontrol panel wiev
If you're asking to put this in your User Control Panel, I did this for my forums. (Hopefully Mistah Roth doesn't mind me posting this variation in here for people. If you do, feel free to have one of the staff delete this post.)
Create a plug in called: Recent Posts in User CP
Hook Location: usercp_complete
Plug in PHP Code:
if ($vbulletin->userinfo['userid']) {
global $vbulletin;
$getposts = $db->query_read("SELECT distinct b.threadid FROM ". TABLE_PREFIX . "post a, ". TABLE_PREFIX . "thread b WHERE a.userid = " . $vbulletin->userinfo['userid'] . " AND b.visible = 1 AND a.threadid = b.threadid ORDER BY a.postid DESC LIMIT 5");
while($recentpost = $db->fetch_array($getposts)) {
$tid = $recentpost['threadid'];
$getthreadid = $db->query_read("SELECT * FROM ". TABLE_PREFIX . "thread WHERE threadid = $tid");
$rpthread = $db->fetch_array($getthreadid);
$rpthread['date'] = vbdate($vbulletin->options['dateformat'], $rpthread['lastpost'], 1);
$rpthread['time'] = vbdate($vbulletin->options['timeformat'], $rpthread['lastpost']);
$icon = fetch_iconinfo($rpthread['iconid']);
$rpthread['threadiconpath'] = $icon['iconpath'];
$rpthread['threadicontitle'] = $icon['title'];
$fid = $rpthread['forumid'];
$getforums = $db->query_read("SELECT title FROM ". TABLE_PREFIX . "forum WHERE forumid = $fid");
$rpforum = $db->fetch_array($getforums);
eval("\$recentpostbits .= \"".fetch_template('forumhome_recentpostbits')."\";");
}
if ($tid) $show['recentposts'] = 1;
}
In template USERCP find:
<!-- ############## SUBSCRIBED THREADS ############## -->
Add Above:
<!-- recent posts -->
<if condition="$show['recentposts']">
<p>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"><tbody>
<tr>
<td class="tcat" colspan="6">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_recentposts')"><img id="collapseimg_forumhome_recentposts" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_forumhome_recentposts].gif" alt="" border="0" /></a>
My Recent Forums Posts
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_recentposts" style="$vbcollapse[collapseobj_forumhome_recentposts]">
<tr class="thead">
<td width="20"></td>
<td class="thead" width="40%"><b>Thread</b></td>
<td class="thead"><b>Last Post</b></td>
<td class="thead" align="center"><b>Replies</b></td>
<td class="thead" align="center"><b>Views</b></td>
<td class="thead" align="right"><b>Forum</b></td>
</tr>
$recentpostbits
</tbody>
</table>
<!-- /recent posts-->
</if>
thompson
12-04-2008, 08:46 AM
is there a chance o do that:
need a box for forum 1-10 (good topics) say last 10 posts
and
need another box for forum 11+12 (offtopic) say last 5 posts
??
thanks
Warlord
12-04-2008, 12:15 PM
Where do you want it to appear? On forumhome or the usercp? I'll try to get you the code you need when I have a little more time.
thompson
12-04-2008, 12:30 PM
i want this on forumhome.
i had the alppro ajax plugin, but this only works with one box.
Warlord
12-05-2008, 03:57 AM
Well bro, I tried to get this to work for you the way you wanted for over an hour but unfortunately it seems to have kicked my butt.
For some reason the two plug-ins conflict and you get a combination of both plug-ins somehow. I think I was getting close but I'm stumped. I'll attach the Product XML and post the template code I have so far and maybe Mr. Roth can take a look at it for you and find the problem. Sorry I couldn't be of more help.
FORUMHOME TEMPLATE CODE TO ADD (this would replace the forumhome code originally posted by Mr. Roth in this hack):
<!-- recent posts -->
<if condition="$show['recentposts']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"><tbody>
<tr>
<td class="tcat" colspan="6">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_recentposts')"><img id="collapseimg_forumhome_recentposts" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_forumhome_recentposts].gif" alt="" border="0" /></a>
My Recent Posts
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_recentposts" style="$vbcollapse[collapseobj_forumhome_recentposts]">
<tr class="thead">
<td width="20"></td>
<td class="thead" width="40%"><b>Thread</b></td>
<td class="thead"><b>Last Post</b></td>
<td class="thead" align="center"><b>Replies</b></td>
<td class="thead" align="center"><b>Views</b></td>
<td class="thead" align="right"><b>Forum</b></td>
</tr>
$recentpostbits
</tbody>
</table>
<br />
</if>
<!-- /recent posts-->
<!-- recent posts customized -->
<if condition="$show['recentposts_offtopic']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"><tbody>
<tr>
<td class="tcat" colspan="6">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_recentposts_offtopic')"><img id="collapseimg_forumhome_recentposts_offtopic" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_forumhome_recentposts].gif" alt="" border="0" /></a>
My Recent Posts (Off Topic)
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_recentposts_offtopic" style="$vbcollapse[collapseobj_forumhome_recentposts_offtopic]">
<tr class="thead">
<td width="20"></td>
<td class="thead" width="40%"><b>Thread</b></td>
<td class="thead"><b>Last Post</b></td>
<td class="thead" align="center"><b>Replies</b></td>
<td class="thead" align="center"><b>Views</b></td>
<td class="thead" align="right"><b>Forum</b></td>
</tr>
$recentpostbits
</tbody>
</table>
<br />
</if>
<!-- /recent posts customized-->
thompson
12-05-2008, 06:03 AM
thanks bro, i will have a look at it.
lnxtr
12-11-2008, 07:14 PM
don't run
metalguy639
06-10-2009, 10:20 PM
Hi, I'm trying to get this to show on a different template page. Is there a way to get it to show on a page that is not the forumhome page? I'm using vb 3.8.1 maybe its not working with a different version?
RTMdotORG
06-11-2009, 07:26 AM
UPDATED:
https://vborg.vbsupport.ru/showthread.php?t=215898
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.