You can can read the cookie and check if the current user is logged in using get_current_user_id(). If they are just save the cookie value to the user_meta.
$cookie_name="";
if( isset( $_COOKIE[$cookie_name] ) ) {
$user_id = get_current_user_id();
if( $user_id ) {
$meta_key = $cookie_name;
$meta_value = $_COOKIE[$cookie_name];
update_user_meta( $user_id, $meta_key, $meta_value );
}
}
Related Posts:
- Shared functionality in plugins and themes
- Keep one user logged for a year?
- Plugin (or Theme) containing its own Plugins?
- How to enable edit button in the theme’s customize UI?
- Themes VS Plugins [duplicate]
- Recommendations for books/resource to get started with wordpress 3 development (plugins/themes) [closed]
- ‘Customize’ button in admin bar for CSS
- Auto delete WordPress users according to time
- Is it possible to use WordPress as an online portfolio for text content? What kind of theme would I look for?
- How to get current post user id
- How to read individual user’s directory and display content to that specific user?
- Custom wordpress Theme and Plugin repository
- “No Add Button” for me to customize my WordPress with themes and pluggins
- Basic gallery plugin suggestion [closed]
- how can I query all wordpress users of a blog
- Moving FB comments at the end of page
- How to handle a WordPress blog with articles in different languages?
- display unique post per category
- Display WordPress comments before the plugins?
- Mobilepress fails to translate short codes
- How to prevent plugin, theme installation failures on WordPress?
- Can we hide a certain user in WP?
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- How can I store user preferences in WordPress and retreive them later?
- WordPress delete cookie
- Confusing problem with displaying message recipient metadata
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- Need Help Creating a Multi-Step, Video-Guided Enrollment Site
- Issues with Post 2 Post Plugin
- How can I modify the colors of my theme for a single section of my site? [closed]
- do_shortcodes() isn’t working
- How to make wordpress backend mobile optimized.?
- How to give different user access to different people?
- custom user profiles like linktree fully customizable on the front end
- How to import my YouTube channel into WordPress?
- Custom Field Template seriously messed up in WP 3.1.1
- My Category is too big on the Menu what can i do?
- how to load the language file in plugin?
- Plugin upgrade issue
- Not able to open category post [closed]
- How to use get_theme_mod in gutenberg editor wordpress?
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- How to embed HTML code from WP Coder plugin (or other) into Main Index Template of the theme
- Reusable functions and tools (Framework)
- How To Clean The Malware Infected & Hacked WordPress Websites? [duplicate]
- Do I still need a theme to use page builders?
- WordPress plugin – Error “Plugin generate 2890 characters of unexpected output when activated”
- How to prevent users to download videos from lms website?
- How can I capture Memberpress user info after signup [closed]
- My plugin wants to update another plugin
- Why is my staging subdomain not sending wordpress_logged_in cookies?
- Only Homepage not loading properly
- I have no idea “How change font for elements in widget?”
- View Private Published Page with URL Code (no login required)
- Uncode theme content block header ignoring saved changes/not updating?
- Two (or more) looks, with one set of content
- Using custom JS plugins with WordPress?
- Different UI in WordPress
- Theme and plugin install or update display error in localhost
- Re-naming a theme/child theme whilst maintaining updates
- JS Support Ticket – Auto create WP account
- Can I make a super plugin that also has a theme?
- How to show Recent Page instead of Post?
- Reduce Drop down Menu Width in WordPress
- How to delete Passwrd Protected posts cookies when a user logged out from the site
- Remove Duplicator plugin from admin menu if not an administrator
- plugin style conflicts, how to override? [closed]
- Unable to upload wordpress plugins
- The problem with WordPress Importer
- How to create user groups and allow custom posts and plugin modify/access to specific group?
- How to disable CSS rule in Twentythirteen style.css?
- Input with spaces in Shortcode attributes overwritten by defaults
- Prevent WordPress installing plugins and themes via Admin
- New User Form – Custom Menu Page
- Add a custom form on the post-new.php admin page
- Removing customise fields during plugin uninstallation
- WordPress Central User Database
- Plugin Handle URL With Custom Theme
- Globally register styles but enqueue them selectively
- Edit Yoast SEO breadcrumbs output [closed]
- What’s the best way to implement AJAX in WordPress?
- How to Create a Custom Panel and Fields in Post Page [Plugin]
- Translating long texts with html formatting
- Guidelines / restrictions about advertising /donate begging unside wordpress plugins or themes
- How would I go about creating a user ranked post popularity page?
- Admin Theme customization
- Hooking in to replace the Sidebar/Widget areas
- WSOD after upgrading to 3.1
- Anonymous Postings
- Do widget options need to be escaped widget()?
- Is there any W3C compatible Share & Follow plugin?
- Does any one have Idea to get these functionalities with the plugin wp-multi-network
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- How to save generated JWT token to cookies on login?
- Disable woocommerce cookies and delete cart data automatically
- Check for security updates
- className not populating in custom block
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- WordPress Keeps Logging Out – What Tests Can I Run to Solve This?