You’ll have to write a plugin for that. See http://wordpress.org/extend/plugins/bp-blog-author-link/ for an example of how to filter the author URL.
Thread Starter
Nahum
(@nahummadrid)
Thanks Ron, I think i’m on to something here, http://wordpress.stackexchange.com/questions/14047/how-to-hide-redirect-the-author-page
Any clues to how to tie the author id to their blog? Any references/links would be just fine. I’m willing to dig around and learn.
Thread Starter
Nahum
(@nahummadrid)
add_action( 'template_redirect', 'authorblog_template_redirect' );
function authorblog_template_redirect()
{
$id = get_query_var( 'author' );
global $bp;
//two lines from bp_adminbar_blogs_menu() in bp-core-adminbar.php
if ( !$blogs = wp_cache_get( 'bp_blogs_of_user_' . $id . '_inc_hidden', 'bp' ) ) {
$blogs = bp_blogs_get_blogs_for_user( $id, true );
wp_cache_set( 'bp_blogs_of_user_' . $id . '_inc_hidden', $blogs, 'bp' );
}
if ( is_array( $blogs['blogs'] ) && (int)$blogs['count'] ) {
$blog=array_pop($blogs['blogs']);//the first blog
}
if ( is_author() ) {
// get_usernumposts() is deprecated since 3.0
$post_count = count_user_posts( $id );
if ( $post_count >= 0 ) {
//This line could also be wp_redirect
wp_redirect( $blog->siteurl );
exit;
}
}
}
This works at about 50%
For some reason if a user belongs to many other sites in the network as subscriber, this code doesn’t find the one that the author is Administrator on.
Any hints.
Thread Starter
Nahum
(@nahummadrid)
This seems to be working better…
add_action( 'template_redirect', 'authorblog_template_redirect' );
function authorblog_template_redirect()
{
global $wpdb;
$id = get_query_var( 'author' );
//two lines from bp_adminbar_blogs_menu() in bp-core-adminbar.php
$blogs = get_active_blog_for_user( $id );
if ( is_author() ) {
// get_usernumposts() is deprecated since 3.0
$post_count = count_user_posts( $id );
if ( $post_count >= 0 ) {
//This line could also be wp_redirect
wp_redirect( $blogs->siteurl );
exit;
}
}
}
The user’s blog must be set as their primary site under My Sites settings on there dashboard.
Is there anyway to ensure that that their primary blog is always their site?
Is there anyway to ensure that that their primary blog is always their site?
If they have more than one site they can change which one is the primary one.