Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Forum Attachment Mod
Author Message
sockettf
Hangin' Around


Joined: Mar 13, 2009
Posts: 28

PostPosted: Mon Dec 06, 2010 6:04 am Reply with quote

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?
 
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Mon Dec 06, 2010 8:15 am Reply with quote

there is already setting for who can Post Files and Download Files in the forum admin
Forum Permissions Control > {your forum}
 
View user's profile Send private message Visit poster's website
sockettf
PostPosted: Mon Dec 06, 2010 9:04 am Reply with quote

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.
 
spasticdonkey
PostPosted: Mon Dec 06, 2010 10:13 am Reply with quote

ahh, i see what you are saying...

try this version of displaying.php Only registered users can see links on this board! Get registered or login!

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
 
sockettf
PostPosted: Mon Dec 06, 2010 1:58 pm Reply with quote

Yes, that one works, now guest users get the "You must register..." message, thanks Smile

...but, for some reason my viewtopic is still broken. Maybe a table or div issue.
 
spasticdonkey
PostPosted: Mon Dec 06, 2010 2:25 pm Reply with quote

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?
 
sockettf
PostPosted: Mon Dec 06, 2010 2:46 pm Reply with quote

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.
 
spasticdonkey
PostPosted: Mon Dec 06, 2010 5:27 pm Reply with quote

I did notice in the file i provided i forgot this edit Embarassed
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?
 
PHrEEkie
Subject Matter Expert


Joined: Feb 23, 2004
Posts: 358

PostPosted: Mon Dec 06, 2010 6:15 pm Reply with quote

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

_________________
PHP - Breaking your legacy scripts one build at a time. 
View user's profile Send private message
sockettf
PostPosted: Tue Dec 07, 2010 2:38 am Reply with quote

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 Smile.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Forum Attachment Mod

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©