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:
$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.
get_currentuserinfo
not do it for you?