【发布时间】:2011-02-22 02:21:06
【问题描述】:
我有一个用于房地产代理的 drupal 6 网站。由于每个代理都有自己的 url,我想将他们全部引导到主网站,并为每个域名使用不同的主页(在这种情况下,他们的用户个人资料页面可以查看他们的属性)。
到目前为止,我使用模块的 init() 函数来检查域是否与主域不同,并找到该域属于哪个用户。
我知道我可以使用 drupal_goto('users/username') 但我更愿意在不更改 url 的情况下这样做。这样,站点看起来对代理更“自定义”,而不是主网站中的重定向。
这是我的 init() 函数的代码:
if(!strstr($_SERVER['SERVER_NAME'],'maindomain')){
//look in profile field id 8 to which user the domain belong
$value = db_result(db_query("SELECT uid FROM {profile_values} WHERE fid = 8 AND value like '%s'"), $_SERVER['SERVER_NAME']);
if($value){
//store the uid in $agent_site for further use
global $agent_site;
$agent_site = $value;
if(drupal_is_front_page()){
//Do the equivalent of drupal_goto('users/username') without modifying the url
}
}
}
非常感谢您的想法。
【问题讨论】:
标签: php drupal drupal-6 drupal-modules