I want to make a page for each user on my website. When a user logs in, I want them to be able to click on pages that are just designed for them (basically when they log in, I want them to be able to view their own profile). When another user logs in, I want them to be able to view their own profile.

Note: I want their profile called 'MY ACCOUNT' and I need to show that on the nav bar

Any ideas?

2 Answers 2


Based on this statement...

note: i want their profile called MY ACCOUNT to be on the nav bar

... and other parts of your description, I think what you want is not really to have pages that are "only members that are logged in". Despite the title of the questions, it sounds like you want a page that will show the current user's profile, which does only make sense for logged in users, but it is somewhat different than the title implies. Assuming that interpretation is correct...

Make a template file for you page

It should look something like this:

 * Template Name : CurrentProfile

if (is_user_logged_in()) {
  global $current_user;
  // now you should have a data in $currentuser; 
  // basically the *_users table data for the current user; see the Codex
  // get additional user data if desired
  $umeta = get_user_meta($current_user->ID);
  // now you have the *_usermata data for the current user
} else {
  // user is not logged in
  // do something or nothing as you please

Now make a page from the backend and assign this template to it. You now have a menu problem.

The menu Problem

It is easy to assign a menu item for this page but you probably don't want it showing up at all for user who are not logged int. The easiest solutions is CSS. If your theme uses the body_class function as it should, the <body tag for your page will have the logged-in for logged-in users, so use your stylesheet to hide the menu by default and show it only for pages with logged-in in the <body> tag. I can't write the CSS off the top of my head and it may be dependent upon your theme anyway.

That isn't the only solution. You create a custom walker for your menu or maybe hook into the walker, but the CSS solution is easiest and should be more than adequate.

Additional reference

http://codex.wordpress.org/Function_Reference/get_currentuserinfo http://codex.wordpress.org/Function_Reference/get_user_meta

if ( is_user_logged_in() ) {
    // logged in
} else {
    // not logged in


Explanation: first clause fires if the user is logged in, second clause fires if not, is that explanation enough mr. bot guy?


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.