Jump to content

Search the Community

Showing results for tags 'geoip'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General Discussion
    • Announcements
    • Business Discussion
    • Business Services
    • Sell and Buy
  • Themes & templates
    • KVS default theme
    • KVS paysite theme
  • Educational / support
    • Technical Support
    • FAQ
    • Educational Series

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 1 result

  1. In KVS there is no built-in support for country restrictions. The main reason is that KVS caching engine doesn't allow having these restrictions along with site caching, so for now we don't have any way to add this feature. However, if you discount caching aspect, it is possible to activate this feature with few theme adjustments. Disabling caching could have negative impact on your database load. But in this case you will only disable cache for video_view block, which is not the hardest block to be rendered. Step 1. First of all you need to switch off caching for the View Video page and video_view block on it. In order to do that go to Website UI -> Pages and search for video_view there. This will show you all pages that have this block (by default your theme will only have one page and block with caching time set to 3600 on both). Set caching time to 0 in both page and block fields (by default it will have 3600) and use Save caching option: Step 2. Go to Settings -> Customization and activate some custom text field in Videos. This will be the field where you need to list country codes of the countries where a specific video should be blocked. The format of the data is comma-separated list of 2-symbol country codes, for example like this: NOTE: the actual formatting doesn't matter, possible to specify in lower case, or without space between commas. Step 3. In Website UI -> Pages -> View Video page -> video_view block template find this fragment: {{if $data.status_id==5 || $data.status_id==2 || $data.status_id==3}} <div class="no-player" style="width: 100%; height: 0; padding-bottom: {{$player_size[1]/$player_size[0]*100|replace:",":"."}}%; background: black"> <span class="message">{{$data.delete_reason|default:$lang.videos.video_player_deleted}}</span> </div> {{elseif $is_limit_over==1}} .... Add the following block right before it: {{assign var="blocked_countries" value=","|explode:$data.custom1}} {{assign var="is_blocked_by_country" value="false"}} {{foreach from=$blocked_countries item="country_code"}} {{if $country_code|trim|strtolower==$smarty.server.GEOIP_COUNTRY_CODE|strtolower}} {{assign var="is_blocked_by_country" value="true"}} {{/if}} {{/foreach}} {{if $is_blocked_by_country=='true'}} <div class="no-player" style="width: 100%; height: 0; padding-bottom: {{$player_size[1]/$player_size[0]*100|replace:",":"."}}%; background: black"> <span class="message">This video is not available in your country</span> </div> and it order to make the smarty syntax complete you should changed {{if}} with {{elseif}} in the mentioned before block in the first line: {{elseif $data.status_id==5 || $data.status_id==2 || $data.status_id==3}} <div class="no-player" style="width: 100%; height: 0; padding-bottom: {{$player_size[1]/$player_size[0]*100|replace:",":"."}}%; background: black"> <span class="message">{{$data.delete_reason|default:$lang.videos.video_player_deleted}}</span> </div> {{elseif $is_limit_over==1}} .... IMPORTANT! If you fail to insert this block into the correct place, or to correct the IF -> ELSEIF logic, your template code may become broken and in this case it will stop rendering player. Then go to Website UI -> Change history to find the previous template version and restore it.
×
×
  • Create New...