On SMF 1.1.12 When attachments are disabled from guest viewing, ... is it possible to have a note so they can know an attachment is present and they need to login to see it...
you can check the mod site and if you dont see a mod to do what you want you can post in the proper board to request one.
I assume you mean "Register", coz guests can't log in...
I can't find a mod that does exactly what you want. But, what about this one?
http://custom.simplemachines.org/mods/index.php?mod=1449
Quote from: K@ on February 10, 2011, 01:05:20 PM
I assume you mean "Register", coz guests can't log in...
I can't find a mod that does exactly what you want. But, what about this one?
http://custom.simplemachines.org/mods/index.php?mod=1449
Well technically register yes .. but a guest can login if they have an account :) Many people will view as guest and only log in when they need to post etc...
Naw that mod is totally diff..
Maybe a post in "Mod Requests", then?
It'd be fairly easy to do with a template tweak. Something like... if ($context['user']['is_logged']) {} around where the attachments are outputted. You'd also probably want to add an else that would show a link to $scripturl. '?action=register and a similar one for logging in.
Quote from: K@ on February 10, 2011, 01:26:25 PM
Maybe a post in "Mod Requests", then?
If possible can you move this ?? so i don't have to re-post ?
Quote from: Labradoodle-360 on February 10, 2011, 01:31:16 PM
It'd be fairly easy to do with a template tweak. Something like... if ($context['user']['is_logged']) {} around where the attachments are outputted. You'd also probably want to add an else that would show a link to $scripturl. '?action=register and a similar one for logging in.
Yup, more i less what i was thinking .. a guest would see in place of the actual attachment..
Attachment Available - Please Register or Login to View
I'll go ahead and write up the mod for you. Give me 5 minutes.
Quote from: Labradoodle-360 on February 10, 2011, 01:39:06 PM
I'll go ahead and write up the mod for you. Give me 5 minutes.
OK, my site if currently down .. and wont be back up for a few hours .. as well as i will be installing a few attachment mods ... so if possible you can hold off until i am back up and running, as i am not sure if the mods will affect the mod you would write .. buts thanks allot for your effort and offer..
Hmmm, I did a fresh install of 1.1.12, and I can't see attachments when I'm a guest anyways?
Quote from: Labradoodle-360 on February 10, 2011, 01:52:01 PM
Hmmm, I did a fresh install of 1.1.12, and I can't see attachments when I'm a guest anyways?
Check permissions ... Perhaps by default the option for guest to view attachments is set to off ..
Here you are :)
http://prntscr.com/1jt2m
Quote from: Labradoodle-360 on February 10, 2011, 02:13:00 PM
Here you are :)
http://prntscr.com/1jt2m
Nice that was really quick :P
Question: Will it show that message for each attachment ? or it will just show one message ? also can you show me what files are modified so i can see if it will conflict with other attachment mods I will be installing ...
It shows one message despite the count of attachments. It shouldn't have any conflicts. It's fairly straight forward.
It makes two modifications to Display.template.php.
The 1st:
if (!empty($message['attachment']))
if (!empty($message['attachment']) && $context['user']['is_logged'])
The 2nd:
echo '
</td>
</tr><tr>
<td valign="bottom" class="smalltext" id="modified_', $message['id'], '">';
// Labradoodle-360; Hide Attachments from Guests
elseif ($context['user']['is_guest'] && !empty($message['attachment']))
echo '<hr width="100%" size="1" class="hrcolor" />
<div style="overflow: auto; width: 100%;">
<strong>', $txt['lab360_attachments_avail'], '</strong>
</div>';
// End Labradoodle-360; Hide Attachments from Guests
Then it makes one modification to Modifications.english.php
$txt['lab360_attachments_avail'] = 'Attachment(s) Available - <a href="'. $scripturl. '?action=login" target="_self">Login</a> or <a href="'. $scripturl. '?action=register" target="_self">Register</a>';
Donations are appreciated as always :)
You can also take this mod over and submit it to the SMF Mod Site if you would like, as I have no intentions of submitting it.
Best Regards,
Labradoodle-360
OK kool, will let you know how it goes when i install and start to use it ... thanks again
Not a problem. Feel free to mark this topic as resolved once you are confident the results are as you are expecting.
Quote from: Labradoodle-360 on February 10, 2011, 02:27:04 PM
Not a problem. Feel free to mark this topic as resolved once you are confident the results are as you are expecting.
Sure , will do ...
Would this be allowed .. ??
Change
Attachment(s) Available
To
Image(s) Available
Installed and now testing .. strange though ,, it's not showing up .. i did the manual edits.
guest permission is set to view attachments..
Quote from: Labradoodle-360 on February 10, 2011, 02:23:21 PM
It shows one message despite the count of attachments. It shouldn't have any conflicts. It's fairly straight forward.
It makes two modifications to Display.template.php.
The 1st:
if (!empty($message['attachment']))
if (!empty($message['attachment']) && $context['user']['is_logged'])
Should'nt that be
if (!empty($message['attachment']) && $context['user']['is_guest'])
?
OK, that didn't work lol
No, it should be && $context['user']['is_logged']. If you look at the code inside the if statement, it's to SHOW attachments...and you only want them to show if there ARE attachments, and it's a member. Then, we add an elseif statement below that shows them a message if there ARE attachments, but they're a guest.
Quote from: aw06 on February 18, 2011, 11:16:51 PM
Quote from: Labradoodle-360 on February 10, 2011, 02:23:21 PM
It shows one message despite the count of attachments. It shouldn't have any conflicts. It's fairly straight forward.
It makes two modifications to Display.template.php.
The 1st:
if (!empty($message['attachment']))
if (!empty($message['attachment']) && $context['user']['is_logged'])
Should'nt that be
if (!empty($message['attachment']) && $context['user']['is_guest'])
?
What about it didn't work?
Quote from: aw06 on February 18, 2011, 11:19:57 PM
OK, that didn't work lol
Not seeing the message ... attachments just disappear
What edits specifically did you complete?
Quote from: Labradoodle-360 on February 19, 2011, 09:44:58 PM
What edits specifically did you complete?
Those listed ... did them exactly.
Quote from: Labradoodle-360 on February 10, 2011, 02:23:21 PM
It shows one message despite the count of attachments. It shouldn't have any conflicts. It's fairly straight forward.
It makes two modifications to Display.template.php.
The 1st:
if (!empty($message['attachment']))
if (!empty($message['attachment']) && $context['user']['is_logged'])
The 2nd:
echo '
</td>
</tr><tr>
<td valign="bottom" class="smalltext" id="modified_', $message['id'], '">';
// Labradoodle-360; Hide Attachments from Guests
elseif ($context['user']['is_guest'] && !empty($message['attachment']))
echo '<hr width="100%" size="1" class="hrcolor" />
<div style="overflow: auto; width: 100%;">
<strong>', $txt['lab360_attachments_avail'], '</strong>
</div>';
// End Labradoodle-360; Hide Attachments from Guests
Then it makes one modification to Modifications.english.php
$txt['lab360_attachments_avail'] = 'Attachment(s) Available - <a href="'. $scripturl. '?action=login" target="_self">Login</a> or <a href="'. $scripturl. '?action=register" target="_self">Register</a>';
Donations are appreciated as always :)
You can also take this mod over and submit it to the SMF Mod Site if you would like, as I have no intentions of submitting it.
Best Regards,
Labradoodle-360
Try to figure out if the conditions are being met or not...you can simply use die(); after the if statement, and after the elseif, and see which one is returned.
Furthermore, are there any errors in the error log?
Quote from: Labradoodle-360 on February 19, 2011, 09:54:15 PM
Try to figure out if the conditions are being met or not...you can simply use die(); after the if statement, and after the elseif, and see which one is returned.
Furthermore, are there any errors in the error log?
Negative .. no errors
Quote from: Labradoodle-360 on February 19, 2011, 09:54:15 PM
Try to figure out if the conditions are being met or not...you can simply use die(); after the if statement, and after the elseif, and see which one is returned.
as in ..
if (!empty($message['attachment']) && $context['user']['is_logged']) die();
and
elseif ($context['user']['is_guest'] && !empty($message['attachment'])) die();
??
die(); would be on it's own line, but yeah. In addition, you'll probably want to put brackets around the if, and elseif statements.
Example
if (this)
{
// Do this
}
elseif (this)
{
// Do this
}
Quote from: Labradoodle-360 on February 19, 2011, 11:21:11 PM
die(); would be on it's own line, but yeah. In addition, you'll probably want to put brackets around the if, and elseif statements.
Example
if (this)
{
// Do this
}
elseif (this)
{
// Do this
}
OK kool, thing is i am not a ninja coder like you guys :P so i really am not 100% certain how the do the coding
It's not a problem
I know I am digging in graves but is there any similar mod for SMF 2.0.17?
I have recently started allowing specific sections of the forum to be publicly visible but their attachments are hidden, so I would like to show a message to guests that will advise registering in order to view attachments and gain full access to the forum topics.
I would really appreciate any help!