0

I'm using wp-usersonline plugin with user links, when you click for subscribers it goes to a not found page but works fine for authors, im thinking is there a way to redirect subscribers to a profile page and change the link into http://domain.com/member/profile=ID.

I found some scripts that will redirect to specific url but i dont know what to do next?

function new_author_base() {
    global $wp_rewrite;
    $author_slug = 'profile';
    $wp_rewrite->author_base = $author_slug;
}
add_action( 'init', 'new_author_base' );

2 Answers 2

0

You can try to catch the 404 template and redirect it to the author template which will usee the same template for all users even if they are subscribers (or any other which have zero posts) something like this:

function no_404_for_all_users($template) {
    global $wp_query;
    if( !is_author() && get_query_var('author') && (0 == $wp_query->posts->post) ) {
        return get_author_template();
    }
    return $template;
}

add_filter('404_template', 'no_404_for_all_users');
6
  • Still didnt work im testing it on a twentytwele template. But isnt there any changes just done on author.php it pulls author data so if its a subscriber then get_the_author_meta will not work? Sorry im kinda new to this stuff. Commented Mar 12, 2013 at 8:07
  • the twentytwele template shows the not found when the user has no posts but its still using the author.php template so you will need to edit that.
    – Bainternet
    Commented Mar 12, 2013 at 17:20
  • Do you have any samples? Please help or could you just give the query used in the author.php? Commented Mar 13, 2013 at 13:24
  • sample of what? the twentytwele author.php template has everything you need just look for the get_template_part('content','none'); which is what happens when a user has no posts.
    – Bainternet
    Commented Mar 13, 2013 at 13:27
  • How about when the user dont have posts just display the profile of them? Especially subscribers only. Commented Mar 13, 2013 at 13:29
0

Sorry atlast im free i have been looking to a user that has a space on the user name thats why im being redirected to 404, i removed get_template_part('content','none'); and replaced whith some author details and wallah! Its there. Thanks for the help. I will still figure out how to display with spaces we have just migrated this to wordpress. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.