PDA

View Full Version : a small modification


TaP
07-17-2002, 07:12 AM
ok... i want to modify the close thread button but i want it not to close the thread just update the extra stuff i added to the code



// ############################### update ###############################
if ($action=="openclosethread2") {

$threadid=verifyid("thread",$threadid);

$threadinfo=getthreadinfo($threadid);

if (!ismoderator($threadinfo[forumid],"canopenclose")) {
$permissions=getpermissions($threadinfo[forumid]);
if (!$permissions[canview] or !$permissions[canopenclose]) {
show_nopermission();
} else {
$firstpostinfo=$DB_site->query_first("SELECT userid FROM post WHERE threadid='$threadid' ORDER BY dateline LIMIT 1");
if ($bbuserinfo[userid]!=$firstpostinfo[userid]) {
show_nopermission();
}
}
}

updateuserforum($threadinfo['forumid']);

if ($threadinfo[open]) {
if($reasonentered==1) {
$threadinfo[open]=0;
} else {
eval("dooutput(\"".gettemplate("update")."\");");
exit;
}
} else {

$threadinfo[open]=1;
$action="open";
}
$threadinfo[notes] = "Thread $action by $bbuserinfo[username] on ".vbdate($dateformat." ".$timeformat,time()).". $threadinfo[notes]";
if($threadinfo[open]==0) {
$closereason=" closereason='".addslashes($reason)."',who='".addslashes($bbuserinfo[username])."',time='".addslashes($postinfo[posttime])."', ";
} else {
$closereason="";
}
$DB_site->query("UPDATE thread SET ".$closereason." open=$threadinfo[open],notes='".addslashes($threadinfo[notes])."' WHERE threadid='$threadid'");

eval("standardredirect(\"".gettemplate("redirect_openclose")."\",\"showthread.php?s=$session[sessionhash]&threadid=$threadid\");");

}



what would i change in there to make it soo it doesnt close the thread but performs all other actions??

thanks for your help on this one

Xenon
07-17-2002, 08:37 AM
if ($threadinfo[open]) {
if($reasonentered==1) {
$threadinfo[open]=0;

change this part to if ($threadinfo[open]) {
if($reasonentered==1) {
$threadinfo[open]=1;
and the thread wouldn't be closed

but also the reason wouldn't be altered anymore.
so you have to change this line to:
if($threadinfo[open]==0) {

TaP
07-17-2002, 04:57 PM
what do i change the second line to?

Xenon
07-17-2002, 11:03 PM
you can replace the whole block if($threadinfo[open]==0) {
$closereason=" closereason='".addslashes($reason)."',who='".addslashes($bbuserinfo[username])."',time='".addslashes($postinfo[posttime])."', ";
} else {
$closereason="";

with this one line:
$closereason=" closereason='".addslashes($reason)."',who='".addslashes($bbuserinfo[username])."',time='".addslashes($postinfo[posttime])."', ";

TaP
07-18-2002, 12:49 AM
ok it didnt close it but it also didnt put the message on the board

TaP
07-18-2002, 12:52 AM
would this code have any thing to do why its not working



Find:
if ($thread[open]) {
$replyclose="{replyimage}";
} else {
$replyclose="{closedthreadimage}";
}


Replace with:
if ($thread[open]) {
$replyclose="{replyimage}";
$closereason="";
} else {
$replyclose="{closedthreadimage}";
if (trim($thread[closereason])) {
$thread[closereason]=bbcodeparse2($thread[closereason],0,1,1,1);
eval("\$closereason = \"".gettemplate("update")."\";");
} else {
$closereason = "";
}
}

Xenon
07-18-2002, 10:28 AM
sure your templates are correct?

whats your upgrade template aso.

also you don't use the newest version of the reason hack ;)

TaP
07-18-2002, 10:49 AM
can you point me to the newest version?

TaP
07-18-2002, 10:51 AM
btw... im trying to do something like this

https://vborg.vbsupport.ru/showthread.php?s=&threadid=41089

Xenon
07-18-2002, 10:51 AM
<a href="https://vborg.vbsupport.ru/showthread.php?postid=264907#post264907" target="_blank">https://vborg.vbsupport.ru/showt...907#post264907</a>

TaP
07-18-2002, 10:54 AM
what did you think about my other idea? could ya fix the code up so it does that?