PDA

View Full Version : [RELEASE] 'Save Copy' Move Hack


06-16-2000, 03:24 PM
Ok, it's the really simple, crappy version - sue me! :)

Not tested too much (only twice), but seemed to work relatively well.

postings.php, find:
$DB_site->query("UPDATE thread SET forumid=$forumid WHERE threadid=$threadid");

ABOVE it add:
if ($savecopy) {
$threadinfo=$DB_site->query_first("SELECT title,lastpost,forumid,open,replycount,postusernam e,lastposter,dateline,views,iconid,notes,visible,s ubjectindex,threadindex,userindex FROM thread WHERE threadid=$threadid");
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,lastposter,dateline,views,iconid,notes ,visible,subjectindex,threadindex,userindex) VALUES (NULL,'".addslashes("$threadinfo[title]")."','".addslashes("$threadinfo[lastpost]")."','".addslashes("$threadinfo[forumid]")."',0,'".addslashes("$threadinfo[replycount]")."','".addslashes("$threadinfo[postusername]")."','".addslashes("$threadinfo[lastposter]")."','".addslashes("$threadinfo[dateline]")."','".addslashes("$threadinfo[views]")."','".addslashes("$threadinfo[iconid]")."','".addslashes("$threadinfo[notes]")."','".addslashes("$threadinfo[visible]")."','".addslashes("$threadinfo[subjectindex]")."','".addslashes("$threadinfo[threadindex]")."','".addslashes("$threadinfo[userindex]")."')");
$newid=$DB_site->insert_id();
$posts=$DB_site->query("SELECT postid,threadid,username,userid,title,dateline,pag etext,allowsmilie,email,signature,ipaddress,iconid ,visible FROM post WHERE threadid=$threadid");
while ($post=$DB_site->fetch_array($posts)) {
$DB_site->query("INSERT INTO post (postid,threadid,username,userid,title,dateline,pa getext,allowsmilie,email,signature,ipaddress,iconi d,visible) VALUES (NULL,'$newid','".addslashes("$post[username]")."','".addslashes("$post[userid]")."','".addslashes("$post[title]")."','".addslashes("$post[dateline]")."','".addslashes("$post[pagetext]")."','".addslashes("$post[allowsmilie]")."','".addslashes("$post[email]")."','".addslashes("$post[signature]")."','".addslashes("$post[ipaddress]")."','".addslashes("$post[iconid]")."','".addslashes("$post[visible]")."')");
}
}

find:
$DB_site->query("UPDATE forum SET replycount=$numberposts,threadcount=threadcount-1,lastpost=$lastpost,lastposter='".addslashes($lastposter)."' WHERE forumid=$curforumid");

REPLACE with:
if (!$savecopy) {
$DB_site->query("UPDATE forum SET replycount=$numberposts,threadcount=threadcount-1,lastpost=$lastpost,lastposter='".addslashes($lastposter)."' WHERE forumid=$curforumid");
}

find:
eval("echo standardredirect(\$bbtitle,\"".gettemplate("redirect_movethread")."\",\"showthread.php?threadid=$threadid\");");

REPLACE with:
if ($savecopy) {
eval("echo standardredirect(\$bbtitle,\"".gettemplate("redirect_movethread")."\",\"showthread.php?threadid=$newid\");");
} else {
eval("echo standardredirect(\$bbtitle,\"".gettemplate("redirect_movethread")."\",\"showthread.php?threadid=$threadid\");");
}

-----
Close that.

Now, in your move template, add this somewhere:
<TD><INPUT TYPE="checkbox" NAME="savecopy" value="yes">&nbsp;&nbsp; <normalfont>Do you want to save a copy of this message (but closed) in its original forum?</normalfont></td>

----
That's it, you should be done.
Maybe not efficient, but it works :)

BTW, sorry there's no note on the page - I don't feel like adding a whole column to the database for that :D

[Edited by Ed Sullivan on 06-17-2000 at 11:01 PM]

06-16-2000, 03:40 PM
Thank you :)


I will try it shortly.

06-17-2000, 05:54 AM
Ed, now how about the extended hack version, whereby the icon changes to "moved.gif" and the link of that thread in fact is linked to the new position of the thread? :)

06-17-2000, 06:00 AM
I get a parse error on this line:

$DB_site->query("INSERT INTO post (postid,threadid,username,userid,title,dateline,pa getext,allowsmilie,email,signature,ipaddress,iconi d,visible) VALUES (NULL,'$newid','".addslashes("post[username]")."','".addslashes("post[userid]")."','".addslashes("post[title]")."','".addslashes("post[dateline]")."','".addslashes("post[pagetext]")."','".addslashes("post[allowsmilie]")."','".addslashes("post[email,'".addslashes("post[signature]")."','".addslashes("post[ipaddress]")."','".addslashes("post[iconid]")."','".addslashes("post[visible]")."')");

06-17-2000, 01:59 PM
Doh! Sorry, copied the wrong code. That line should read:
$DB_site->query("INSERT INTO post (postid,threadid,username,userid,title,dateline,pa getext,allowsmilie,email,signature,ipaddress,iconi d,visible) VALUES (NULL,'$newid','".addslashes("$post[username]")."','".addslashes("$post[userid]")."','".addslashes("$post[title]")."','".addslashes("$post[dateline]")."','".addslashes("$post[pagetext]")."','".addslashes("$post[allowsmilie]")."','".addslashes("$post[email]")."','".addslashes("$post[signature]")."','".addslashes("$post[ipaddress]")."','".addslashes("$post[iconid]")."','".addslashes("$post[visible]")."')");

bira - I haven't studied the tables, but unfortunately, I'm a littled limited in what I can do without adding a field. Maybe, but it's low on my to do list :D

06-17-2000, 02:03 PM
Ok, fixed the aforementioned mistake in my original code and added another search and replace (if (!$savecopy) {). Not a HUGE deal if you don't add it, but you're counters will be off then :D

06-17-2000, 04:48 PM
Thanks! Works like a champ now.

06-17-2000, 05:30 PM
Yes it does, thank you again :)

08-03-2000, 09:54 PM
woah... hard to follow a bit... thought i'd bring it back up a bit :)

08-03-2000, 10:23 PM
hmmm.. it didn't work ? no thread was saved in the original forum ?

okay i have hacks installed? could that be the problem ?

i have the location/interest hack, search result hack and avatar hack

08-03-2000, 10:25 PM
Well, not, really as this hack touches the post/thread/forum tables and all the hacks you have installed don't go there.

08-03-2000, 10:31 PM
I'll try this a little later and get back to you eva.

08-03-2000, 10:33 PM
thanks guys... for now i reverted back to my original posting.php file and commented out the entry in move template for now

08-04-2000, 02:19 AM
looks like I'm not gonna be able to try it out till tomorrow, and when I do I'll *probably* take a crack at the damned PM hack too eva, so I'll tell you how that goes

08-04-2000, 12:55 PM
Well..

It moves the files and copies it now but I still would like for the old file that is copied to now act as a link to the new location so that when someone goes to click on this now closed topic it takes them to the area it got moved to.

Thanks,
Parker

08-04-2000, 02:00 PM
huh... :( doesn't do that for me, it just moves the thread like it originally did...

well i have finally set up my test forum so can test it a bit more

08-08-2000, 11:30 PM
Now that I have a working board, is there anyway you can get this working?? Pretty please???? :D :D :D

08-14-2000, 08:55 AM
Ed:

Just want to revisit this. Any ideas on how to make the old topic, that is now closed, a link to the new topic are that it got moved to? Or if this isn't possible how about a message that gets put in the old topic that says something like "This topic as been moved. Click here to go to the new area it has been moved to" or similar.

Parker

08-14-2000, 10:27 AM
yeah... i nearly forgot about this must need feature... will the next release have this ?

08-18-2000, 02:58 AM
What is the progress on this one? Did anyone hear if John is going to be including this in the next version or the script or what?

Speaking of John I haven't seen anything from him in several weeks. I know he was gone but when does he get back?

Parker

08-18-2000, 03:08 AM
probably the same time as the next release :)

08-18-2000, 02:40 PM
Ed:

Is there anyway you can take the code that you've written above and when it closes the thread it changes the link to the now closed thread to be the same as the saved copy?

Parker

08-18-2000, 03:48 PM
Again just use what we were talking about for leaving a note when closing a thread, just change the message to indicate the address of our new thread...

08-19-2000, 06:44 PM
I hope there are two options£º
1.save a copy of this message (but closed) in its original forum
2.save a copy this message (keep topic open) in its original forum after moving

I think the second option is useful when an user move a thread to an archive forum.

How to hack the code?

Thanks in advance.

08-24-2000, 12:40 PM
where is the demo ?

08-24-2000, 02:55 PM
well i never got this to work at all.... all it did was move the thread like it did normally :(

09-01-2000, 04:23 AM
any updates ? I tried again to do this but it doesn't work at all ? can someone check my postings.php file ?

[Edited by eva2000 on 09-01-2000 at 02:22 AM]

09-21-2000, 05:38 AM
A good thing also, but I think kind of hard, is to move the thread to the new location and leave the original one open. And at the same time post any reply to BOTH of the threads.

Do you think its possible?

11-19-2000, 09:35 PM
Will this work with 1.1.4?

wanted to know before i installed it :)

11-20-2000, 12:55 PM
Should

11-20-2000, 02:02 PM
It does work ... But it would be very nice if we could combine it with the PM hack so that it will automaticly send a PM to the starter of the thread informing him/her about this:
"Your thread sent on X date has been moved from X forum to X forum"

Thanks

Evoir
04-08-2001, 12:33 AM
I am trying to get this to work on VB 1.16

I can't find one of the lines...I am wondering if it changed.

the line is:

eval("echo standardredirect(\$bbtitle,\"".gettemplate("redirect_movethread")."\",\"showthread.php?threadid=$threadid\");");

The closet thing I could find in postings.php is this:
eval("echo standardredirect(\$bbtitle,\"".gettemplate("redirect_movethread")."\",\"showthread.php?threadid=".intval($threadid)."\");");

would that be the code I replace? And if it is, It hasn't worked for me. What happens is when I click on any of the admin options in showthread, I get an error that says: "Document contained no data"