Author |
Message |
sockettf
Hangin' Around
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Mar 13, 2009
Posts: 28
|
Posted:
Mon Dec 06, 2010 6:04 am |
|
Hello,
How can I display a message like "You must register to view this attachment" for guests or not logged in users?
I've googled a bit and I've find this code that not work for raven:
Code:#
#----[ OPEN ] ----
#
attach_mod/displaying.php
#
#----[ FIND ] ----
#
// Display Notice (attachment there but not having permissions to view it)
// Not included because this would mean template and language file changes (at this stage this is not a wise step. ;))
#
#----[ REPLACE WITH ] ----
#
$template->assign_block_vars('postrow.noaccess', array());
#
#-----[ FIND ]------------------------------------------
#
function display_post_attachments($post_id, $switch_attachment)
{
global $attach_config, $is_auth;
#
#-----[ REPLACE WITH ]------------------------------------------
#
function display_post_attachments($post_id, $switch_attachment)
{
global $attach_config, $is_auth, $template;
#
#----[ FIND ] ----
#
if (intval($switch_attachment) == 0 || intval($attach_config['disable_mod']) || (!($is_auth['auth_download'] && $is_auth['auth_view'])))
#
#----[ REPLACE WITH ] ----
#
if (intval($switch_attachment) == 0 || intval($attach_config['disable_mod']))// || (!($is_auth['auth_download'] && $is_auth['auth_view'])))
#
#----[ OPEN ] ----
#
templeates/subsilver/viewtopic_attach_body.tpl
#
#----[ FIND ] ----
#
</style>
#
#----[ AFTER, ADD ] ----
#
<!-- BEGIN noaccess -->
<div align="center"><hr width="95%" /></div>
<table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center">
<tr><td width="100%" class="attachheader" align="center"><b><span class="gen">You are not allowed to view downloads!!!</span></b></td></tr>
<tr><td width="100%" class="attachheader" align="center"><b><span class="gen">Please register or request access to attachments</span></b></td></tr>
</table>
<div align="center"><hr width="95%" /></div>
<!-- END noaccess -->
|
When applied the above code my topic view is totally broken for registered users and don't show any message for guests.
Any ideas or fixes for this? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/48fb116845dfecf66294c.gif)
Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA
|
Posted:
Mon Dec 06, 2010 8:15 am |
|
there is already setting for who can Post Files and Download Files in the forum admin
Forum Permissions Control > {your forum} |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
sockettf
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 06, 2010 9:04 am |
|
spasticdonkey wrote: | there is already setting for who can Post Files and Download Files in the forum admin
Forum Permissions Control > {your forum} |
Yes, I know this setting, but my question is about displaying a message if you don't got permission for view/download. Actually, if you can't see an attachement when you read a post with one, the space for attachments is just empty and the guest user don't know there is an attachement.
Thanks for the reply anyways. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 06, 2010 10:13 am |
|
ahh, i see what you are saying...
try this version of displaying.php
http://www.rtsforce.com/files/displaying.zip
and also note you must edit ALL active themes that have a forum directory
themes/ANY_THEME/forums/viewtopic_attach_body.tpl
as well as
templates/subsilver/viewtopic_attach_body.tpl |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
sockettf
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 06, 2010 1:58 pm |
|
Yes, that one works, now guest users get the "You must register..." message, thanks
...but, for some reason my viewtopic is still broken. Maybe a table or div issue. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 06, 2010 2:25 pm |
|
I didn't test this, but when you say broken, do you mean the layout? was it working before you made changes? are you using a RN theme or one from somewhere else? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
sockettf
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 06, 2010 2:46 pm |
|
Yes, I mean a broken layout and was working before changes.
I'm using a theme made for RN, but not included in the distribution. Also if I swich to another theme (RavenIce by example) the problem persists. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 06, 2010 5:27 pm |
|
I did notice in the file i provided i forgot this edit
global $attach_config, $is_auth, $template;
so hopefully that will help. although I played with it for about 1/2 an hour and had the opposite problem; couldn't get the message to show up. I have another project I have to finish tonite, so I'm kinda outta-time, but maybe someone else has some familiarity here? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
PHrEEkie
Subject Matter Expert
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Feb 23, 2004
Posts: 358
|
Posted:
Mon Dec 06, 2010 6:15 pm |
|
At this point, I would try to use files for the RN theme he downloaded, and get the forums looking right again. Then I would re-apply the mod.
If you made edits with a mod that didn't work, then your topics view was broken, then you applied a new mod that did work, it only makes sense that the topics view would STILL be broken...
You have to back up and start where everything was working correctly, otherwise, not only might it take far too long to get the topics view to normalize, there might also be other hidden bugs on top of that.
My .02 ![Wink](modules/Forums/images/smiles/icon_wink.gif) |
_________________ PHP - Breaking your legacy scripts one build at a time. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
sockettf
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Dec 07, 2010 2:38 am |
|
I did noticed the missed $template in global too. The mod works but the layout issue is a pain.
This is not an emergency, Im always test the mods in local installation before go on live . |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|