Atachments: display link although user is not permitted to view

Started by –Michael, November 25, 2005, 04:15:20 PM

Previous topic - Next topic

–Michael

I am still using SMF 1.1 Beta 3 Public.

When using the default theme and one ore more attachments are attached, the attachment symbol (icons/clip.gif) and the attachment name / link is not being displayed if a user is not logged in.
In the member permissions, "View attachments" is not checked since I do not want that not logged in visitors can view/detach attachments.

However, it looks strange in the forum for visitors if someone posts a message like "Please find attached the pdf file for....." and there is nothing, it looks as if there has no attachment been attached.

Therefore, I would like that the clip icon & the attachment link/text is displayed although user does not have permission to view the attachment. If a visitor (who is not logged in) clicks the attachment, the usual "insufficient permission....please log in" SMF dialog should appear.

How can I turn this on?
I already checked (a) member permissions & (b) "Configuration/Features and Options/Layout & Options" but could not find an option there.

Do I need to modify Display.template.php? Or do I just need new glasses?  :D

Thanks in advance,
Michael
My SMF Mod: Static Page Mod

Sheepy

At Display.php,

Find if (!empty($modSettings['attachmentEnable']) && allowedTo('view_attachments'))

Replace with: if (!empty($modSettings['attachmentEnable']))



Then at display.template.php,

Find: if ($attachment['is_image'])

Replace with: if ($attachment['is_image'] && allowedTo('view_attachments'))

–Michael

Many thanks, Sheepy.

Changing the line in display.php solved it, so far I could evaluate, the change in display.template.php is not neccessary. And I do not understand the change there, can you please explain?

Hmm, that would maybe something for considering in later versions of SMF since such option is available in other forums too, as far as I know. I am going to post it in "Feature Request"...


Thanks,
Michael

My SMF Mod: Static Page Mod

Sheepy

You're welcome.  Since attached images are displayed automatically, the change in display.template prevents them from being displayed as images - which would have resulted in errors otherwise.

Advertisement: