• 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 = [ ???? ].

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    Thread Starter [email protected]

    (@lancelfibernet)

    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()…??]

    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!

    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);

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Pass Parameters like "Username" and "Email" in hyperlink’ is closed to new replies.