vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   how to use vB_DataManager_Post_Multiple ? (https://vborg.vbsupport.ru/showthread.php?t=155475)

netwind 08-17-2007 02:55 AM

how to use vB_DataManager_Post_Multiple ?
 
I't trying delete multiply posts :
PHP Code:

 
 $postdm
=& datamanager_init('Post'$vbulletinERRTYPE_ARRAY'threadpost');
 
$postdm->set_condition("threadid=200 and not parentid = 0"); 
 
$count_post+=$postdm->delete();
 
$postdm->has_errors(true);
 unset(
$postdm); 

but nothing happens.
Is this class really functioning ?

Eikinskjaldi 08-17-2007 04:12 AM

Quote:

Originally Posted by netwind (Post 1319409)
I't trying delete multiply posts :
PHP Code:

 
 $postdm
=& datamanager_init('Post'$vbulletinERRTYPE_ARRAY'threadpost');
 
$postdm->set_condition("threadid=200"); 
 
$count_post+=$postdm->delete();
 
$postdm->has_errors(true);
 unset(
$postdm); 

but nothing happens.
Is this class really functioning ?

A few things, firstly, why not just delete the thread? I am not really sure what will happen if you delete all posts from a thread but leave the thread lying around

secondly, assuming you do want an empty thread, you should be using "Post_Multiple", not "Post" the Post dm is pretty much expecting a single postid

Thirdly, pass true into delete

netwind 08-17-2007 04:40 AM

This is reduced version. there must be "..and not parentid = 0".

a worked example from admincp/forum.php :
PHP Code:

        $forumdata =& datamanager_init('Forum'$vbulletinERRTYPE_CP);
        
$forumdata->set_condition("FIND_IN_SET(" $vbulletin->GPC['forumid'] . ", parentlist)");
        
$forumdata->delete();

        
define('CP_REDIRECT''forum.php');
        
print_stop_message('deleted_forum_successfully'); 

this really works and i wrote my code similar

if i make instance of class :
$postdm=& datamanager_init('Post_Multiple', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
i give
Call to undefined function: delete()

Opserty 08-17-2007 08:16 AM

vB_DataManager_Post_Multiple does not extend vB_DataManager instead it extends the vB_DataMangaer_Multiple class. Within which there is not a delete() function. Hence why you get the error "Call to undefined function".

Eikinskjaldi 08-17-2007 08:27 AM

Guess you will have to use the Post dm and iterate through it.

You didnt answer the question about just deleting the thread.

netwind 08-17-2007 08:36 AM

I'm not deleting thread! In first time there was reduced condition for debug purpose.
ok let's condition be
$postdm->set_condition("threadid=200 and not parentid = 0 ");
full condition is more complex.
But this still don't delete any post.

How to iterate? Is it more effective than selecting postid and creating Post_Datamanager in loop ?

I can't undestand how code in admincp/forum.php works without creation of class 'Forum_Multiple'

Opserty 08-17-2007 11:20 AM

I think there is a delete_post() function somewhere.

Check the Code Documentation for its exact whereabouts and then check the actual PHP to see it can help you.

Eikinskjaldi 08-17-2007 12:06 PM

Quote:

Originally Posted by netwind (Post 1319451)
How to iterate? Is it more effective than selecting postid and creating Post_Datamanager in loop ?

That's what I meant by iterate :)

Antivirus 08-18-2007 01:29 AM

I found it easier to loop through repeating calls toa dm than to use the multiple dm calls. Check out the announcement datamanager, there's simple example which helped me get thru it


All times are GMT. The time now is 02:19 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.02695 seconds
  • Memory Usage 1,739KB
  • 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
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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