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 am building a client portal where my clients can log in and see all their pending projects, completed projects and create new projects.

Though I'm stuck at the start.

The dropdown menu is called "My Projects"
If "User 1" is logged in and they click on "My Projects" then I need that link to link to:
mysite.com/client-portal/my-projects/(USERID or USERNAME)/

This will be their dedicated page so if user 1's username is johndoe the link will be my-projects/johndoe/

If user 2 (janedoe) is logged in. when they click "My Projects" they will be taken my-projects/janedoe/ and so on, so fourth.

So basically I need a %username% permalink I can put into a custom menu link that will change %username% with the current logged in user's username.

Can this be done?

share|improve this question

1 Answer 1

WordPress has a built in function for getting the current user:

<?php wp_get_current_user(); ?>

My approach would then be to create a variable such as:

<?php $userid = wp_get_current_user(); ?>

Then in your HTML just do this <a href =userportal?<?php echo $userid ?> >menu <\a>

Then just use the php GET variable to get the user id from the url and you can use that to get whatever details you need about the user.

That way instead of making a new page for every user you can use AJAX and request the portfolio of any user based on their ID. Much easier and more scaleable in the long run.

share|improve this answer

Your Answer


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.