vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How can I edit two posts at the same time? (https://vborg.vbsupport.ru/showthread.php?t=282921)

DivinoZarathos 05-14-2012 08:13 PM

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.

kh99 05-14-2012 09:34 PM

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.

DivinoZarathos 05-14-2012 09:51 PM

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...

kh99 05-14-2012 09:57 PM

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.


All times are GMT. The time now is 03:50 PM.

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.01053 seconds
  • Memory Usage 1,720KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete