vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Forum Home Enhancements - My Recent Posts on Forumhome (https://vborg.vbsupport.ru/showthread.php?t=140940)

Mistah Roth 03-01-2007 10:00 PM

My Recent Posts on Forumhome
 
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:
Code:

<!-- what's going on box -->
Replace With:
Code:

<!-- 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:
PHP Code:

$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

Quote:

Originally Posted by ChurchMedia (Post 1194304)
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:

PHP Code:

$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

Quote:

Originally Posted by ChurchMedia (Post 1194492)
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?

Quote:

Originally Posted by redtailboa (Post 1194602)
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

Quote:

Originally Posted by ChurchMedia (Post 1194970)
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 ;)


All times are GMT. The time now is 05:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01256 seconds
  • Memory Usage 1,761KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete