PDA

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


MrNase
10-02-2004, 10:00 PM
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:

https://vborg.vbsupport.ru/ (https://vborg.vbsupport.ru/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
10-03-2004, 08:15 PM
This is a very good idea: well structured...

Nice job!

Bryan Ex
10-03-2004, 09:31 PM
I was anoyed by that exact issue just last night. Right on!

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

so it is INSERT INTO `phrase` VALUES ('', -1, 'attachstyle', 'Attachment Style:', 1);

FleaBag
10-03-2004, 09:39 PM
This is awesome - when I finally upgrade I'll install!

MrNase
10-04-2004, 03:47 AM
Thank you nexialys, I updated the instructions. :)

jugo
10-05-2004, 04:25 PM
Beautiful!!!

/me Installs and does a backflip.

NuclioN
10-11-2004, 03:48 PM
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
10-12-2004, 12:41 PM
Are you sure you made the database modification?

You need to do that by using the following query:

ALTER TABLE `post` ADD `attachstyle2` TINYINT( 2 ) DEFAULT '1' NOT NULL;

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
10-12-2004, 12:43 PM
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
10-12-2004, 12:50 PM
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
10-12-2004, 01:28 PM
Ok tnx :) I'll try it and report asap

xug
10-12-2004, 01:32 PM
Very cool job :thumbsup:

NuclioN
10-12-2004, 01:42 PM
Hm..same errors remain in new post and reply ..

MrNase
10-12-2004, 06:00 PM
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
10-12-2004, 06:08 PM
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
10-15-2004, 05:10 PM
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
11-01-2004, 02:32 PM
@MrNase ... https://vborg.vbsupport.ru/showthread.php?t=71247

MrNase
11-01-2004, 11:59 PM
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
11-02-2004, 01:18 AM
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
11-05-2004, 11:06 PM
if i using postbit_legacy template then i can how make ?

nexialys
11-05-2004, 11:11 PM
same thing, the postbit/postbit_legacy are built the same way.. you search the same detail, replace it the same way...

mrcancel
11-05-2004, 11:24 PM
no, i see postbit_legacy ! but in beetween <!-- / icon and title --> and <if condition="$post['signature']"> is :
<td><img src="$stylevar[imgdir_misc]/pcon.gif" border="0" /></td>
<td width="100%" background="$stylevar[imgdir_misc]/pbg2.gif" align="right"><a href='Warn.php?do=WarnUser&id=$post[userid]&post=$post[postid]'>Cảnh c?o $post[musername]</a> ? <a href='Warn.php?do=ViewWarnings&id=$post[userid]'>Xem cảnh c?o của $post[musername]</a><if condition="$show['postcount']"><font color="#FFFFFF">#</font><a href="showpost.php?$session[sessionurl]p=$post[postid]&amp;postcount=$post[postcount]" target="new"><strong><font color="#FFFFFF">$post[postcount]</font></strong></a> &nbsp;</if></td><td background="$stylevar[imgdir_misc]/pbg2.gif" align="right"><img src="$stylevar[imgdir_misc]/postl.gif" border="0" /></td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF" align="center"><tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td background="$stylevar[imgdir_misc]/sd.gif"><img src="$stylevar[imgdir_misc]/sd.gif" border="0" /></td>
</tr>
</table>
<table width="148" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="5" border="0" /></td>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="5" border="0" /></td>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="5" border="0" /></td>
</tr>
<tr>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
<td><img src="$stylevar[imgdir_misc]/tbit.gif" border="0" /></td>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
</tr>
<tr>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
<td align="center" background="$stylevar[imgdir_misc]/tbitbg.gif">
<if condition="$post['rank']"><div class="smallfont">$post[rank]</div></if>
<img src="images/abc/$post[usergroupid].gif"><br> <if condition="$show['avatar']"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$avatarurl" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" $style_avatar /></a></if>

<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#94979D" width="100%">
<tr>
<td width="100%" align="center">
<table border="0" width="90%" cellspacing="0" cellpadding="2">
<tr>
<td width="100%" bgcolor="#FFFFFF">
<font face="Tahoma">
<font face="verdana,arial,helvetica" size="1" ><b><font size="1">
<if condition="$post['uttstore_glow']"><div id="postmenu_$post[postid]" style="width:100%; filter:Glow(color=$post[uttstore_glow], strength=5);"><else /><div id="postmenu_$post[postid]"></if>
<if condition="$show['profile']">
<a href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a>
<script type="text/javascript"> vbmenu_register("postmenu_$post[postid]", true); </script>
<else />
$post[musername]
</if>
</div></font></b></font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td width="100%" align="center">
<table border="0" width="90%" cellpadding="2">
<tr>
<td width="100%" bgcolor="#FFFFFF">
<font face="verdana,arial,helvetica" size="1" ><b><font size="1" face="Tahoma"><font color="#183562"></font><font color="#183562"> <if condition="$post['usertitle']">$post[usertitle]</if></font> </font></b></font></td>
</tr>
</table></td>
</tr>
<tr>
<td width="100%" align="center">
<table border="0" style="border-collapse: collapse" bordercolor="#94979D" width="90%" cellpadding="2">
<tr>
<td width="100%" bgcolor="#FFFFFF">
<b>Tham gia: $post[joindate] </b> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="100%" align="center">
<table border="0" style="border-collapse: collapse" bordercolor="#94979D" width="90%" cellpadding="2">
<tr>
<td width="100%" bgcolor="#FFFFFF">
<b>$vbphrase[posts]: $post[posts]</b></td>
<div class="info">$gender</div><div class="info"> <if condition="$bbuserinfo['usergroupid'] == '6'"><a href="ushop.php?do=a&shortname=admindonate&userid=$post[userid]" target="_blank">$vbphrase[ucs_points]</a><else />$vbphrase[ucs_points]</if>: $points (<a href="ushop.php?do=a&shortname=donate&userid=$post[userid]" target="_blank">Tặng tiền</a>)
</div>

</tr>
</table>
</td>
</tr>


</table>
</td>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
</tr>
<tr>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
<td background="$stylevar[imgdir_misc]/tbitbg.gif"><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="5" border="0" /><br /><img src="$stylevar[imgdir_misc]/hr2.gif" border="0" /><br /><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="5" border="0" /></td>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
</tr>
<tr>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
<td background="$stylevar[imgdir_misc]/tbitbg.gif" align="center">$post[iplogged]<a href="report.php?$session[sessionurl]p=$post[postid]"><img src="$stylevar[imgdir_misc]/report.gif" alt="$vbphrase[report_bad_post]" border="0" /></a><if condition="$post['editlink']"><a href="$post[editlink]"><img src="$stylevar[imgdir_misc]/edit.gif" alt="$vbphrase[edit_delete_message]" border="0" /></a></if><a href="$post[replylink]"><img src="$stylevar[imgdir_misc]/quote.gif" border="0" alt="$vbphrase[reply_with_quote]"></a><if condition="$post['forwardlink']"><a href="$post[forwardlink]"><img src="$stylevar[imgdir_button]/forward.gif" alt="$vbphrase[forward_message]" border="0" /></a></if><if condition="$SHOWQUICKREPLY AND !$show['threadedmode']"><a href="$post[replylink]" onclick="return qr($post[postid]);"><img src="$stylevar[imgdir_button]/quickreply.gif" alt="$vbphrase[quick_reply_to_this_message]" border="0" /></a></if></td>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
</tr>
<tr>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
<td><img src="$stylevar[imgdir_misc]/bbit.gif" border="0" /></td>
<td><img src="$stylevar[imgdir_misc]/spacer.gif" width="8" height="1" border="0" /></td>
</tr>
</table>
<br />
</td>
<td width="100%" valign="top">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td background="$stylevar[imgdir_misc]/sd.gif"><img src="$stylevar[imgdir_misc]/sd.gif" border="0" /></td>
</tr>
</table>
</td>
<td valign="top" height="28"><img src="$stylevar[imgdir_misc]/pnav.gif" height="28" border="0" /></td>
<td background="$stylevar[imgdir_misc]/pnbg.gif" nowrap="nowrap"><if condition="$show['profile']"><a href="member.php?$session[sessionurl]userid=$post[userid]" target="_blank"><img src="$stylevar[imgdir_misc]/profile.gif" border="0" alt="$vbphrase[view_public_profile]"></a></if> <if condition="$show['pmlink']"><a href="private.php?$session[sessionurl]do=newpm&amp;userid=$post[userid]"><img src="$stylevar[imgdir_misc]/sendpm.gif" border="0" alt="<phrase 1="$post[username]">$vbphrase[send_private_message_to_x]</phrase>"></a></if> <if condition="$show['homepage']"><a href="$post[homepage]" target="_blank"><img src="$stylevar[imgdir_misc]/home.gif" alt="<phrase 1="$post[username]">$vbphrase[visit_xs_homepage]</phrase>" border="0"></a></if> <if condition="$show['search']"><a href="search.php?$session[sessionurl]do=finduser&amp;userid=$post[userid]"><img src="$stylevar[imgdir_misc]/find.gif" border="0" alt="<phrase 1="$post[username]">$vbphrase[find_all_posts_by_x]</phrase>"></a></if> <if condition="$post['userid']"><a href="profile.php?$session[sessionurl]do=addlist&amp;userlist=buddy&amp;u=$post[userid]"><img src="$stylevar[imgdir_misc]/buddy.gif" border="0" alt="<phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase>"></a></if></td>
<td valign="top"><img src="$stylevar[imgdir_misc]/pnav2.gif" border="0" /></td>
<td>&nbsp;</td>
</tr>
</table>
<table width="100%" cellpadding="10" cellspacing="0" border="0" align="center">
<tr>
<td>
<font face="verdana,arial,helvetica" size="1" ><if condition="!$show['start_until_end']">
$post[postdate]<if condition="!$show['detailedtime']">, $post[posttime]</if>
<else />
<phrase 1="$post[startdate]" 2="$post[enddate]">$vbphrase[x_until_y]</phrase>
</if></font><br /><br />
<!-- message, attachments, sig -->
<!-- message -->
<font face="verdana" size="2"><div>$post[message]</div></font>
<!-- / message -->

<if condition="$show['attachments']">
<!-- attachments -->
<div style="padding:$stylevar[cellpadding]px">

<if condition="$show['thumbnailattachment']">
<fieldset class="fieldset">
<legend>$vbphrase[attached_thumbnails]</legend>
<div style="padding:$stylevar[formspacer]px">
$post[thumbnailattachments]
</div>
</fieldset>
</if>

<if condition="$show['imageattachment']">
<fieldset class="fieldset">
<legend>$vbphrase[attached_images]</legend>
<div style="padding:$stylevar[formspacer]px">
$post[imageattachments]
</div>
</fieldset>
</if>

<if condition="$show['imageattachmentlink']">
<fieldset class="fieldset">
<legend>$vbphrase[attached_images]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
$post[imageattachmentlinks]
</table>
</fieldset>
</if>

<if condition="$show['otherattachment']">
<fieldset class="fieldset">
<legend>$vbphrase[attached_files]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
$post[otherattachments]
</table>
</fieldset>
</if>

<if condition="$show['moderatedattachment']">
<fieldset class="fieldset">
<legend>$vbphrase[attachments_pending_approval]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
$post[moderatedattachments]
</table>
</fieldset>
</if>

</div>
<!-- / attachments -->
</if>

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

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

Nordinho
02-03-2005, 01:32 PM
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
03-01-2005, 01:21 PM
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
04-25-2005, 07:28 PM
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:

Database error in vBulletin 3.0.7:

Invalid SQL:
INSERT INTO vb3_post
(threadid, parentid, title, username, userid, dateline, pagetext, allowsmilie,
showsignature, ipaddress, proxyip, iconid, visible, attach, useragent, altip, attachstyle)
VALUES
(5153, 53039, '',
'Robin', 1, 1114460198,
'Awesome...well that only took me like four hours to figure out that what was wrong...

The hard part was that it was a stinking space!!!!', 1, 1,
'69.219.97.214','', 0, 1, 0, 0)
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)', '69.219.97.214')

mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.

mysql error number: 1064

Date: Monday 25th of April 2005 04:16:39 PM
Script: http://www.yourlincolnpark.com/LPSForum/newreply.php
Referer: http://www.yourlincolnpark.com/LPSForum/showthread.php?p=53095#post53095


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:


Database error in vBulletin 3.0.7:

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

mysql error number: 1054

Date: Monday 25th of April 2005 04:33:11 PM
Script: http://www.yourlincolnpark.com/LPSForum/editpost.php?do=editpost&p=53100
Referer: http://www.yourlincolnpark.com/LPSForum/showthread.php?p=53100#post53100

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
04-25-2005, 09:21 PM
look like you didn't restore the backup of editpost.php

htscpl
08-18-2005, 12:13 PM
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. :(