I have basically disabled user accounts from being accessed, because I am using Profile2 module for user profiles. So there is no need to view the users account page. But in posts and forums in my site the username shows up by default and links to the user's account, not their profile. Is there a hook somewhere that I can use to have the user account path /user/uid, always point the the profile /main-profile/uid?

I know I can change the link in views, but I was looking for a site-wide solution. That will always make the username link to the profile. I'm thinking there has to be some hook I can use to redefine $user_path, but I can't figure it out.

1 Answer 1


You can use hook_menu_alter, it's not even too much work to do, just

anymodule_menu_alter( &$items)
    $items['user/uid'] = $items['main-profile/uid'];

clear cache and it will turns user/uid into nothing more than an alias of main-profile/uid.

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.