View Single Post
  #1  
Old 02-01-2006, 07:28 PM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Recently Viewed (Hack in Progress)

After lurking around sitepoint today, I thought I would create a hack much like they have. "Recently Viewed". The first thing I did is search vB.org to see if it was recently released, or released in the past. I did find a few request for this, but no hack has ever been acually released to the public.

So I started thinking how I can create this hack the best way possiable. The first thing that came into mind is create a new table called "recentlyviewed" with the following information.

'recentlyviewed' Table
  • userid
    The userid of the user viewing the thread
  • threadid
    The threadid of the thead the user is viewing
  • dateline
    The date/time user viewed thread. (TIMENOW)

This means the 1 query will be added on the showthread.php page (per user). Now this method can instantly start filling the "recentlyviewed" table with large boards; Seeing as showthread.php is the mosted used file IMHO. So I thought, lets only keep 5 listing per userid.


Keep only 5 listing in database (per userid)
This would be done using the global.php file...

Scenario:
User has viewed 10 threads (according to the recentlyviewed table). Delete the oldest 5.

Conditions before sql execution:

Code:
	
SQL = count total threads where userid = userid

if (user has more the 5 viewed threads)
{
        Delete the oldest threads viewed, keeping the latest 5
}
else
{
        exit();
}
Now please note that I havn't even started coding this. I just started thinking about it and wanted to get in on paper, and also hear what a few other coders input before I start. So, if you have a better method, please explain. If not, how can I delete the oldest threads viewed, keeping the latest 5? Thanks everyone!

Also, I will publicly release this once this is finished...
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01084 seconds
  • Memory Usage 1,767KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete