Title: Variable Links based on User
Last modified: August 20, 2016

---

# Variable Links based on User

 *  Resolved [Dan Hannigan](https://wordpress.org/support/users/dhannigan/)
 * (@dhannigan)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/variable-links-based-on-user/)
 * **Objective:**
    Change “Home” or “Index” links to a specific link based on the
   user that is logged in, so that they’re forced to return to a specific controlled
   page.
 * **What I have so far**
    I’m using [Peter’s Login Redirect](http://wordpress.org/extend/plugins/peters-login-redirect/)
   and its super handy `[variable]username[/variable]` to redirect each user that
   logs in to their own specific page (which is built around custom post types and
   archives). So getting them to the right page after they log in is the easy part.
   Making it to where they can get back to that page after they’ve logged in, looked
   at their unique posts/other pages is proving to give me a headache.
 * Maybe the answer is pretty simple, and I’m just over thinking it… but any help
   would be great. Let me know if I can provide more information as well.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [Dan Hannigan](https://wordpress.org/support/users/dhannigan/)
 * (@dhannigan)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/variable-links-based-on-user/#post-2238466)
 * I was digging around more and stumbled across this on the website for Peter’s
   Login Redirect:
 * > Reply from Peter: If you are trying to make a link to the redirect URL you’d
   > set up for a specific user using my plugin, you’ll find the username in the“
   > rul_value” field and the URL in the “rul_url” field in the [wp]_login_redirects
   > table. So you can write a database query to get the proper URL for the currently
   > logged in user.
 * So that sounds like a solution, problem is I don’t know how to create a database
   query… I know basic PHP, but if someone could even point me in the right direction
   on how to do this, or give a coding example (if it’s easy) that’d be great.
 *  [janesae](https://wordpress.org/support/users/janesae/)
 * (@janesae)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/variable-links-based-on-user/#post-2238643)
 * Hey man, I feel your pain. I did happen upon this article. Haven’t read it entirely
   but sounds like what we’re after:
 * [http://wordpress.org/support/topic/my-crack-at-a-client-login-sectioncustomer-portal](http://wordpress.org/support/topic/my-crack-at-a-client-login-sectioncustomer-portal)
 *  [janesae](https://wordpress.org/support/users/janesae/)
 * (@janesae)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/variable-links-based-on-user/#post-2238644)
 * try this <a href=”yourdomain.com/<?php global $userdata;
    get_currentuserinfo();
   echo( $userdata->user_login );?>”>Client Page
 *  Thread Starter [Dan Hannigan](https://wordpress.org/support/users/dhannigan/)
 * (@dhannigan)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/variable-links-based-on-user/#post-2238650)
 * Sorry I’m not responding till now, just got in to work and tried out that code
   and boom! It worked! I did have to add a full [http://www.mydomain.com/](http://www.mydomain.com/)
   addy in order for it to work, but it does! Thanks so much!
 *  [whoknowsjo](https://wordpress.org/support/users/whoknowsjo/)
 * (@whoknowsjo)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/variable-links-based-on-user/#post-2238730)
 * Can one of you please clarify how you made this work? I’ve been hunting for this
   solution for weeks. Where did you put this code:
 * <a href=”yourdomain.com/<?php global $userdata;
    get_currentuserinfo(); echo(
   $userdata->user_login );?>”>Client Page
 * Did you have to make a Client.php page?
 * Thanks for your help!
 *  [tadindustrial](https://wordpress.org/support/users/tadindustrial/)
 * (@tadindustrial)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/variable-links-based-on-user/#post-2238738)
 * Yeah, I’m having the same issue. Please help!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Variable Links based on User’ is closed to new replies.

## Tags

 * [links](https://wordpress.org/support/topic-tag/links/)
 * [redirect](https://wordpress.org/support/topic-tag/redirect/)
 * [users](https://wordpress.org/support/topic-tag/users/)
 * [variable](https://wordpress.org/support/topic-tag/variable/)

 * 6 replies
 * 4 participants
 * Last reply from: [tadindustrial](https://wordpress.org/support/users/tadindustrial/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/variable-links-based-on-user/#post-2238738)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
