Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a website where users can register, login and their edit profile, they can comment but not post.

What I am looking for is a way to display a user profile page (where I display the gravatar and the info about the user) clicking on the username. The url must be something like "www.mywebsite.com/user/username".

I know about author.php, but I don't know how to link even if the user has no posts and is not an author.

UPDATE:

I managed to solve it. Instead of linking using <?php the_author_posts_link(); ?> I did an href linking to www.mysite.com/user/<?php echo $user_info->display_name; ?>

To rename the slug I installed the Edit author slug plugin, it makes the author slug editable under Settings > permalinks.

To customize the user profile, just edit authors.php as you like.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Every registered user can have profile, they don't need to have posts.

To change Wordpress author's profile permalink, paste the following code in your functions.php:

function change_author_permalink_base() {
    global $wp_rewrite;
    $wp_rewrite->author_base = "user";
}
add_filter( 'init', 'change_author_permalink_base' );

After pasting the code, visit Settings->Permalink Structure under your wordpress admin, to flush the rewrite rules. This is a required step, otherwise you may get 404 on author profiles.

Then code your author.php. As far as linking is concerned this is totally your design decision. If you want to link the profiles from user's comment, you can either add the new link or just link comment author name to their profile.

Remember the profile is available only if the user is registered as Wordpress user.

share|improve this answer
    
I found how to do it (see "update") but with your code I can now remove the "edit author slug" plugin. Thanks! –  Andycap May 13 '11 at 11:04
    
Yes, I saw it after I posted. Glad you were able to find it your self. :) –  Hameedullah Khan May 13 '11 at 11:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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