PDA

View Full Version : Attachmentstyle, choose where to place your Attachments


MrNase
03 Oct 2004, 20:44
Hello,

Some of you have used eBay before. On every auction you can select where the pictures you have uploaded should be displayed.
Since many of us use the vB attachment function to publish pictures there should be the possibility of doing exactly the same thing with your attachments. :)

This hack allows you (and your users) to select wether the attachments should be displayed:

* At the end of your posting (vB3 default setting)
* Above your posting
* At the left hand side of your posting

This hack is using phrases so it's very easy to translate.
The setting can be changed for every post so you can decide which one is the best for your attachments.

Why is this hack 'beta'?
Well, it works.. But is has only been tested by me ;)
It has no installer yet and the markup could be a bit better but I hope you'll help me with that.

Is there an Online Demo?
No I don't think so but I'll provide you with screenshots :)


Have fun with it and please help me fixing errors so that this hack can be moved to 'Full Releases' as soon as possible :)


THIS HACK IS BETA..! PLEASE BACKUP YOUR DATABASE :devious:

http://www.vbulletin.org/forum/images/smoothblue/buttons/installed.gif (http://www.vbulletin.org/forum/vborg_miscactions.php?do=installhack&threadid=70142)

Changes:
* Instructions are updated to v.02 and nexialys' Fix is in. Thank you :)
* Instructions are updated again and the current version is V0.3 :)

Natch
03 Oct 2004, 22:15
This is a very good idea: well structured...

Nice job!

Bryan Ex
03 Oct 2004, 23:31
I was anoyed by that exact issue just last night. Right on!

nexialys
03 Oct 2004, 23:33
@Mr Nase.. the default language id is not 0, but -1...

so it is

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

FleaBag
03 Oct 2004, 23:39
This is awesome - when I finally upgrade I'll install!

MrNase
04 Oct 2004, 05:47
Thank you nexialys, I updated the instructions. :)

jugo
05 Oct 2004, 18:25
Beautiful!!!

/me Installs and does a backflip.

NuclioN
11 Oct 2004, 17:48
This error after a new post:

Invalid SQL:
INSERT INTO thread(title, lastpost, forumid, open, replycount, postusername, postuserid, lastposter, dateline,
iconid, visible, attach, attachstyle, similar)
VALUES
('test334', 1097513223, 22,
1, 0, 'name', 1,
'name', 1097513223, 0, 1,
1, '')

mysql error: Column count doesn't match value count at row 1

MrNase
12 Oct 2004, 14:41
Are you sure you made the database modification?

You need to do that by using the following query:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



And (important!!):
You may have to replace post with vb3_post or something like that according to the database prefix you have chosen during the installation.

NuclioN
12 Oct 2004, 14:43
Yes, the db modifications are correct. Also i've no prefix for the tables. :(

In editpost.php there are 2 lines of this code:
attach = attach + $newattachments

The first one is for 'UPDATE " . TABLE_PREFIX . "thread SET..'

The second one is in here:

UPDATE " . TABLE_PREFIX . "post
SET title = '" . addslashes(htmlspecialchars_uni($edit['title'])) . "',
pagetext = '" . addslashes($edit['message']) . "',
allowsmilie = $edit[allowsmilie],
showsignature = $edit[signature],
iconid = $edit[iconid],
attach = attach + $newattachments
WHERE postid = $postid
");

MrNase
12 Oct 2004, 14:50
Well ok, give me a couple of minutes. Iam rewriting the instructions :)


The Instructions are up-to-date. You should read them again, I changed the lines for functions_newpost.php and editpost.php and now it should work for you.
You are right, you need to replace the second one both in editpost.php and functions_newpost.php (where it says: INSERT INTO " . TABLE_PREFIX . "post and not INSERT INTO " . TABLE_PREFIX . "thread)

Excuse me, I thought nobody would edit the files with a simple texteditor which has no numbered lines :)

NuclioN
12 Oct 2004, 15:28
Ok tnx :) I'll try it and report asap

xug
12 Oct 2004, 15:32
Very cool job :thumbsup:

NuclioN
12 Oct 2004, 15:42
Hm..same errors remain in new post and reply ..

MrNase
12 Oct 2004, 20:00
Well I checked the instructions twice and I couldn't find any error. The others didn't say it doesn't work so I don't know what has gone wrong with your installations.

Do you have a backup of editpost.php and functions_newpost.php? Take the old files and modify them again to make sure you have the right code. You could even send those files to me and I'll take a look at it. Use dienase [at] gmail.com please :)

NuclioN
12 Oct 2004, 20:08
Actually i did just that, doing the hack over again by the new instructions. There is no feedback from others if this is working or making an error somewhere. I will send unmodified editpost and functions_newpost.php if it takes to long to look if it works by others.

MrNase
15 Oct 2004, 19:10
Hello and sorry for the late reply. Iam sick and try to stay at home and not in the office :)
I can't see why it doesn't work for you, I tested my installation with your files and it worked perfectly. What happens if you run the query again?

The others: Please reply and tell me if it's working for you :)

nexialys
01 Nov 2004, 16:32
@MrNase ... http://www.vbulletin.org/forum/showthread.php?t=71247

MrNase
02 Nov 2004, 01:59
Hey very cool, I've been on vacation and couldn't check vb.org but I like what i see :)


So does that hack work for you? NuclioN had some trouble with it and I couldn't find any error :(

nexialys
02 Nov 2004, 03:18
if i installed it and made a hack for it, i suppose it's because it's working.. ;)

btw, i don't know if it's your tool or the other, but i see a icon instead of the thumbnail on that blocks...

mrcancel
06 Nov 2004, 01:06
if i using postbit_legacy template then i can how make ?

nexialys
06 Nov 2004, 01:11
same thing, the postbit/postbit_legacy are built the same way.. you search the same detail, replace it the same way...

mrcancel
06 Nov 2004, 01:24
no, i see postbit_legacy ! but in beetween <!-- / icon and title --> and <if condition="$post['signature']"> is :


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

nexialys
06 Nov 2004, 03:41
this is what you have to change... did you compared with the original postbit ?!
is your style modified or personalised ?!

mrcancel
06 Nov 2004, 11:59
now i can how change it ??? help me !

Nordinho
03 Feb 2005, 15:32
the hacks works great, but for 1 thing, if a new thread is posted, it doesn't check the default checkbox, so the attachment doesn't show...where would I change the default value??

Nordinho
01 Mar 2005, 15:21
the hacks works great, but for 1 thing, if a new thread is posted, it doesn't check the default checkbox, so the attachment doesn't show...where would I change the default value??

bump

YLP1
25 Apr 2005, 21:28
Oh boy....I really did it this time.... I installed this mod but couldn't post without getting a error that gave me this error:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




So I uploaded my backup copies of the files that I altered for this mod.

Now I can post but I cannot edit as this is the error I get:




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Please can someone help me fix this... I know I shouldn't have tried it as it was beta but I was desperately needing the ability to place attachments.

I have already beat myself with a wet noodle.

Thanks in advance for any help I can get .

Marco van Herwaarden
25 Apr 2005, 23:21
look like you didn't restore the backup of editpost.php

htscpl
18 Aug 2005, 14:13
I am getting the same error as reported above:
Database error in vBulletin 3.0.7:

Invalid SQL: SELECT attachstyle FROM post WHERE postid = 1258
mysql error: Unknown column 'attachstyle' in 'field list'

mysql error number: 1054

Date: Thursday 18th of August 2005 06:14:09 AM

Is this hack still supported ? I could use some help with it. :(