How to control login/logout redirect throght XF?


Active member
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 and XF at When a user login at it leads to XF login page and after login this user will redirect to This is OK.
However, at sub-domain like when a user login and it leads to XF login page, after login it redirect to but not to as I expect. Though I can see this in the address bar? I want to make it redirect to
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' => ''
Thank you for your help.