Kunena 7.0.4 Released

The Kunena team has announce the arrival of Kunena 7.0.4 [K 7.0.4] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0

Question Restrict download of files only to registered users

More
17 years 2 months ago - 17 years 2 months ago #6751 by Eric
Hi all,

How can I restrict the download of files which are uploaded in the forum to registered users only? I cannot find an option for this.

Only registered users can post messages om my forum but anyone can view the messages.
I want only registered users to be able to download files.

Thanks,
Eric :)
Last edit: 17 years 2 months ago by Eric.

Please Log in or Create an account to join the conversation.

More
17 years 2 months ago - 17 years 2 months ago #6755 by roland76
Hello,

change in kunena.file.upload.php line 90:
Code:
= '[file name=' . $newFileName . ' size=' . $fileSize . ']' . KUNENA_LIVEUPLOADEDPATH . '/files/' . $newFileName . '[/file]';
into
Code:
= '[hide][file name=' . $newFileName . ' size=' . $fileSize . ']' . KUNENA_LIVEUPLOADEDPATH . '/files/' . $newFileName . '[/file][/hide]';

It works only for new posts.... :unsure:
Last edit: 17 years 2 months ago by roland76.

Please Log in or Create an account to join the conversation.

More
17 years 2 months ago #6761 by Eric
Hi roland76,

Yes, that works fine! Thanks!
So there is no option to set?

Cheers,
Eric B)

Please Log in or Create an account to join the conversation.

More
17 years 2 months ago #6785 by roland76
Here the better way to work with all files (also from old posts):

Change in kunena.parser.php line 357:
Code:
case 'file': if($between) { $task->autolink_disable--; # continue autolink conversion $tag_new = "<div class=\"fb_file_attachment\"><span class=\"contentheading\">"._KUNENA_FILEATTACH."</span><br>"._KUNENA_FILENAME ."<a href='".$between."' target=\"_blank\" rel=\"nofollow\">".(($tag->options["name"])?htmlspecialchars($tag->options["name"]):$between)."</a><br>"._KUNENA_FILESIZE.htmlspecialchars($tag->options["size"], ENT_QUOTES)."</div>"; return TAGPARSER_RET_REPLACED; } return TAGPARSER_RET_NOTHING; break;

into
Code:
case 'file': if($between) { if ($my->id==0) { // Hide between content from non registered users $tag_new = '<b>' . _KUNENA_BBCODE_HIDEFILE . '</b>'; } else { $task->autolink_disable--; # continue autolink conversion $tag_new = "<div class=\"fb_file_attachment\"><span class=\"contentheading\">"._KUNENA_FILEATTACH."</span><br>"._KUNENA_FILENAME ."<a href='".$between."' target=\"_blank\" rel=\"nofollow\">".(($tag->options["name"])?htmlspecialchars($tag->options["name"]):$between)."</a><br>"._KUNENA_FILESIZE.htmlspecialchars($tag->options["size"], ENT_QUOTES)."</div>"; } return TAGPARSER_RET_REPLACED; } return TAGPARSER_RET_NOTHING; break;

I have included a additional language string which was shown for guests. You can here define your own text like "This attachment is only seen for registered users".

You have to insert _KUNENA_BBCODE_HIDEFILE in your language file or change this line:
Code:
$tag_new = '<b>' . _KUNENA_BBCODE_HIDEFILE . '</b>';
into
Code:
$tag_new = '';

Please Log in or Create an account to join the conversation.

More
17 years 2 months ago - 17 years 2 months ago #6799 by Eric
roland76 wrote:

Here the better way to work with all files (also from old posts):

Change in kunena.parser.php line 357:

Code:
case 'file': if($between) { $task->autolink_disable--; # continue autolink conversion $tag_new = "<div class=\"fb_file_attachment\"><span class=\"contentheading\">"._KUNENA_FILEATTACH."</span><br>"._KUNENA_FILENAME ."<a href='".$between."' target=\"_blank\" rel=\"nofollow\">".(($tag->options["name"])?htmlspecialchars($tag->options["name"]):$between)."</a><br>"._KUNENA_FILESIZE.htmlspecialchars($tag->options["size"], ENT_QUOTES)."</div>"; return TAGPARSER_RET_REPLACED; } return TAGPARSER_RET_NOTHING; break;

into
Code:
case 'file': if($between) { if ($my->id==0) { // Hide between content from non registered users $tag_new = '<b>' . _KUNENA_BBCODE_HIDEFILE . '</b>'; } else { $task->autolink_disable--; # continue autolink conversion $tag_new = "<div class=\"fb_file_attachment\"><span class=\"contentheading\">"._KUNENA_FILEATTACH."</span><br>"._KUNENA_FILENAME ."<a href='".$between."' target=\"_blank\" rel=\"nofollow\">".(($tag->options["name"])?htmlspecialchars($tag->options["name"]):$between)."</a><br>"._KUNENA_FILESIZE.htmlspecialchars($tag->options["size"], ENT_QUOTES)."</div>"; } return TAGPARSER_RET_REPLACED; } return TAGPARSER_RET_NOTHING; break;

I have included a additional language string which was shown for guests. You can here define your own text like "This attachment is only seen for registered users".

You have to insert _KUNENA_BBCODE_HIDEFILE in your language file or change this line:
Code:
$tag_new = '<b>' . _KUNENA_BBCODE_HIDEFILE . '</b>';
into
Code:
$tag_new = '';


Hi roland76,

This one is even better than the previous solution! Thank you very much for your help!

Cheers,
Eric :laugh:
Last edit: 17 years 2 months ago by Eric.

Please Log in or Create an account to join the conversation.

More
17 years 2 months ago #6807 by roland76

Please Log in or Create an account to join the conversation.

Time to create page: 0.249 seconds