WordPress.org

Ready to get started?Download WordPress

Forums

Pass Parameters like "Username" and "Email" in hyperlink (5 posts)

  1. lancel@fiber.net
    Member
    Posted 3 years ago #

    I would like to pass the "username", "email", and First and Last name for the user logged in to the next page using a hyperlink. I know the basic structure for the hyperlink but don't know how to recall the parameters. So for instance I need to pass the username in the hyperlink like Username = [ ???? ].

  2. vtxyzzy
    Member
    Posted 3 years ago #

    I gather from your comments that you know how to create the links, but not how to get the parameters back. You do that with the $_GET array. If you have a parameter 'username', you get its value with this:

    $username = $_GET['username'];

    Of course, it is wise to use strip_tags or other filters to prevent unwanted information from being included, and to check for valid values. See the Codex on Data Validation.

  3. lancel@fiber.net
    Member
    Posted 3 years ago #

    I need to know how to get the WP username(and other parameters like First Name, Last Name etc.) to pass to begin with. What you showed is helpful for picking it up on the other end but I still don't know where or how to get the name to begin with and assign it to some parameter. ie. "username" I thought that I could use "get_currentuserinfo()" to get the value/parameter but it does not seem to work for me. So in the hyperlink I would pass a value by something like Username = [get_currentuserinfo()...??]

  4. utzutz
    Member
    Posted 3 years ago #

    Off-topic:
    As far as I know there's no message feature... hence I try to contact you via your last activity: vtxyzzy please take a look at this problem

    sorry for the interruption!

  5. vtxyzzy
    Member
    Posted 3 years ago #

    You get the user's name with get_userdata, and the email with get_currentuserinfo.

    Once you have the data and the url, you can put it into the url for the page with add_query_arg, something like this:

    `$url = add_query_arg('email',$email,$url);

Topic Closed

This topic has been closed to new replies.

About this Topic