Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: bbPress Integration plugin for WPMU

Now I get an odd behavior:

– if the user logs in inside WP, he appears logged in in both WP and BB, but he can’t post in BB. If he has admin rights, he can’t see bb-admin.

– if the user logs in inside BB, everything works ok in both WP and BB.

So I redirected all logins to BB.

In mu-plugins I added the following:

function rk_login_redirect() {
if (strpos($_SERVER['REQUEST_URI'], 'wp-login.php') !== false && $_GET['action'] != 'logout' ) {
$url = 'http://foros.ryuuko.cl/bb-login.php';
$redirect = urlencode(wp_get_referer());
$url = add_query_arg('redirect_to', $redirect, $url);
wp_redirect($url);
}
}
add_action('init', 'rk_login_redirect');

In a plugin in my-plugins I added:

add_filter('wp_redirect', 'rk_redirect_location');
function rk_redirect_location($location, $status = 302) {
$arr = array();
$ref = wp_get_referer();
$url_array = parse_url($ref);
parse_str($url_array['query'], $arr);

if (isset($arr['redirect_to']) && !empty($arr['redirect_to'])) {
$url = urldecode($arr['redirect_to']);
$url_array = parse_url($url);
if (strpos($url_array['host'], 'ryuuko.cl') !== false)
$location = $url;
}
return $location;
}

Skip to toolbar