Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 06-09-2011, 12:14 PM
thehawkVB thehawkVB is offline
 
Join Date: Apr 2011
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help on thread merging

Good morning.

I would like your help to understand how can I implement a change to the way threads are merged together. My problem is that I don't want the posts to be sorted by date after I merge but want ALL posts from the second to thread to appear at the very bottom of the first one, the destination one.

Now of course it could be done by changing the date/time of the posts during the merging process like for example if I merge thread B into thread A at midnight, all posts of thread B will start at midnight + 2 minutes, midnight + 4 minutes and so on, but this would still cause a problem in case thread B has a lot of posts as I may end up with the last post's time set at 03:05 with someone posting a post at 02:05.

Any idea how I can achieve what I want or I'm asking for something impossible to achieve?

Thank you.
Reply With Quote
  #2  
Old 06-11-2011, 03:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It seems to me the only way to do this would be to add a field to the post table and use that in the query when ordering the posts for a thread.
Reply With Quote
  #3  
Old 06-11-2011, 03:35 PM
thehawkVB thehawkVB is offline
 
Join Date: Apr 2011
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So if I understand correctly:

a. Add a new field - example: orderid - to the vb_post table
b. Run a query to fill the value of orderid in ALL existing posts in the table, ordering by the date/time of the post and starting from 1 in order to avoid having orderid = 0 for existing posts
c. Change the way thread posts are retrieved so as they are sorted by this new field "orderid"
d. When merging thread B into thread A, take the last orderid of thread A(example: 71) and insert all posts from thread B starting with orderid 72

Is that correct?
Reply With Quote
  #4  
Old 06-11-2011, 03:40 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is what I was thinking. But it might be easier if you make an orderid field and default it to 0, and leave it as is for normal threads. Then when merging threads, find the highest value of that field and increase it by one, and set the posts for the thread you want to come second to that new value (i.e 1 if it is the first time you're merging. Or maybe have a text field that you can fill in when merging so you can control the order of posts).

Then when showing a thread order by orderid then dateline (or whatever field it already uses).

Edit: Another thought, maybe you could avoid adding a column to the post table (which might be good if you already have a large number of post) by making a new table with just postid and orderid (and maybe an index on postid), then join that table in the showthread query. (But I'm not a db expert or anything).
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:19 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.03241 seconds
  • Memory Usage 2,169KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete