Facebook block in Vietnam May 2016

Submitted by tomo on May 15, 2016 - 9:23pm

Is Facebook blocked in Vietnam right now? Over the past few years, the main ISPs and mobile operators in Vietnam either stopped blocking Facebook or only lightly blocked it (with easy workarounds). Earlier in the rise of Facebook maybe some officials thought it was feasible that the Facebook social network could be prevented from taking hold. Today it's quite clear that it already has.

The Facebook block happening in May 2016 also affects other Facebook properties/apps like Facebook Messenger and Instagram. This also breaks any websites which require Facebook to login.

I'm not in Vietnam currently, but I've had many friends there talk to me about the situation over the past few days. A lot of people on both Facebook and other social networks (like Zalo in Vietnam) are complaining about not being able to access Facebook but most of them are not talking about or questioning the reasons why it might be blocked now.

Since I'm not able to test the network conditions of Vietnam myself, I've heard from some friends in tech in Vietnam. At first, mobile operators VNPT and Viettel started blocking Facebook, but now other major ISPs such as FPT have joined the internet blockade. Whereas in the past a ban on Facebook simply meant that DNS requests for the domain would fail, which could be easily circumvented using a non-broken DNS server such as Google's public DNS servers ( and, this is no longer the case in Vietnam now.

Like in China, where not only Facebook but hundreds of American news and social media sites are blocked, the solution to a "firewall" blocking a particular website from your location is to use a VPN or a proxy server.

VPNs and proxies allow you to "masqueride" your originating IP address and to bounce around the firewall. You connect to the VPN or proxy server, which isn't banned (yet), and then from there you can freely connect to any other site as usual. The censors just think you're connecting to a normal website and let the traffic through.

Which VPN to use? Fortunately, there are a lot of VPN options, both free and paid. On your phone, you can find VPN apps listed in the app store or Google Play store. Some work on desktop as well, such as (google it).

The alternative to VPNs is web proxies (SOCKS or web). You can find lists of web proxies or use this one from HideMyAss. With these, you configure your browser's network settings to use a proxy and set the IP address and port which you found in a list.

You can also search the Chrome Web Store for proxy and VPN Chrome extensions which will simplify the process as well.

Drupal 6 Related Content

Submitted by tomo on January 24, 2013 - 11:09pm

Similar Entries 2 (6.2) - - doesn't work. But version 1 works like a charm. Version 2 spits up an error on array_filter. Looking at the code, my guess is it's related to some new Views plugin code in version 2.

Related Block - - would have been cool too. It's much like Similar Entries. Unfortunately, the search algorithm is way too narrow. At first, I couldn't tell if the module was even working. Then by weening the search terms down to 1 (which means it figures out a single relevant term and then searches for only that) I saw some results, but not on many nodes still.

Relevant Content - - is nice in theory. Currently, it's broken. It's in the middle of a rewrite, but it's looking more and more unlikely that it will ever get rewritten.

Related links - - is not what it seems. It just finds any referenced links in the content and groups them together. Nothing external.

Other modules are term (taxonomy) based. But ideally, you don't need to specify all the relevant terms, and you don't need to explicitly say that two terms are related. There should be a more intelligent way.

Say you have a bunch of blocks and you want them to be displayed on certain nodes of varying content type based on some criteria like the content type and some CCK fields or taxonomy. You can't do this with the stock block visibility settings without writing custom PHP code.

But we can implement it using some existing basic Drupal building blocks: CCK and Views

1. Create a content type called Visibility Block.

You might have a field for content type where the possible values are returned from code which returns an array of the content types (using function node_get_types()).

2. Then for any fields you want to match, you'll have the same fields in this content type. For example, if one of your content types has a textfield and the possible values are 1, 2, 3, then do the same for Visibility Block.

When you create a Visibility Block, you'll have your block content in the body as normal (optionally you could use Block Reference and create blocks like usual and then link to them in the node instead, but I see no point in the extra effort and redirection), then select the conditions for the pseudo-block being visible.

3. Now create a view called Visibility Blocks Viewed. You'll create block displays, one for each content type that you have a Visibility Block set for which may only be one or two of your c-types.

Create an overridden argument each block display for the content type -field- in Visibility Block. You want to match the content type of the viewed node with the field in the Visibility Block, which are not the same type of thing. So you'll need to convert the argument in code.

You'll call menu_get_object() to get the $node because it's better than "$node = node_load(arg(1));". For the chosen c-type for that block display you will check that the implied node's c-type is what ever type you want to show in this block display because you will also check any fields that are specific to this c-type. Use PHP to supply a value since no argument will be passed in, and have the code load the current node and return the type. Then use PHP for the Validator Options and if the c-type doesn't match then you will display empty text. If you have multiple c-types which share CCK fields then you can put them into a single block display.

4. For each content type, in the chosen block display you will create a new argument for each compared against CCK field. You will pick a field from V-block and then use PHP to return a default value of the currently viewed node's field's value. You won't need to do Validation on these arguments.

5. Finally, you may want to limit the number of nodes returned, maybe just one. Now give this block a title and save it and configure its region in the normal block admin.


Why not the normal block visibility settings?

Because there you can't even configure by content type (anymore in D6). You can configure by path glob and by PHP code which overrides the path glob field (including in the database).

So under "Page specific visibility settings", set to "Show if the following PHP code returns TRUE (PHP-mode, experts only).", the field is blocks.pages. Essentially, PHP code works by overriding the pages list.

Why not use Block Page Visibility?

Block Page Visibility ( enables site developers to centralize the display of blocks to a single PHP function. It is an alternative to controlling display via each block's configure form. The more "sometimes on, sometimes off blocks" that a site uses, the more useful this module becomes.

This takes over the visibility settings of all your blocks by calling:

$sql = 'UPDATE blocks SET visibility = 2, pages = CONCAT("<", "?", "php ", "return bpv_is_visible(\'", module, "-", delta, "\'); ", "?", ">") WHERE status=1 AND theme=\'%s\'';

Sometimes it's easier to configure a block by just whether you're logged in, or whether you're on the front page.

This module doesn't give you any finer grained controls. And you have to configure every block in code. You also lose all your current block visibility settings once you install this module. To use this module you have to implement your own bpv_config or bpv_configuration (I think it's a bug that it's looking for bpv_configuration but actually uses bpv_config).

Vietnam has been labeled an "enemy of the Internet" by Reporters Without Borders. There have been a lot of cases of bloggers being targeted, harrassed, and arrested. But RSF (Reporters Sans Frontieres - French for Reporters Without Borders) are possibly speculating heavily on many of their other arguments such as banning Internet (gaming) cafes near schools, the real origins of DDoS attacks, Considering Internet penetration in this rather populous country, with Internet usage continuing to rise rapidly each year, and an explosion of Vietnamese businesses operating on the web, it might be a bit of hyperbole to say that Vietnam and the Internet are enemies, just like people mistakenly still think that Vietnam and America are still enemies. But censorship of websites is an issue here in Vietnam. It's an issue in all of Vietnam's neighbors in Southeast Asia.

First, to the north of Vietnam lies the vast Middle Kingdom of China (China isn't properly part of Southeast Asia but it does border many Southeast Asian countries). China has been labeled #1 Enemy of the Internet for implementing a technologically advanced firewall (the Great Firewall of China). In China, hundreds of popular American websites are blocked including Google, YouTube, Facebok and Twitter. Search queries are also monitored for keywords and then stopped if a person is searching about a sensitive topic like the Tiananmen Square massacre. Chinese are forced to use local versions of social media (like Sino Weibo) which are more easily controlled by the Chinese government. You could try to draw parallels to Facebook versus Zing Me and other social networks in Vietnam but the huge difference is that Facebook is still accessible and the one and only social media platform in Vietnam. TOR (The Onion Router, used for anonymously browsing the Internet and TOR .onion sites) is also blocked in China.

Malaysia isn't your typical enemy of the Internet. Its government (like Vietnam) encourages a digital ("multimedia", a term from the 1990s) economy with various initiatives like Cyberjaya and the Multimedia Super Corridor and when those initiatives started, just as the Internet was blowing up around the world, the government declared that the Internet was to remain free and uncensored. But Convervative Muslims in charge do want to limit certain cultural shortcomings by censoring scenes in movies with nudity or even just cleavage and sex or even just kissing.

Singapore - the country where chewing gum is banned and could get you caned. It's also a country with a rather long blacklist of blocked websites, mostly porn sites like YouPorn or In Vietnam, pornography is illegal and you won't find Playboy or other girly mags being sold at magazine stands. But online, while ostensibly the Internet censorship laws are for blocking online porn, no porn sites are actually blocked (I've checked some of them - for research purposes). In Singapore, to a lesser extent, bloggers have been shut down and so has a random website about traveling while infected with HIV due to unfavorable portrayal of Singapore's policies towards HIV carriers. But no reports of bloggers being jailed unless they were also jaywalking, chewing gum, dancing in public places without a proper permit, bringing durian onto busses, or being a graffiti artist.

Thailand demonstrates a tactic that has been used in Vietnam, Cambodia, and probably many countries. Websites are not strictly speaking made illegal by the government. Rather, the government makes secret requests to ISPs to make certain websites unavailable. ISPs can decide to comply or ignore the request but ignoring the request comes at a high cost and so ISPs will generally block any website upon request. This means now over 100,000 websites are blocked in Thailand, putting it in the same league as China! Out of the rest of the countries in the region Thailand and Cambodia are the only kingdoms. Thailand has lese majeste laws making it illegal to insult the monarchy. This has led to arrests of people saying potentially offensive things about the king on social media sites like Facebook or even for liking or retweeting such statements.

Cambodia follows Thailand and Vietnam's leads when it comes to Internet censorship (Cambodia also gets their Internet connection from those two countries). When the government "requests" that certain websites are blocked the ISPs generally comply making it unnecessary to outright criminalize the websites in Cambodia. At the same time, governments deny censoring any websites and ISPs also release confusing messages regarding any block or whether it's an official block or just "technical difficulties". Like in Vietnam, certain blogs hosted by massive blogging platforms like Blogger and Bloghost have caused both entire platforms to be blocked by ISPs, not just the offending blogs. A certain controversial artists has had his website blocked, as has the NGO Global Witness, who fights againgst natural resource exploitation, corruption, and human rights abuses, probably for writing stuff like Cambodia should not stand for UN Security Council until land grabs and repression stop. Strangely, the prime minister of Cambodia briefly banned smartphones and 3G due to the potential of being able to view sexy streaming videos on one's mobile phone.

In Burma, the problem isn't just that some websites are blocked. Rather, all websites are slow and access can be unbearably limited to the point where they are functionally blocked. In general, Internet access is hard to subscribe to and then expensive to use, unaffordable for most Burmese. They also apparently have the same networking gear used for censorship as in China. With recent changes in attitudes towards the West and to media, with promises of no longer censoring newspapers, this is one country to watch in the future from any angle.

Laos, on the other hand, appears to not censor anything on the Internet.

Build your own FAQ in Drupal

Submitted by tomo on October 13, 2012 - 12:15pm

Websites, including Drupal sites, often need Frequently Asked Questions and answers to them. Drupal, as a content management system, should manage your question and answer content intelligently. With all the great modules contributed to Drupal's community you might think there are some good FAQ modules. In my experience, the Drupal FAQ module is too rigid, and therefore unusable for most of my sites. But we can build a FAQ system using basic Drupal building blocks.

What we need: taxonomy, blocks, views, a few lines of PHP (that can be stored in the database - no custom module required)

1. Content type: Create a new content type. CCK is optional here, as you can just use Title as Question and Body as Answer.

2. Vocabulary: Create a new vocabulary called FAQ. Add a few terms if only for testing.

3. Devel Generate: Optional - requires Devel module's devel_generate to generate some test nodes with test questions, answers, and topics. devel_generate can be run from the command line too if you have drush installed - just run "drush genc". Anyways, generate a few dozen nodes, as many nodes as questions you have. It'll be easier to mass edit the questions once the nodes have already been generated.

4. Views: You'll need two views although they can also be two displays of a single view, so let's do that.

a. Create a view, filtered by your FAQ content type (and published or published/admin).

You will add three node fields:
Node: Nid (Nid) [make this field hidden, but its value is used in the rewritten Question field below]
Node: Title (Question)
Node: Body (Answer)

For the Question, rewrite the output to:

<a name="q-[nid]"></a>

You'll have on argument, which is the Term (FAQ vocabulary topic) in the URL.

- Configure Argument Taxonomy: Term
-- Provide default argument
--- Default argument type: Taxonomy Term ID from URL
-- Validator: (Choose your FAQ vocabulary)
-- Argument type: Term name or synonym
-- (Optional) Transform spaces to dashes in URL

Now turn this default view into a page that's not overridden in any way. Set the URL to be something that's NOT your vocabulary name because your URL will conflict with the default taxonomy paths ("taxonomy/term/%" - which Taxonomy sets up path aliases for from each vocabulary with each term - but that page may also be being overridden by a view included by Views by default). So if you want your URLs to be like "/faq/return-policy" then name your Vocabulary like "FAQ Terms" instead of "FAQ".

At this point you should save your new view and be able to go to "/faq/troubleshooting" or whatever. It will give you a list of questions with answers. But usually a FAQ section will also list out all questions at the top with links to answers below. How can we accomplish that?

b. Let's create a new Display that's a Block. Now override the fields and remove the Answer field. Override the display of the Question to:

<a href="#q-[nid]">[title]</a>

Optionally, set a blank title for this field. Then we will have a block that is just a list of questions. But the argument won't work anymore since it's a block. So you need to override the argument "Taxonomy: Term".

- Default argument type:
-- PHP Code
--- return arg(1);

- Validator: Basic validation + Transform dashes in URL to spaces in term name arguments

This will find the term "charity" in the path "/faq/charity" and pass it on.

5. Now that the block is created, you need to make it display. We want to display it on the top of our first view!

This is assuming you have a region in your theme for blocks at the top of content in pages. You could choose another location but it should really appear as the first content you see. But you want this block to appear ONLY on this page! So in block admin, configure the block you just created, and under:

Page specific visibility settings
- Show block on specific pages:
-- [check] Show on only the listed pages.
- Type in "faq/*"

Save the block. Now your question list with links to answers further down the page should be appearing at the top of your FAQ pages!

7. Next, you need a list of your categories. Sadly, there's no easy way for Drupal to do this. Views has a view type for taxonomies which is unfortunately not very powerful and so we can't use it to get links to "/faq/[term]" as it doesn't allow us to rewrite our own links. It allows you to link to term pages but those pages are rendered by either the Taxonomy module or that default view I mentioned earlier. Trying to override those paths with our own view is a mess, probably due to weighting.

Anyways, we can easily create a list of topics with links with a tiny bit of PHP. Create a new block using the Block admin page. In the block body:

$tree = taxonomy_get_tree($vocabulary_id=YOUR_FAQ_VOCABULARY_ID_HERE);
$html = '<ul>';
if ($tree) {
    foreach ($tree as $term) 
        $html .= '<li>' . l($term->name, 'faq/' . str_replace(' ', '-', mb_strtolower($term->name))) . '</li>';
$html .= '</ul>';
return $html;

Again, set this block to only appear on "faq/*" pages. Then configure its location into a sidebar or somewhere and you will be displaying links to each of your FAQ topics and you're done!

Facebook in Vietnam 2012

Submitted by tomo on January 9, 2012 - 4:03pm

Happy 2012!

Despite one of FPT's divisions signing a contract with Facebook to be a Facebook developer partner in Vietnam, unlike what many folks here in Vietnam had hoped, it did not mean that FPT would keep access to Facebook flowing freely. Facebook isn't actually banned in Vietnam, it just suffers from "technical difficulties" from time to time that nobody seems to bother to investigate for the millions of users in Vietnam. So businesses still advertise and do business using Facebook as a platform. Even the State uses Facebook, with the Vietnam Administration of Tourism stating they will campaign on Facebook. I suppose they don't mind if only people outside of Vietnam can see the ads, even if most tourists in Vietnam come from Vietnam.

There are a number of theories as to why it's sometimes difficult to access Facebook in Vietnam. In China, it's outright banned. In Cambodia, it's just really slow, but otherwise doesn't suffer the same "technical difficulties" despite using the same Internet service providers as Vietnam (as Vietnamese telecoms serve as uplinks to Cambodian ISPs). Some of the conspiracy theories include pressure from rival social networks like Zing Me or the government's own, or that Facebook is blocked due to not paying taxes.

As of right now, FPT has started making it "technically difficult" to access Facebook, whereas Viettel seems to be okay, and VNPT is hit or miss (currently it is working on this VNPT connection), Mobifone is a no go. The usual method of changing your /etc/hosts file or your DNS will no longer work. Using apps like HotSpot Shield, VPNs, proxies, and SSH tunnels will always work. You can also use various apps including Seesmic or Hootsuite to access both Facebook and Twitter at the same time.

So if you don't want to play musical chairs with your ISPs as each one opens/closes access to Facebook, be sure to have one of the above in your arsenal of freedom.

If your ISP is blocking Facebook then you must use a general workaround such as Hotspot Shield (spammy) or a VPN like StrongVPN.

[This is the third post about Accessing Facebook in Vietnam

Lately, ISPs in Vietnam has begun randomly blocking Facebook again after a period of openness.  When it's blocked, even accessing Facebook via their Lisp4 server (or using the Saigonist DNS server) doesn't work.

But there are a number of apps, both web-based and desktop apps, which integrate with Facebook to different extents.  These apps, once you login to them with your Facebook account, can basically get your Facebook updates for you without requiring access to Facebook.

One such app is Seesmic, which has both a web and a desktop client.  Seesmic connects to a numer of social networks and I use it for reading my Twitter feed, with a custom hack to fix a serious problem with disappearing Tweets.  But once you login to Seesmic and connect it to your Facebook account, you can see your Facebook feed as well as messages.  That's enough for most people, most of the time.

Other desktop apps that can connect to Facebook are Bubbles and Hootsuite, but I wasn't able to get Hootsuite to connect to my Facebook account.

Another less convenient way is to use Opera's online demo of their Opera Mini browser.  It's a Java app and you use it like you're using a phone, but it will connect to Facebook for you (unless your browser doesn't let Java make network connections).

When I saw that Diesel released a desktop app called Excellbook as part of a marketing campaign called Be Stupid At Work, I was hoping it would also work in bypassing the Facebook block.  It's an Adobe AIR app, which requires installing Adobe AIR, and is generally a piece of crap.  Even if you can get it to connect, it will require a connection to Facebook still and so it's not so useful.  Nice idea, terrible execution and yet another example of a bad Adobe AIR app.

Syndicate content
© 2010-2014 Saigonist.