0
任何人都可以告訴我如何使用配置文件位置模塊輸出完整的國家和州名稱? (Drupal 6)配置文件位置模塊 - 輸出完整國名
目前,它只會吐出華盛頓,美國華盛頓,美國。
作者說他已經添加hook_profile_alter在用戶視圖頁面上顯示國家和州長字符串值,但我不知道如何實現這一點。
有人可以幫忙嗎? 謝謝。
任何人都可以告訴我如何使用配置文件位置模塊輸出完整的國家和州名稱? (Drupal 6)配置文件位置模塊 - 輸出完整國名
目前,它只會吐出華盛頓,美國華盛頓,美國。
作者說他已經添加hook_profile_alter在用戶視圖頁面上顯示國家和州長字符串值,但我不知道如何實現這一點。
有人可以幫忙嗎? 謝謝。
添加此功能到您的custom module:
/**
* Implementation of hook_profile_alter().
*/
function CUSTOMMODULENAME_profile_alter(&$account) {
$profile = user_load($account->uid);
$category = variable_get('profile_location_category', NULL);
$country = variable_get('profile_location_country', NULL);
$state = variable_get('profile_location_state', NULL);
if ($state) {
$account->content[$category][$state]['#value'] = profile_location_get_state($profile->$country, $account->content[$category][$state]['#value']); // Here you can check state names.
}
if ($country) {
$account->content[$category][$country]['#value'] = profile_location_get_country($account->content[$category][$country]['#value']); // Here you can check country names.
}
}
[1]: http://drupal.org/developing/modules