Drupal China
很简单
例子:
http://www.zaake.com
参考discuz的接口帮助文档
然后把它的接口function拷贝到logintoboggan.module(没安装这个的话直接拷贝到user.module中)
再后面跟着它自己写一个function以备调用
function discuzapi($action,$user){
$passport_key = '*************'; //放你的key
$member = array
(
//'cookietime' => 1800,
'time' => time(),
'username' => $user->name,
'password' => $user->pass,
'email' => $user->mail,
//'isadmin' => 0,
//'credits' => 1,
);
$forward = 'http://www.zaake.com'; //注册登录退出成功后都到主站,根据需要修改
$auth = passport_encrypt(passport_encode($member), $passport_key);
$verify = md5($action.$auth.$forward.$passport_key);
module_invoke_all('exit', $url); //注意这个!header之前先执行模块exit操作,以免报header重复错误等;
header('Location: http://bbs.zaake.com/api/passport.php?action='.$action.'&auth='.rawurlencode($auth).'&forward='.rawurlencode($forward).'&verify='.$verify); //其中改成你的论坛地址
exit(); //注意这个!以免报header重复错误等;
}到这里差不多了
把logintoboggan_process_login修改一下:
function logintoboggan_process_login($account, $redirect = ''){
global $user;
$user = $account;
watchdog('user', t('Session opened for %name.', array('%name' => theme('placeholder', $user->name))));
// Update the user table timestamp noting user has logged in.
db_query("UPDATE {users} SET login = '%d' WHERE uid = '%s'", time(), $user->uid);
// user has new permissions, so we clear their menu cache
cache_clear_all('menu:'. $user->uid, TRUE);
$edit = array();
user_module_invoke('login', $edit, $user);
discuzapi('login',$user); //这里调用!
if ($redirect != '') {
drupal_goto($redirect);
}
drupal_goto('user/'. $user->uid);
}然后把user.module中的修改一下
function user_login_submit($form_id, $form_values) {
global $user;
if ($user->uid) {
// To handle the edge case where this function is called during a
// bootstrap, check for the existence of t().
if (function_exists('t')) {
$message = t('Session opened for %name.', array('%name' => theme('placeholder', $user->name)));
}
else {
$message = "Session opened for ". check_plain($user->name);
}
watchdog('user', $message);
// Update the user table timestamp noting user has logged in.
db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $user->uid);
user_module_invoke('login', $form_values, $user);
$old_session_id = session_id();
session_regenerate_id();
db_query("UPDATE {sessions} SET sid = '%s' WHERE sid = '%s'", session_id(), $old_session_id);
//
discuzapi('login',$user); //这里调用!
// Create a timestamped final URL so that browsers don't return the user to
// a cached page (where it would appear as if they never logged in or out).
return array($_REQUEST['destination'], 'time='. time());
}
}function user_logout() {
global $user;
watchdog('user', t('Session closed for %name.', array('%name' => theme('placeholder', $user->name))));
// Destroy the current session:
session_destroy();
module_invoke_all('user', 'logout', NULL, $user);
// We have to use $GLOBALS to unset a global variable:
$user = user_load(array('uid' => 0));
// The time prevents caching.
discuzapi('logout',$user);//这里调用!
drupal_goto(NULL, 'time='. time());
}
有沒有demo site 看看
有沒有demo site 看看
DZ越来越没什么意思了
DZ越来越没什么意思了..
即使这样也比drupal的fo
即使这样也比drupal的forum强。:-)
Goooooooooood!要的就是这个!
数据库方面有何要求?适用于discuz与drupal各自分开的数据库,还是两者都在同一数据库?
cool! 要是能把dz完全整
cool!
要是能把dz完全整合进drupal就好了,就像那个drupal+vbb一样。
OSX86 China
http://www.osx86china.com
heartstrings
http://heartstringz.net
OSX86 China
http://www.osx86china.com
heartstrings
http://heartstringz.net
怎樣算是完全整合??
怎樣算是完全整合??
dz更改了passport后,怎
dz更改了passport后,怎么一直不见你新版的整合方案出来?
OSX86 China
http://www.osx86china.com
heartstrings
http://heartstringz.net
OSX86 China
http://www.osx86china.com
heartstrings
http://heartstringz.net
请问这个是统一用drupal 账户吗??
请问这个是统一用drupal 账户吗??
假如有更详细的解释就更好了.
假如有更详细的解释就更好了.