Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2007, 03:55 AM
netwind netwind is offline
 
Join Date: Feb 2005
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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 ?
Reply With Quote
  #2  
Old 08-17-2007, 05:12 AM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by netwind View Post
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
Reply With Quote
  #3  
Old 08-17-2007, 05:40 AM
netwind netwind is offline
 
Join Date: Feb 2005
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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()
Reply With Quote
  #4  
Old 08-17-2007, 09:16 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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".
Reply With Quote
  #5  
Old 08-17-2007, 09:27 AM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

You didnt answer the question about just deleting the thread.
Reply With Quote
  #6  
Old 08-17-2007, 09:36 AM
netwind netwind is offline
 
Join Date: Feb 2005
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'
Reply With Quote
  #7  
Old 08-17-2007, 12:20 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 08-17-2007, 01:06 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by netwind View Post
How to iterate? Is it more effective than selecting postid and creating Post_Datamanager in loop ?
That's what I meant by iterate
Reply With Quote
  #9  
Old 08-18-2007, 02:29 AM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
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 08:03 AM.


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.04530 seconds
  • Memory Usage 2,249KB
  • Queries Executed 11 (?)
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
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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