Jump to content

Disable FB When users visit from China


ricky11

Recommended Posts

Since China blocks facebook, there is no use to attempt to display the Facebook module on the home page (using default theme) , even if the module displays asynchronously it will still not work,  It will only display a blank white box.

 

Many websites even some of the big names try to target China but fail because their site gets stuck by loading googleapi or Google fonts which are not allowed in China as well as Facebook. Often the site takes forever to load or gets stuck when loading a module.

 

Is their a way to disable modules based on user country?

 

 

Link to comment
Share on other sites

in themes/modules/blockfacebook/blockfacebook.tpl you have this code

{if $facebookurl != ''}
<div id="fb-root"></div>
<div id="facebook_block" class="col-xs-4">
	<h4 >{l s='Follow us on Facebook' mod='blockfacebook'}</h4>
	<div class="facebook-fanbox">
		<div class="fb-like-box" data-href="{$facebookurl|escape:'html':'UTF-8'}" data-colorscheme="light" data-show-faces="true" data-header="false" data-stream="false" data-show-border="false">
		</div>
	</div>
</div>
{/if}

You could do something like

{if $cart->id_lang!=2} 
{if $facebookurl != ''}
<div id="fb-root"></div>
<div id="facebook_block" class="col-xs-4">
	<h4 >{l s='Follow us on Facebook' mod='blockfacebook'}</h4>
	<div class="facebook-fanbox">
		<div class="fb-like-box" data-href="{$facebookurl|escape:'html':'UTF-8'}" data-colorscheme="light" data-show-faces="true" data-header="false" data-stream="false" data-show-border="false">
		</div>
	</div>
</div>
{/if}
{/if}

Assuming  2 is your id_lang for china

 

BTW this only works if user chooses china from the  language dropdown.....

Havent got a clue how to find out country automatically

Edited by mickeyboy1 (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...