Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-14-2012, 08:13 PM
DivinoZarathos DivinoZarathos is offline
 
Join Date: Apr 2012
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I edit two posts at the same time?

I'm building a vB modification that allows moderators to duplicate a post and insert it in another existing thread only once. I added a column to the post sql table that keeps track of the "link" between the two posts.
I can already delete both posts if one of them is deleted, but now I would like to create a specular post editing system so that if one of the two posts is edited, the other reflects the same changes.
Let's say I have a post with ID=10. It is duplicated by a mod and inserted into another thread: the duplicated post has ID=11. Now in my database post ID=10 will have LINKID=11 and post ID=11 will have LINKID=10.
How can I hook into editpost.php so that if I edit post ID=10, post ID=11 also get edited and vice-versa?

Many thanks.
Reply With Quote
  #2  
Old 05-14-2012, 09:34 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What you might want to do is look at includes/class_dm_threadpost.php and find the place where an edited post is actually updated. Then you might be able to find a place to check your link field and modify the other post in the same way.
Reply With Quote
  #3  
Old 05-14-2012, 09:51 PM
DivinoZarathos DivinoZarathos is offline
 
Join Date: Apr 2012
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I found this:
PHP Code:
    $dataman =& datamanager_init('Post'$vbulletinERRTYPE_ARRAY'threadpost');
    
$dataman->set_existing($postinfo);

    (
$hook vBulletinHook::fetch_hook('editpost_update_process')) ? eval($hook) : false;

    
$dataman->set_info('parseurl', (($vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_URL) AND $foruminfo['allowbbcode'] AND $edit['parseurl']));
    
$dataman->set_info('posthash'$posthash);
    
$dataman->set_info('forum'$foruminfo);
    ... 
But I don't know how to duplicate the dataman, set it up to a different existing like:
PHP Code:
$linkdataman->set_existing(fetch_postinfo($postinfo['linkid'])) 
And then make $dataman functions reflect $linkdataman ones... seems quite difficult...
Reply With Quote
  #4  
Old 05-14-2012, 09:57 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sounds like you've pretty much got it figured out. Why not just make the same datamanager calls that are being made on the other datamanager? If you're only interested in having the text of the linked post update, then you probably only need to set_existing, [S]set('message'...)[/S], then save().

Edit: sorry, that second one would actually be setr('pagetext', $edit['message']). And you wouldn't want to duplicate all the calls made on the other post because you don't want to be changing the threadid or forumid, for instance.
Reply With Quote
Reply


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 12:33 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08934 seconds
  • Memory Usage 2,191KB
  • 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
  • (2)bbcode_php
  • (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_postinfo_query
  • fetch_postinfo
  • 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