vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Trying to use datamanager to move thread (https://vborg.vbsupport.ru/showthread.php?t=281621)

Altari 04-16-2012 10:27 AM

Trying to use datamanager to move thread
 
Hello,

(Sorry for my bad english) :
I'm trying to move a thread and use the vbulletin datamanager. But when i run my script, nothing happen : my thread is not moved and i don't have any errors
Here is my code :

PHP Code:

                $threadinfo = array();
                
$threadinfo['forumid'] = $req_fetch['forumid'];
                
$threadinfo['visible'] = TRUE;
                
$threadinfo['isdeleted'] = FALSE;
                
$threadinfo['open'] = TRUE;
                
$threadinfo['title'] = $req_fetch['title'];
                
                
                
$threadman =& datamanager_init('Thread'$vbulletinERRTYPE_ARRAY'threadpost');
                
$threadman->set_info('skip_moderator_log'true);
                
$threadman->set_existing($threadinfo);
                
$threadman->set('title'$threadinfo['title'], truefalse);
                
$threadman->set('forumid'$forumid_dest);
                
$threadman->save();
                
log_moderator_action($threadinfo'thread_moved_to_x'$forumid_dest); 

$req_fetch['title'] = title in thread table
$req_fetch['forumid'] is an integer (141, 142, 179 or 110 depend of the user)

What's wrong ? :(

Thank you

kh99 04-16-2012 10:35 AM

I'm pretty sure you need $threadinfo to contain the threadid (at least - there maybe be other fields it needs as well). You could use the function fetch_threadinfo, like:

Code:

$threadid = 5;
$threadinfo = fetch_threadinfo($threadid);


Altari 04-16-2012 12:29 PM

That's right, the function need more informations :

PHP Code:

$threadinfo fetch_threadinfo($threadid);
                
                
$threadman =& datamanager_init('Thread'$vbulletinERRTYPE_ARRAY'threadpost');
                
$threadman->set_info('skip_moderator_log'true);
                
$threadman->set_existing($threadinfo);
                
$threadman->set('title'$threadinfo['title'], truefalse);
                
$threadman->set('forumid'$forumid_dest);
                
$threadman->save();
                
log_moderator_action($threadinfo'thread_moved_to_x'$forumid_dest); 

This work.

Thank you !


All times are GMT. The time now is 12:16 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.01749 seconds
  • Memory Usage 1,731KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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