News:

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

Main Menu

Attachment Notice

Started by live627, May 13, 2008, 01:32:13 AM

Previous topic - Next topic

live627

Link to Mod

Created By : Dragooon
Tested with : 1.1.5, 2.0.18
Name : Attachment Notice
Version : 1.1


Shows a notice under a post if it got attachment(s) and the user doesn't have permissions to view it


Changelog
Version 1.1
  • Update for SMF 2.0.18
Version 1.0
  • Initial release

Apllicmz

Good Work
Translate portuguese and Brazilian

Utf8
<file name="$languagedir/Modifications.portuguese-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// Attachment notice strings
$txt['num_disabled_attachments'] = 'N&atilde;o h&aacute; anexo (s), neste lugar e voc&ecirc; n&atilde;o pode visualizar ou fazer download';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.brazilian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// Attachment notice strings
$txt['num_disabled_attachments'] = 'N&atilde;o h&aacute; anexo (s), neste lugar e voc&ecirc; n&atilde;o pode visualizar ou fazer download';
]]></add>
</operation>
</file>



Normal

</file>
<file name="$languagedir/Modifications.portuguese.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// Attachment notice strings
$txt['num_disabled_attachments'] = 'Não há anexo (s), neste lugar e você não pode visualizar ou fazer download';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.brazilian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// Attachment notice strings
$txt['num_disabled_attachments'] = 'Não há anexo (s), neste lugar e você não pode visualizar ou fazer download';
]]></add>
</operation>
</file>



rumfa

#2
This is the whole package ready to install, but with additional Serbian languages "serbian-lat and serbian-utf8"  Enjoy.
Уживајте :П ...

Hopefully i'm am not violeting any mod rights...It's easier like this. ;)

уιℓмαz

Thanks for modification. I translated this into Turkish.

<file name="$languagedir/Modifications.turkish.php" error="skip">
   <operation>
      <search position="end" />
      <add><![CDATA[
// Attachment notice strings
$txt['num_disabled_attachments'] = 'Bu mesajda %s dosya eki mevcut ancak indirmeye yetkiniz yok.';
]]></add>
   </operation>
</file>


UTF-8 support
<file name="$languagedir/Modifications.turkish-utf8.php" error="skip">
   <operation>
      <search position="end" />
      <add><![CDATA[
// Attachment notice strings
$txt['num_disabled_attachments'] = 'Bu mesajda %s dosya eki mevcut ancak indirmeye yetkiniz yok.';
]]></add>
   </operation>
</file>

58tbird

Good idea - thank you!  Now visitors won't be confused, and it provides an opportunity to encourage membership.  ;)

marglar

This is exactly what I need, but I've installed it and can't seem to make it work.

It says it installed properly but I don't see any directions.

As a simple test, I have "Guest" set both view and post attachments turned off.

When I view a post with attachments, I don't see the message telling me that there are attachments available if I log in.

Can anyone help?

X3mE

Will there be a 2.0b4 version?
Kids, you tried your best and you failed miserably. The lesson is - never try.

My mods:
OS & Browser Detection (1.5 is out!) | Skype Profile Field | GTalk Profile Field | AllCaps Blocker | SMF Syntax Highlighter (Beta) + 2 in development!

Personal websites:
Mobilize.rs (and forum) | Lolmao.info



X3mE

Has anyone managed to get this running on 2.0b4?
Kids, you tried your best and you failed miserably. The lesson is - never try.

My mods:
OS & Browser Detection (1.5 is out!) | Skype Profile Field | GTalk Profile Field | AllCaps Blocker | SMF Syntax Highlighter (Beta) + 2 in development!

Personal websites:
Mobilize.rs (and forum) | Lolmao.info



darklord2

FANTASTIC!
The Smallest Usefull Mod ever...

Translated to Persian:


<file name="$languagedir/Modifications.persian.php">
<operation>
<search position="end" />
<add><![CDATA[
// Attachment notice strings
$txt['num_disabled_attachments'] = 'این مطلب حاوی %s پیوست می باشد، برای دریافت پیوست ها باید لاگین کنید.';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.persian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// Attachment notice strings
$txt['num_disabled_attachments'] = 'این مطلب حاوی %s پیوست می باشد، برای دریافت پیوست ها باید لاگین کنید.';
]]></add>
</operation>
</file>
P30Experts: Persian PC Experts

X3mE

I still can't get it running od 2.0b4 :/
Kids, you tried your best and you failed miserably. The lesson is - never try.

My mods:
OS & Browser Detection (1.5 is out!) | Skype Profile Field | GTalk Profile Field | AllCaps Blocker | SMF Syntax Highlighter (Beta) + 2 in development!

Personal websites:
Mobilize.rs (and forum) | Lolmao.info



Dragooon

@X3mE - Does it show a Test failed after Dispaly.template.php?

X3mE

Quote from: Dragooon on November 19, 2008, 08:34:46 AM
@X3mE - Does it show a Test failed after Dispaly.template.php?

Yes, it does.
Kids, you tried your best and you failed miserably. The lesson is - never try.

My mods:
OS & Browser Detection (1.5 is out!) | Skype Profile Field | GTalk Profile Field | AllCaps Blocker | SMF Syntax Highlighter (Beta) + 2 in development!

Personal websites:
Mobilize.rs (and forum) | Lolmao.info



Dragooon


X3mE

No, just the display.template.php file.
Kids, you tried your best and you failed miserably. The lesson is - never try.

My mods:
OS & Browser Detection (1.5 is out!) | Skype Profile Field | GTalk Profile Field | AllCaps Blocker | SMF Syntax Highlighter (Beta) + 2 in development!

Personal websites:
Mobilize.rs (and forum) | Lolmao.info



X3mE

I've edited the installation script myself, replaced the search code in display.template.php and I can confirm it works on 2.0b4. Here is the modified package.
Kids, you tried your best and you failed miserably. The lesson is - never try.

My mods:
OS & Browser Detection (1.5 is out!) | Skype Profile Field | GTalk Profile Field | AllCaps Blocker | SMF Syntax Highlighter (Beta) + 2 in development!

Personal websites:
Mobilize.rs (and forum) | Lolmao.info



Dragooon

Thanks for that, I wasn't able to make out some time.

Phat^Trance

is it possible to ad a "register or login" link with the text? right now when a guest views a attachment they get this message:

There are 8 attachment(s) in this post which you cannot view or download
BlindVine.jpg
Bluez.jpg
HiResMesh.jpg
Knight of Silence.png


there would be  nice to have a text that says that they need to login or register to view the attachments, is that possible to add?

thx
Daily Mobile Blog:  http://dailymobile.se/
Daily iPhone Blog: http://dailyiphoneblog.com/
Daily Mobile forum: http://forum.dailymobile.se/

FragaCampos


Phat^Trance

Bumping this thread, still need help with this:


is it possible to ad a "register or login" link with the text? right now when a guest views a attachment they get this message:

There are 8 attachment(s) in this post which you cannot view or download
BlindVine.jpg
Bluez.jpg
HiResMesh.jpg
Knight of Silence.png


there would be  nice to have a text that says that they need to login or register to view the attachments, is that possible to add?

thx
Daily Mobile Blog:  http://dailymobile.se/
Daily iPhone Blog: http://dailyiphoneblog.com/
Daily Mobile forum: http://forum.dailymobile.se/

Apllicmz

when update dont forget
i see this erro



FragaCampos

Any chance of updating this to 2.0 RC3, please?

ehsizzup

#21
Quote from: Phat^Trance on February 19, 2010, 07:42:50 AM
Bumping this thread, still need help with this:


is it possible to ad a "register or login" link with the text? right now when a guest views a attachment they get this message:

There are 8 attachment(s) in this post which you cannot view or download
BlindVine.jpg
Bluez.jpg
HiResMesh.jpg
Knight of Silence.png


there would be  nice to have a text that says that they need to login or register to view the attachments, is that possible to add?

thx

This can easily be accomplished by changing the language modification file(s) to read something like this.....

$txt['num_disabled_attachments'] = 'There are %s attachment(s) in this post which GUESTS cannot view or download.<br /><br /><font color="#444444">Please</font> <a href="' . $scripturl . '?action=login">login</a><font color="#444444"> if you are already a member or</font> <a href="' . $scripturl . '?action=register">register</a><font color="#444444"> to view attachments and unlock other advanced website features.</font><br /><br />';


I added the font color stuff, but you can kill that if you want.

Clear your SMF cache after that and you should be good to go.


PS.  Great mod.  Should be a standard feature.  Prevents confusion over missing attachments and motivates to join.

Neverhurry

Quote from: FragaCampos on September 07, 2010, 09:17:36 AM
Any chance of updating this to 2.0 RC3, please?

Please, who can help to us to manually install to 2.0 rc3? Thanks.
I am using SMF 2.0.1, curve themes.

fdr77

Quote from: Neverhurry on November 14, 2010, 02:13:38 PM
Quote from: FragaCampos on September 07, 2010, 09:17:36 AM
Any chance of updating this to 2.0 RC3, please?

Please, who can help to us to manually install to 2.0 rc3? Thanks.
I too would for 2.0 rc4 :)

9083ja


Oldiesmann

Only one minor change needed to make this work with 2.0 final. The template code that it searches for has changed slightly when we went to a more semantic style. I've attached a newer version in this post: http://www.simplemachines.org/community/index.php?msg=3158102
Michael Eshom
Christian Metal Fans

Arvacon

Ηι. This topic is indeed old now, but I was wondering if this mod can work with the last smf version as well, after some small modifications.
Is it possible?

ApplianceJunk

I know this is a very old mod/topic but would like to see it updated for 2.0.7

Thanks,


pobo424

I try to add the "Attachment Notice" mod, the skin I use https://custom.simplemachines.org/themes/index.php?lemma=2921, modifies the ./Sources/Display.php file as it says but I get an error "mysql_fetch_assoc",

// Fetch attachments.
if (!empty($modSettings['attachmentEnable']) && allowedTo('view_attachments'))
{
$request = $smcFunc['db_query']('', '
SELECT
a.id_attach, a.id_folder, a.id_msg, a.filename, a.file_hash, IFNULL(a.size, 0) AS filesize, a.downloads, a.approved,
a.width, a.height' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ',
IFNULL(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height') . '
FROM {db_prefix}attachments AS a' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : '
LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id_thumb)') . '
WHERE a.id_msg IN ({array_int:message_list})
AND a.attachment_type = {int:attachment_type}',
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
)
);
$temp = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if (!$row['approved'] && $modSettings['postmod_active'] && !allowedTo('approve_posts') && (!isset($all_posters[$row['id_msg']]) || $all_posters[$row['id_msg']] != $user_info['id']))
continue;

$temp[$row['id_attach']] = $row;

if (!isset($attachments[$row['id_msg']]))
$attachments[$row['id_msg']] = array();
}
$smcFunc['db_free_result']($request);

// This is better than sorting it with the query...
ksort($temp);

foreach ($temp as $row)
{
$attachments[$row['id_msg']][] = $row;
}
}
elseif(!empty($modSettings['attachmentEnable']) && !allowedTo('view_attachments'))
{
$request = $smcFunc['db_query']('','
SELECT
id_msg, filename
FROM {db_prefix}attachments
WHERE ID_MSG IN ({array_int:message_list})
AND attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND approved = {int:is_approved}'),
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
));
$temp = array();
while($row = mysql_fetch_assoc($request))
{
$temp[$row['filename']] = $row;
if(!isset($attachments['disabled_'.$row['id_msg']]))
$attachments['disabled_'.$row['id_msg']] = array();
}
mysql_free_result($request);

ksort($temp);

foreach($temp as $row)
$attachments['disabled_'.$row['id_msg']][] = $row;


f it modifies the code to be similar to the one above, it doesn't stick out anymore but the code doesn't work

// Fetch attachments.
if (!empty($modSettings['attachmentEnable']) && allowedTo('view_attachments'))
{
$request = $smcFunc['db_query']('', '
SELECT
a.id_attach, a.id_folder, a.id_msg, a.filename, a.file_hash, IFNULL(a.size, 0) AS filesize, a.downloads, a.approved,
a.width, a.height' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ',
IFNULL(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height') . '
FROM {db_prefix}attachments AS a' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : '
LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id_thumb)') . '
WHERE a.id_msg IN ({array_int:message_list})
AND a.attachment_type = {int:attachment_type}',
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
)
);
$temp = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if (!$row['approved'] && $modSettings['postmod_active'] && !allowedTo('approve_posts') && (!isset($all_posters[$row['id_msg']]) || $all_posters[$row['id_msg']] != $user_info['id']))
continue;

$temp[$row['id_attach']] = $row;

if (!isset($attachments[$row['id_msg']]))
$attachments[$row['id_msg']] = array();
}
$smcFunc['db_free_result']($request);

// This is better than sorting it with the query...
ksort($temp);

foreach ($temp as $row)
{
$attachments[$row['id_msg']][] = $row;
}
}
elseif(!empty($modSettings['attachmentEnable']) && !allowedTo('view_attachments'))
{
$request = $smcFunc['db_query']('','
SELECT
id_msg, filename
FROM {db_prefix}attachments
WHERE ID_MSG IN ({array_int:message_list})
AND attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND approved = {int:is_approved}'),
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
));
$temp = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$temp[$row['filename']] = $row;
if(!isset($attachments['disabled_'.$row['id_msg']]))
$attachments['disabled_'.$row['id_msg']] = array();
}
$smcFunc['db_free_result']($request);

ksort($temp);

foreach($temp as $row)
{
$attachments['disabled_'.$row['id_msg']][] = $row;
}
}


I use smf 2.0.18, added translations, added in ./Themes/ SunRise/Display.template.php

if(!empty($message['disabled_attachments']))
{
echo '
<hr width="100%" size="1" class="hrcolor" />
<div style="overflow: auto; width: 100%;">
<span class="smalltext" style="color:#556B2F">',sprintf($txt['num_disabled_attachments'],$message['num_disabled_attachments']),'</span>';
foreach($message['disabled_attachments'] as $attachment)
echo '<div style="color:#556B2F">',$attachment['filename'],'</div>';
echo '</div>';
}

echo '

<div class="moderatorbar">
<div class="smalltext modified" id="modified_', $message['id'], '">';


could someone verify the code for which the mod does not work? is there any alternative? thanks in advance for your help and attention

Advertisement: