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?
- Best collection of code for your 'functions.php' file [closed]
- Tips for using WordPress as a CMS? [closed]
- How to get the active theme’s slug?
- Get a button for in the Editor
- How can i force Display names to be the same as Usernames?
- Set active theme via URL
- Image Crop/Resize Function/Code Sinppet/Plugin to adjust/crop images during upload
- WP get_permalink Return Wrong URL
- WordPress Plugin for One-Time Event Registration? [closed]
- Will WordPress username displayed somewhere in the site?
- dequeue not work
- MailChimp integration that allows users to select from multiple lists [closed]
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- Translating plugin inside the theme [closed]
- Current user in plugin returns NULL
- Copyright messages for a particular set of pages
- Unable to install theme recommended plugins on Multisite
- More than one text-domain is being used because of the included templates for plugins
- how to load the language file in plugin?
- View Private Published Page with URL Code (no login required)
- Different UI in WordPress
- Hooking in to replace the Sidebar/Widget areas
- Send reply with pre-prepared answers
- Why namespaces are rarely used in WordPress plugins?
- How create Group Blogs based on user created Groups
- Custom table naming/access convention for multisite: $table_prefix vs base_prefix or other?
- Best practice for including plugin output in a template without using shortcode?
- How to load different homepage on Mobile.?
- How to change the wp_upload_dir() path in plugin
- Disable plugin only for one post
- How to execute plugin and theme updates from a web hook / endpoint?
- How to translate WP Blog (search, category etc.)?
- How do I set up XAMPP to allow me to download plugins and themes?
- Advanced WordPress plugin activation detection
- how to change wp-admin url using function file
- How to pass a query string to another page on the same site?
- Calling a save function from a “submit” button
- Renaming Custom Taxonomy Values
- Add a “default sorting” menu to child store pages
- Custom Module, Extending WP with a Plugin?
- Rename Smart YouTube’s httpv back to http for all posts
- “User need to be logged in in order to make a booking” issue
- Custom Plugin scripts from admin working in frontend
- Disable Author Archive just for certain roles in bulk
- Create automatic latest version link
- How to Access a file that is inside a plugin’s dir from the theme’s `functions.php` file
- How to make PDF books readable on site with woo-commerce?
- Removing Plugin Action via Theme for Non-admins
- Why does plugin_url append absolute file path?
- How to see in Edit Comments if comment is from User and her Roles
- How to make a website with two types of logins , Sellers and buyers?
- Why all my wordpress sites keeps telling me that everything is up to date at /wp-admin/update-core.php?
- Translation plugin with default language?
- Using activated_plugin to run code
- How to order users alphabetically by name? in plugin UPME
- Custom pages with plugin
- Theme styling for plugins
- jquery-issue: cannot load the basic jquery
- How change menu for each user in plugin?
- Why do I get this “peer’s certificate issuer not recognised” error when trying to install a theme?
- WordPress Code Access to Restricted Content without Registration
- Any plugin/theme available which suits my requirement? [closed]
- How to pre-set WordPress settings for specific posts?
- Two sites one PC
- How to escape html code?
- Product customizing quiz – quiz adding products to the cart
- How to make a Template page to show the information of different things Shop and Product page?