phseven Posted January 28, 2021 Share Posted January 28, 2021 Is there an option to limit video downloads to premium users? Right now is possible to limit download to video formats but not to premium users. Quote Link to comment Share on other sites More sharing options...
Tech Support Posted January 29, 2021 Share Posted January 29, 2021 Yes, it is possible but not via settings, but via template. In Website UI -> Pages -> View Video page -> video_view block template there is the following code to render download links: {{foreach item="item" from=$data.download_formats}} {{assign var="format_lang_key" value=$item.postfix|replace:".":"_"}} <a href="{{$item.file_url}}" data-attach-session="{{$session_name}}">{{$lang.videos.video_details_label_download_format[$format_lang_key]|default:"%1%, %2%"|replace:"%1%":"`$item.title`"|replace:"%2%":$item.file_size_string}}</a> {{/foreach}} What you should do is change this: href="{{$item.file_url}}" with this: {{if $smarty.session.status_id==3}}href="{{$item.file_url}}"{{elseif $smarty.session.user_id>0}}href="{{$lang.urls.upgrade}}" data-fancybox="ajax"{{else}}href="{{$lang.urls.login_required}}" data-fancybox="ajax"{{/if}} So KVS will still display download links, but if non-premium user clicks this link there will be either login dialog (user is not logged in), or upgrade dialog (user is not premium status) displayed. 3 Quote Link to comment Share on other sites More sharing options...
Emilia Posted January 29, 2021 Share Posted January 29, 2021 Hi, what would be the code if I want to enable downloads for logged in members only? Quote Link to comment Share on other sites More sharing options...
Tech Support Posted January 29, 2021 Share Posted January 29, 2021 26 minutes ago, Emilia said: Hi, what would be the code if I want to enable downloads for logged in members only? Should be: {{if $smarty.session.user_id>0}}href="{{$item.file_url}}"{{else}}href="{{$lang.urls.login_required}}" data-fancybox="ajax"{{/if}} Quote Link to comment Share on other sites More sharing options...
Emilia Posted January 29, 2021 Share Posted January 29, 2021 Hi, it didn't work for me. here's my snippet {{foreach item="item" from=$data.download_formats}} {{assign var="format_lang_key" value=$item.postfix|replace:".":"_"}} <a href="{{$item.file_url}}&download_filename=mysite_{{$data.dir}}{{$item.postfix}}" data-attach-session="{{$session_name}}">{{$lang.videos.video_details_label_download_format[$format_lang_key]|default:"%1%, %2%"|replace:"%1%":"`$item.title`"|replace:"%2%":$item.file_size_string}}</a> {{/foreach}} Quote Link to comment Share on other sites More sharing options...
davex Posted January 29, 2021 Share Posted January 29, 2021 Thanks! 😉 Quote Link to comment Share on other sites More sharing options...
Tech Support Posted January 30, 2021 Share Posted January 30, 2021 13 hours ago, Emilia said: here's my snippet But it doesn't have the code that we specified... Quote Link to comment Share on other sites More sharing options...
Emilia Posted January 30, 2021 Share Posted January 30, 2021 6 hours ago, Tech Support said: But it doesn't have the code that we specified... Yes, can you tell me where to put it? It broke when i did it Quote Link to comment Share on other sites More sharing options...
Tech Support Posted January 30, 2021 Share Posted January 30, 2021 25 minutes ago, Emilia said: Yes, can you tell me where to put it? It broke when i did it Here: <a {{if $smarty.session.user_id>0}}href="{{$item.file_url}}&download_filename=mysite_{{$data.dir}}{{$item.postfix}}"{{else}}href="{{$lang.urls.login_required}}" data-fancybox="ajax"{{/if}} data-attach-session="{{$session_name}}">{{$lang.videos.video_details_label_download_format[$format_lang_key]|default:"%1%, %2%"|replace:"%1%":"`$item.title`"|replace:"%2%":$item.file_size_string}}</a> Should not brake anything. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.