I’m creating an app for a client that requires French content to be displayed to French speaking Facebook users. If the user is not French speaking, English content should be displayed. This needs to work in conjunction with the fan-gating.
This is what I have, however it’s not working. The fan gate is, but the French content is not displaying (yes, I changed my language in my Facebook settings to French).
To summarize, if the user is French speaking, show fan and non-fan French content, else show default English content.
Here is the code:
<?php
require 'facebook.php';
$app_id = "XXX";
$app_secret = "XXX";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];
$languageFR = $signed_request["user"]["fr_CA"];
if ($like_status) {
if ($languageFR) {
include("fans_french.php");
}
else {
include("fans_english.php");
}
}
else {
if ($languageFR) {
include("nonfans_french.php");
}
else {
include("nonfans_english.php");
}
}
?>
Shouldn’t your line about the language be:
Or even better, shouldn’t you be looking at [“user”][“languages”], and not the locale?