News:

Wondering if this will always be free?  See why free is better.

Main Menu

Attachment to Topic, not Reply.

Started by fiver, May 11, 2010, 05:04:45 AM

Previous topic - Next topic

fiver

SMF 2.0 RC3


In Admin > Attachments, under the column Date.


The link goes to the topic, it does not goes to the reply/post that contains the attachment. For a topic with many pages, it takes awhile to search for that post which contains the attachment.


Hope this will be corrected for next version.


Thanks for reading.


;)

Arantor

#1
ManageAttachments.php

Code (find) Select
if ($context[\'browse_type\'] !== \'avatars\')
$date .= sprintf(\'<br />%1$s <a href="%2$s?topic=%3$d.0">%4$s</a>\', $txt[\'in\'], $scripturl, $rowData[\'id_topic\'], $rowData[\'subject\']);


Code (replace) Select
if ($context[\'browse_type\'] !== \'avatars\')
$date .= sprintf(\'<br />%1$s <a href="%2$s?topic=%3$d.msg%5$d#msg%6$d">%4$s</a>\', $txt[\'in\'], $scripturl, $rowData[\'id_topic\'], $rowData[\'subject\'], $rowData[\'id_msg\'], $rowData[\'id_msg\']);


Well, if you're linking to the post, you probably should use the post's own subject rather than the first post's so... same file:

Code (find) Select
SELECT
m.id_msg, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time, m.id_topic, m.id_member,
a.id_attach, a.filename, a.file_hash, a.attachment_type, a.size, a.width, a.height, a.downloads, mf.subject, t.id_board
FROM {db_prefix}attachments AS a
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg)
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)


Code (replace) Select
SELECT
m.id_msg, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time, m.id_topic, m.id_member,
a.id_attach, a.filename, a.file_hash, a.attachment_type, a.size, a.width, a.height, a.downloads, m.subject, t.id_board
FROM {db_prefix}attachments AS a
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg)
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)



EDIT fixed a couple of typoes in the first replace around what was %5$d and %6$d.
Holder of controversial views, all of which my own.


vbgamer45

Done.

! On browse files for manage attachments set the topic link to the message of the attachment (ManageAttachments.php)
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

Just noticed this has been replied to -- I made a couple of tiny edits after I posted as I realised I'd typo'd the content.

Didn't expect anyone to commit without testing it first, cuz I didn't.
Holder of controversial views, all of which my own.


vbgamer45

I just did the first part I was working on before you replied lol.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: