Support » Everything else WordPress » 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 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.

    *Update*
    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I second this request. I have user pages that clients are redirected to at log-in, but if they navigate anywhere else on the site, I want them to easily be able to navigate back to their private personal page.

    Any hints or help is much appreciated!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Change the home link.

    If user is logged in, link ‘home’ to their home. Else, regular home.

    Change the home link.

    If user is logged in, link ‘home’ to their home. Else, regular home.

    Ipstenu, how do you do this? I have very limited knowledge of anything.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Variable links based on user’ is closed to new replies.