get_currentuserinfo();
$username = $current_user->user_login
That should work to get the current user’s username. You can read more about get_currentuserinfo();
here in the codex. It pulls all the base info about a user – username, display name, email, first/last name, and user ID.
This will be handy since you can verify the user based on username, then assign the key in the DB according to UID.
Related Posts:
- Can’t log in: “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”
- Login page ERROR: Cookies are blocked due to unexpected output
- Removing username from the ‘wordpress_logged_in’ cookie
- Getting “Cookies are blocked or not supported by your browser” on login page
- Cookie settings for session across WPML subdomains using custom AJAX login
- Login redirect_to loop with reauth=1, cookie expiry set to 1 year in past
- Get user ID after logging in
- Login with cookie but without using WordPress code
- Get wordpress stored cookies for custom login
- How to get login data (session) outside WordPress?
- Login cookie across multiple domains on network w/ mapping
- Can’t login after URL change
- How to set different cookies for logged in admin users and logged in non admin users?
- 2 wordpress blogs with 1 users table and 1 login
- Logins through alias
- v5.6.2 User cannot stay logged in – wordpress_test cookie placed but not auth cookies
- Removing wordpress cookie from non-wordpress site
- One time login on 2 different WordPress sites
- How to force “remember me” users to login again?
- Multiple issues with Ajax login function due to browsers and cookies
- Sharing a logged in session with a custom subdmain site?
- Get WordPress logged in username from root domain when WP is installed in a subfolder
- wp-cron event doesn’t run when custom login API is enabled
- Extend Cookie with auth_cookie_expiration not working
- Custom login method appears to ignore auth_cookie_expiration
- Why deleting/removing cookies in WordPress does not log me out from admin?
- Cookies error during first time login attempt
- Opening protected page with cookie?
- WordPress Cookies – wp_set_auth_cookie
- Why doesn’t the “Remember Me” checkbox work for me on a live website? Only works on a local server environment
- Share login status across subdomains without network
- How to remove without touching the pluggable.php the wordpress_logged_in cookie to show the username on login?
- In Django, how do I know the currently logged-in user?
- Can I programmatically login a user without a password?
- Is there any way to rename or hide wp-login.php?
- How to login with email only no username?
- How can I redirect user after entering wrong password?
- Increase of failed login attempts, brute force attacks? [closed]
- Separate registration and login for different roles
- SSO / authentication integration with external ‘directory service’
- Preventing session timeout
- How reduce wordpress login session timeout time?
- How to prefill WordPress registration with social details
- Check for correct username on custom login form
- Disallow user from editing their own profile information
- I can’t access my site via wp-admin
- ‘Password field is empty’ error when using autofill in Chrome
- How to show ‘login error’ and ‘lost password’ on my template page?
- What is $interim_login?
- Custom login form
- How to prefill the username/password fields on the login page
- wp_signon returns user, but the user is not logged in
- Adding extra authentication field in login page
- Prevent wp_login_form() from redirecting to wp-admin when there are errors
- Redirect user using the ‘wp_login_failed’ action hook if the error is ’empty_username’ or ’empty_password’
- wp_signon() does not authenticate user guidance needed
- What exactly is ReAuth?
- What are the differences between wp_users and wp_usermeta tables?
- wp_set_auth_cookie() doesn’t work in Ajax call
- Login members using web services
- Make my wordpress blog remember my login “forever”
- How to check in timber if user is loggedin?
- How do I change the language of only the login page?
- Disable WordPress 3.6 idle logout / login modal window / session expiration
- Stop WordPress from logging me out (need to keep me logged in)
- Woocommerce registration page [closed]
- How to disable autocomplete on the wp-login.php page
- Share login data/cookies between multiple installations
- Synchronize WordPress user accounts across multiple domains and installations without using WordPress MU
- How to pass users back and forth using session data?
- How do I change the logo on the login page?
- Why does WordPress hide the reset password key from the URL?
- Is it possible to sign in with user_email in WordPress?
- How to use current_user_can()?
- Avoid to load default WP styles in login screen
- WordPress registration message
- How to fake a WordPress login?
- how to display the wordpress login and register forms on a page?
- Does wp_logout_url() destroy a session? (Logging out question)
- How can I send a welcome email to a user AFTER they login for the first time?
- Can not login with correct username and password
- Website Visible only to Registered users
- How can i increase the login expiration length?
- How do I use add_action from a class method?
- How to remove the WordPress logo from login and register page?
- How can I add a custom script to footer of login page?
- Brute force attack?
- Customize wp_new_user_notification_email()
- Need to execute a cron job
- Login email after registration never sent or received
- How can I create a separate blog that is private?
- How to keep always logged in development environment
- Add Confirm Password field in wp-login.php Password Reset page
- Integrate recaptcha and wp_signon – what is needed?
- Stop users from logging in from multiple locations
- I want to disable E-Mail verifcation / activation when a user signs up for my WordPress site
- custom login page redirect to logged in user profile page
- Email address or username used to login in wordpress
- How do I check if a post is private?
- Front-end login: Redirect user to the post they had created