Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 06-06-2003, 05:38 PM
warpeditor warpeditor is offline
 
Join Date: Nov 2001
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Deleting thread when there's reply

Hi,

Right now, our registered members can delete their own post and thread they started. However, is it possible to make registered members CAN delete post but CANNOT delete thread when there's reply?

Is there any hack for this? I couldn't find one.
Reply With Quote
  #2  
Old 06-06-2003, 07:45 PM
MetroSports82's Avatar
MetroSports82 MetroSports82 is offline
 
Join Date: Nov 2002
Location: NJ
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i've tried to come up with something similar to this in the past, but gave up after coming up unsuccessful. but, thats a very good idea there warpeditor! especially when you want to avoid having users delete a large thread, that might have alot of replies, (for intent purpose to get back at someone, or whatever). but on the other hand, having them the access to delete it, if it was a thread that was mistakenly created, or what not. and also, just to quickly add to this idea if you will. there should be a way to have it selectable. say after 5 or 10 replies, that a thread is allowed to be deleted by the thread starter, from deleting the first post. after that number, it should then be disabled. that would be nice.
Reply With Quote
  #3  
Old 06-07-2003, 01:53 AM
warpeditor warpeditor is offline
 
Join Date: Nov 2001
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for reply.

One of our registered member deleted all the thread he created because he got upset with others reply/comments about his post. There even was some thread with 200+ replies but all gone. Then I thought this could be a good idea.

Any ideas?
Reply With Quote
  #4  
Old 06-08-2003, 02:50 PM
MetroSports82's Avatar
MetroSports82 MetroSports82 is offline
 
Join Date: Nov 2002
Location: NJ
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok, tell ya what.. i'm gonna try this again, even thought i came up flat out my face the first time. i'll let you know if i get anything to work properly, with the correct functions. in the meantime, this is the block of code that i will be working on, to see what needs to be tweaked around, to get this feature working.

- editpost.php -
PHP Code:
// ############################### start update post ###############################
if ($HTTP_POST_VARS['action']=="updatepost") {

  
// check for message
  
if ($message=="") {
    eval(
"standarderror(\"".gettemplate("error_nosubject")."\");");
    exit;
  }

  
// decode check boxes
  
$parseurl=iif($parseurl=="yes",1,0);
  
$email=iif($email=="yes",1,0);
  
$allowsmilie=iif($disablesmilies=="yes",0,1);
  
$signature=iif($signature=="yes",1,0);

  
$editedbysql="";
  if (
$showeditedby and $postinfo[dateline]<(time()-($noeditedbytime*60)) and !($getperms[ismoderator] and !$showeditedbyadmin)) {
    
$editedbysql=",edituserid='$bbuserinfo[userid]',editdate='".time()."'";
  }

  
// check max images
  
if ($maximages!=0) {
    
$parsedmessage=bbcodeparse($message,$threadinfo['forumid'],$allowsmilie);
    if (
countchar($parsedmessage,"<img")>$maximages) {
      eval(
"standarderror(\"".gettemplate("error_toomanyimages")."\");");
      exit;
    }
  }

  if (!isset(
$iconid) or $iconid=="") {
    
$iconid=0;
  }
  
$iconid=intval($iconid);

  if (
$parseurl) {
    
$message=parseurl($message);
  }

  
$attachmentsql="";
  if (
$postinfo[attachmentid]!=0) {
    
// check attachment status
    // keep, delete, update
    
if (trim($attachmentaction)=="delete") {
      
$attachmentsql=",attachmentid=0";
      
$DB_site->query("DELETE FROM attachment WHERE attachmentid=$postinfo[attachmentid]");
      
updatethreadcount($threadinfo[threadid]);
    }
    if (
trim($attachmentaction)=="new") {
            
// sort attachement
            
if (is_array($HTTP_POST_FILES)) {
                
$attachment $HTTP_POST_FILES['attachment']['tmp_name'];
                
$attachment_name $HTTP_POST_FILES['attachment']['name'];
                
$attachment_size $HTTP_POST_FILES['attachment']['size'];
            }
            if (
trim($attachment)!="none" and trim($attachment)!="" and trim($attachment_name)!="") {
                
$attachmentid=acceptupload($foruminfo[moderateattach]);
              
$attachmentsql=",attachmentid='$attachmentid'";
              
$DB_site->query("DELETE FROM attachment WHERE attachmentid=$postinfo[attachmentid]");
            }
    }
  }

  
// remove sessionhash from urls:
  
$message stripsession($message);

  
$title=censortext($title);
  
$message=censortext($message);

  if (
strlen($message)>$postmaxchars and $postmaxchars!=0) {
    eval(
"standarderror(\"".gettemplate("error_toolong")."\");");
  }

  
// find out if first post
  
$getpost=$DB_site->query_first("SELECT postid FROM post WHERE threadid=$threadinfo[threadid] ORDER BY dateline LIMIT 1");
  if (
$getpost[postid]==$postid) {
    
$isfirst=1;
  } else {
    
$isfirst=0;
  }
  if (
$isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
    
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."', iconid=".intval($iconid)." WHERE threadid=$threadinfo[threadid]");
    
//$title="";
  
}

  if (
$email) {
    if (!
$checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$postinfo[userid] AND threadid=$threadinfo[threadid]")) {
      
$DB_site->query("INSERT INTO subscribethread (subscribethreadid,userid,threadid) VALUES (NULL,$postinfo[userid],$threadinfo[threadid])");
    } 
// else : already subscribed, so no need to do that again
  
} else {
    if (
$checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$postinfo[userid] AND threadid=$threadinfo[threadid]")) {
      
$DB_site->query("DELETE FROM subscribethread WHERE userid=$postinfo[userid] AND threadid=$threadinfo[threadid]");
    } 
// else : already unsubscribed, so no need to unsubscribe
  
}

  
$DB_site->query("UPDATE post SET title='".addslashes(htmlspecialchars($title))."',pagetext='".addslashes($message)."',allowsmilie='$allowsmilie',showsignature='$signature',iconid='$iconid'$editedbysql$attachmentsql WHERE postid='$postid'");
  
unindexpost($postid);
  
indexpost($postid);

  eval(
"standardredirect(\"".gettemplate("redirect_editthanks")."\",\"showthread.php?s=$session[sessionhash]&postid=$postid#post$postid\");");
}

if (
$action=="deletepost") {
  if (
$deletepost=="yes") {
    
//get first post in thread
    
$getfirst=$DB_site->query_first("SELECT postid,dateline FROM post WHERE threadid='$threadid' ORDER BY dateline LIMIT 1");
    if (
$getfirst[postid]==$postid) {
      
// delete thread
      
if ($getperms[candeletethread]) {
        
deletethread($threadinfo[threadid],$foruminfo[countposts]);
        
updateforumcount($threadinfo[forumid]);
        eval(
"standardredirect(\"".gettemplate("redirect_deletethread")."\",\"forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]\");");
      } else {
        
show_nopermission();
      }
    } else {
      
//delete just this post
      
$foruminfo=getforuminfo($threadinfo[forumid]);
      
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);

      
updatethreadcount($threadinfo[threadid]);
      
updateforumcount($threadinfo[forumid]);

     eval(
"standardredirect(\"".gettemplate("redirect_deletepost")."\",\"showthread.php?s=$session[sessionhash]&threadid=$threadinfo[threadid]\");");
    }
  } else {
    eval(
"standardredirect(\"".gettemplate("redirect_nodelete")."\",\"showthread.php?s=$session[sessionhash]&postid=$postid#post$postid\");");
  }

hopefully for me anyway, the 2nd time around will be a charm. though i'm very pesimistic.. :disappointed:

Metro.
Reply With Quote
  #5  
Old 06-08-2003, 03:03 PM
warpeditor warpeditor is offline
 
Join Date: Nov 2001
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your interest, Metro!

Since I don't know php enough to do hack, I will just wait for you to come up with something then. Thanks again.
Reply With Quote
Reply

Thread Tools
Display Modes

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 02:38 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.03850 seconds
  • Memory Usage 2,263KB
  • 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
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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