• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to control login/logout redirect throght XF?

I use Xenscripts to bridge WPMU and Xenforo. After several days trying, now it seems to work but there are some problems:
1. My WP main site at domain.com and XF at domain.com/community. When a user login at domain.com it leads to XF login page and after login this user will redirect to domain.com. This is OK.
However, at sub-domain like blogs.domain.com when a user login and it leads to XF login page, after login it redirect to domain.com/community but not to blogs.domain.com as I expect. Though I can see this http://domain.com/community/login?redirect=http://blogs.domain.com/ in the address bar? I want to make it redirect to http://blogs.domain.com.
2. When a user logout it always redirect to XF logout page and after logout it stays on XF forum Home. I want to redirect to WP previous page when user click logout.
This is my cookies set:
$config['cookie'] = array(
    'prefix' => 'xf_',
    'path' => '/',
    'domain' => '.domain.com'
Thank you for your help.