Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2010
    Thanked 0 Times in 0 Posts

    Getting a person's username from a wordpress cookie

    My friend has a code that will allow users to receive a special key to gain access into into the closed/open beta event for any game they select. When a person is logged in, they can click on a link which will show them a key. If a person is logged logged in, the event page will tell them to login. What my friend needs is a way to get the person's username from the wordpress login cookie once the person has logged in. We found out that the wordpress cookie name is unique to each user that logs in (in other words it has a string of random letters and numbers in the cookie name). Any ideas?

    The piece of code we have on our page that we are using is this:

    PHP Code:
    $username $_COOKIE["nameofcookiehere"
    We need the $username variable so that every key that is given will be assigned to the username that is logged in based on the cookie and the key will be marked as "1" or "taken" in the database and the key will be assigned to that user in the database.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Cottage Grove, Minnesota
    Thanked 1,096 Times in 1,087 Posts
    Use the WP Codex to get all of their information ...




    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts