• How do I pass the username through a URL? This is specifically used to get to a third party site where both usernames have to be sync’d.

    I am just placing this in the HTML (and sidebar as a text widget). An example would look like this:

    Ex: http://www.domain.com/login.php?user_id=jsmith

    I just don’t know how to write the code that would grab the username and place it at the end of the URL. I’d be grateful for just a simple direction that I can Google.

    Thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • <?php
    global $user_login;
    get_currentuserinfo();
    if(!empty($user_login)){
    echo "<a href='http://www.domain.com/login.php?user_id=".$user_login."'>BLAH</a>";
    }
    ?>

    not tested.

    Thread Starter andytford

    (@andytford)

    haochi,

    This isn’t displaying as a link. It shows text that reads:

    BLAH”; } ?>

    I attempted a combination of “‘s and ”s to see if it made any difference. I need to research the syntax, but thanks for the help.

    <?php
    //global $user_login;
    //get_currentuserinfo();
    $user_login = "whoo";
    if(!empty($user_login)){
    echo "<a href='http://www.domain.com/login.php?user_id=".$user_login."'>BLAH</a>";
    }
    ?>

    tested from the cli, works fine.

    theres nothing wrong with the syntax he provided. there are no php errors within that.

    meh, I was askimeted. There is nothing wrong with the syntax in that, and it works properly.

    Thread Starter andytford

    (@andytford)

    Would there be an issue with placing it inside of a Text widget that would cause that?

    Would there be an issue with …

    I dont have a clue about that, sorry. I dont use widgets of any kind. Im old school 😛

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Passing a username through a URL’ is closed to new replies.