PDA

View Full Version : Add Attachment on Edit Post


Tommy Boy
12-30-2001, 10:00 PM
After installing this hack, you will be able to post new attachment when editing posts, even if these posts did not have a prior attachment.

(Version 1.1 is updated for vBulletin 2.2.4 - No need to update if you're running vBulletin 2.2.3b or lower).

Admin
12-31-2001, 04:18 PM
Well well well, works like a charm.

sphinx
12-31-2001, 04:26 PM
thanks for sharing m8 nice hack

squawell
12-31-2001, 04:30 PM
it's work for my forum~

thankz Tommy Boy:D

ptbyjason
12-31-2001, 04:35 PM
Works for 2.03 too. :D Thank you, needed this just this morning. I had to delete a post and repost it because I didn't have this. Thanks Tommy Boy.

Lesane
12-31-2001, 04:49 PM
Nice hack, thanks

DarkReaper
12-31-2001, 04:51 PM
Nice and easy. Good job :)

Want to make one that allows multiple attachments on one post, and would work similar to the way you can change the number of options on a poll? :)

Lucky
12-31-2001, 08:56 PM
Works like a charm!

Tommy Boy
12-31-2001, 09:39 PM
Originally posted by DarkReaper
Nice and easy. Good job :)

Want to make one that allows multiple attachments on one post, and would work similar to the way you can change the number of options on a poll? :) It is doable, but I don't know if it's worth the trouble, since there is a good chance that this will be included in version 3...

BTW: Thanks everybody for your feedback! :D

// Edit: Yay!! I see you even installed it on this board! I'm honored, Chen! :p

Island Roots
12-31-2001, 10:19 PM
Hmmmm....everything looks fine...there's a field to add an attachment now when editing a post, but the attachment doesn't show up. :confused:

Nevermind....I just added the last part after the first piece of code...I didn't realize there were two lines of that code. :D Cool hack.

fonzerelli_79
01-01-2002, 10:04 AM
great hack

cheers

over
01-03-2002, 11:16 AM
extremely useful hack cheers :)
i keep 4getting to post attachments on my board sometimes, no more del thread resport for me :D

DarkReaper
01-03-2002, 06:39 PM
I think it'd be worth it...vB3 is a ways off(isn't it? :))

nopain
01-04-2002, 12:36 AM
hi all

YES - now it is possible to add a new attachment to a thread which hasn't got one ...

BUT - if you want to exchange an existing one - this code change doesn't work ... it only exchanges the name of the attachment, but if you klick on it you'll still get the old (previous one)

can you please check again?

THANX A LOT from vienna!

NoPain

nopain
01-04-2002, 12:36 AM
hi all

YES - now it is possible to add a new attachment to a thread which hasn't got one ...

BUT - if you want to exchange an existing one - this code change doesn't work ... it only exchanges the name of the attachment, but if you klick on it you'll still get the old (previous one)

can you please check again?

THANX A LOT from vienna!

NoPain

Tommy Boy
01-04-2002, 12:42 AM
Originally posted by nopain
if you want to exchange an existing one - this code change doesn't work ... it only exchanges the name of the attachment, but if you klick on it you'll still get the old (previous one)
This problem is not related to my hack. However, I have written another hack to fix it. Unfortunately, it hasn't been installed on this board (yet?).

You can find it here (https://vborg.vbsupport.ru/showthread.php?threadid=33747).

nopain
01-04-2002, 12:59 AM
THX!!!

cash problem is solved now.

Tommy Boy
01-04-2002, 01:12 AM
Originally posted by nopain
THX!!!

cash problem is solved now. I think you mean cache... :D

Stretchr
01-16-2002, 05:41 PM
And if you DIDN'T, let us in on the secret! :D
Originally posted by Tommy Boy
I think you mean cache... :D

Stretchr
01-16-2002, 05:48 PM
They kind of compliment each other so I installed both! Thanks, Tommy.
:up:
Originally posted by Tommy Boy

This problem is not related to my hack. However, I have written another hack to fix it. Unfortunately, it hasn't been installed on this board (yet?).

You can find it here (https://vborg.vbsupport.ru/showthread.php?threadid=33747).

jminiman
02-23-2002, 01:39 AM
Does this work under vB v2.2.2? I applied exactly as specified, and attaching a file does nothing.

neal
03-03-2002, 10:42 PM
works perfect, no problems, thanks

x28
03-04-2002, 01:49 AM
works for 2.2.2

But after edit it did not update as like a reply would.
Is there a way to bring to the front like a reply?

Jadelit
03-13-2002, 01:38 AM
does this work with 2.2.4?

Jadelit
03-13-2002, 02:09 AM
Well I dunno about other people but this hacked rocked.. well I did a little edit for it, to work for vbulletin 2.2.3 - 2.2.4 on a Reverted Template System, or fresh install..

Credits go to Tommy..

Tommy Boy
03-13-2002, 11:53 AM
I believe the hack works fine on version 2.2.4 as well, without this modification...?

Jadelit
03-13-2002, 01:41 PM
no it doesn't, if smart people would revert there templates to the original form, and then remake their style.. So you can get the full benifit of the upgrade..

John also recommends this..


Changed Templates

Note: Upgrading will not overwrite any of your custom templates. If you have customized any template that is listed as 'modified' below, we seriously recommend using the 'revert' option to return them to the default template, then re-applying your customizations.



Ok well thats juts my 2 cents..

Tommy Boy
03-14-2002, 10:56 AM
The code you are changing back, is actually part of the update of vBulletin, and is part of an important security fix. Reverting it back to its previous state, may endanger you and your users, as you are open to the PHP vulnerability regarding file uploads.

Therefore, you should leave the the editpost template untouched. vBulletin know what they're doing, and it doesn't affect this hack at all. You will have to apply the changes to the editpost.php file of course, but leave the template untouched.

nafae
03-15-2002, 01:09 AM
Does anyone know how to make this hack work with 2.2.4 then? Or is it lost in the wild blue yonder...

Axel Foley
03-15-2002, 09:24 PM
I applied the ORIGINAL hack on 2.2.4 and it doesn't work. The attach file field comes up and I attach the file, but it doesn't come up. The effect seems like it doesn't get uploaded at all (too fast when submitting).

Tommy please take a look at it, this hack will be really useful when I'll get it to work.

Thanks...

Tommy Boy
03-15-2002, 10:42 PM
Seems like you're right, I was under the impression that the new version of vBulletin doesn't affect the hack, but apparently it does.

Therefore, I have updated the attachment in the first post. It is now compatible with version 2.2.4.

nafae
03-15-2002, 11:01 PM
thanks!

Axel Foley
03-16-2002, 07:45 PM
Thanks for the fix Tommy, and thanks for the great hack...

For everyone who wanted to know, v1.1 of this hack *WORKS* on vB 2.2.4.

E
03-20-2002, 06:57 PM
Works great, Thanks!

Tommy Boy
03-20-2002, 09:09 PM
Freddie said it will be built-in in vB3! Isn't that great? :)

Pipplo
05-07-2002, 09:56 AM
Work fine on vb 225 but i have notice a little problem .In the thread table the "attach" field is not update
when i make a new attachment (using this hack on a old post without attachment) .If i open a new thread without
attachment and i attach a new file , the icon "paperclip.gif"
is not showed in the forumdisplay near the thread title but the attachment now is in the thrad .
Can you help me please ? :)

Preasidium
05-12-2002, 05:49 PM
Hi,
I opened the txt file and was about to edit my template and founf out there is no string

require("./global.php");

So exactly what do i do now?

I am also useing the php3 set. So i inserted it like so in the search and still nothing

require("./global.php3");

I even looked threw the entire thing myself. Now im lost :(

X-Fan
06-19-2002, 08:57 AM
Preasidium, you need to edit the editpost.php file, not the template.

SaintDog
06-25-2002, 01:24 PM
Anyone have this updated for 2.2.6? I noticed there are some changed within its coding.

- SaintDog

Hellburn
07-03-2002, 08:56 AM
i can not found this part on vB 2.2.6. Please help me.

if (function_exists('ini_get')) {
if (ini_get('file_uploads')) {
$enctype = 'enctype="multipart/form-data"';
}
} else if (get_cfg_var('file_uploads')) {
'enctype="multipart/form-data"';
}

Hellburn
07-03-2002, 10:25 AM
oki i have fixed the hack for 2.2.6.

Mystics
07-06-2002, 03:40 PM
Hi,

the Hack doesn't update the attachment count of the thread, so if there was no attachment before in this thread, the paperclip icon does not show up in the thread list of a forum.

To fix this, you have to do this change, after installing the Hack:

Search in editpost.php: // Add attachment on edit post hack (start)
elseif (trim($attachment)!="none" and trim($attachment)!="" and trim($attachment_name)!="")
{
$attachmentid=acceptupload($foruminfo[moderateattach]);
$attachmentsql=",attachmentid='$attachmentid'";and add below it: $DB_site->query("UPDATE thread SET attach = attach + 1 WHERE threadid='$threadinfo[threadid]'");Mystics

PhotoGenie
07-08-2002, 03:53 AM
I'm a little confused in the directions.

Still in editpost.php, look for: [vBulletin 2.2.6 and up ONLY!]
--------------------------------------------------------------------------------
if (phpversion() < '4.0.3') {
$enctype = 'enctype="multipart/form-data"';
} else if (ini_get('file_uploads')) {
$enctype = 'enctype="multipart/form-data"';
} else {
--------------------------------------------------------------------------------

Move this block a few lines up, just after this line:
--------------------------------------------------------------------------------
$enctype = '';

Am I supposed to remove the text above " $enctype = ''; " and then put it back in below it?

Harley-1
07-08-2002, 09:49 AM
me too... can you give us a newbie hint?:D

Mystics
07-08-2002, 02:03 PM
@PhotoGenie
@Harley-1

Just ignore this step! It's no longer necessary since vB 2.2.6. :)

I have attached the final version for 2.2.6 with my Bugfix (see Posting above).

Mystics

PhotoGenie
07-08-2002, 04:31 PM
That was easy enough.. Thank you!!.. This is a very good practical hack.

eoc_Jason
07-20-2002, 11:56 PM
After comparing the code that Mystics posted vs. the other code for 2.2.6, I went with Mystics. I dug around in other files and couldn't find where it would add to the attachment count, so that's why I used his. If this is incorrect someone post another update. ;) :bunny:

Originally posted by Mystics
@PhotoGenie
@Harley-1

Just ignore this step! It's no longer necessary since vB 2.2.6. :)

I have attached the final version for 2.2.6 with my Bugfix (see Posting above).

Mystics

Tim Wheatley
08-03-2002, 12:59 AM
<a href="https://vborg.vbsupport.ru/attachment.php?s=&postid=270639" target="_blank">https://vborg.vbsupport.ru/attac...&postid=270639</a>
Works perfect here: 2.2.6.

Schorsch
08-08-2002, 04:11 AM
* Schorsch says Thank you very much Tommy Boy and Mystics :)

Mystics
12-09-2002, 01:54 PM
I have updated my attachment.

The canpostattachment-permission was not checked while editing a posting.

Thanks @Axel Foley for pointing this out.

Mystics

Axel Foley
12-09-2002, 09:35 PM
Originally posted by Mystics
I have updated my attachment.

The canpostattachment-permission was not checked while editing a posting.

Thanks @Axel Foley for pointing this out.

Mystics

I disagree...:D

I only discovered a bug, like you discovered the attach counter update problem on Tommy Boy's code...;)

I think Tommy Boy deserves our thanks for the hack...good job.

I guess this is what this forum is here for...to help each other.

Ciao...

indiamike
02-22-2003, 10:41 AM
Has anyone updated this hack for 2.2.9 and up.


In the instructions after the $DB_site->query part in editpost.php (I am refraining from posting the code ) it shows to post the code after the second closing tag. Using 2.2.9 there is a few lines about "sort attachment" after the first closing tag.

Should this code be added after the second closing tag after the sort attachment part or before it or somewhere in between?

Mike

....ps...hope this makes sense

TexasOutdoors
02-23-2003, 10:04 PM
I used the code that Mystics posted with vbulletin 2.2.9 and it works fine.

indiamike
02-23-2003, 11:12 PM
gotcha...I should have better attention reading through all the threads.

Thanks

Red Blaze
04-09-2003, 04:59 AM
Some one asked me about this one. Works fine with me. :)

* Red Blaze clicks install ^_^

msimplay
05-11-2003, 12:31 PM
works fine on vbulletin 2.30 release candidate 3

padblaz
05-23-2003, 06:29 AM
works better for me with updated version of this hack :p
thanks again for this great hack

JohnK
01-22-2004, 12:47 PM
Thanks :D