Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.

Commit 5caab39

Browse files
committed
Add helper function to get the session's current country or "global".
1 parent 3f6e24e commit 5caab39

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/modules/dosomething/dosomething_global/dosomething_global.module

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,19 @@ function dosomething_global_get_user_language($user = NULL) {
210210
return $countries;
211211
}
212212

213+
/**
214+
* Returns the session's country code, or `global` if it's not
215+
* one of our whitelisted global countries.
216+
*/
217+
function dosomething_global_get_country() {
218+
$country_code = dosomething_settings_get_geo_country_code();
219+
if (in_array($country_code, dosomething_global_get_countries())) {
220+
return $country_code;
221+
}
222+
223+
return 'global';
224+
}
225+
213226
/**
214227
* Gets the country from a given language.
215228
*

0 commit comments

Comments
 (0)