News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Advise Guest to login to see Attachments

Started by aw06, February 10, 2011, 10:23:28 AM

Previous topic - Next topic

aw06

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...
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Illori

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.

kat

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

aw06

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..
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

kat


Matthew K.

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.

aw06

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 ?
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

aw06

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
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Matthew K.

I'll go ahead and write up the mod for you. Give me 5 minutes.

aw06

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..
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Matthew K.

Hmmm, I did a fresh install of 1.1.12, and I can't see attachments when I'm a guest anyways?

aw06

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 ..
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth


aw06

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 ...
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Matthew K.

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:
Code (Find) Select
if (!empty($message['attachment']))
Code (Replace) Select
if (!empty($message['attachment']) && $context['user']['is_logged'])
The 2nd:
Code (Find) Select
echo '
</td>
</tr><tr>
<td valign="bottom" class="smalltext" id="modified_', $message['id'], '">';

Code (Add Before) Select
// 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
Code (Add Before End) Select
$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

aw06

OK kool, will let you know how it goes when i install and start to use it ... thanks again
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Matthew K.

Not a problem. Feel free to mark this topic as resolved once you are confident the results are as you are expecting.

aw06

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
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

aw06

Installed and now testing .. strange though ,, it's not showing up .. i did the manual edits.

guest permission is set to view attachments..
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

aw06

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:
Code (Find) Select
if (!empty($message['attachment']))
Code (Replace) Select
if (!empty($message['attachment']) && $context['user']['is_logged'])


Should'nt that be
if (!empty($message['attachment']) && $context['user']['is_guest'])

?
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Advertisement: