This Should Work?
ALTER TABLE wp_usermeta ADD COLUMN old_user_id bigint(20) unsigned; INSERT INTO wp_usermeta (old_user_id) SELECT u.id FROM wp_users AS u; INSERT INTO wp_usermeta (user_id, meta_key, meta_value) SELECT u.id, 'wp_2_capabilities', meta_value JOIN wp_users AS u ON u.user_id = u.old_user_id; ALTER TABLE wp_users DROP COLUMN old_user_id;
Related Posts:
- In what part of the WordPress core does the users table and usermeta table get joined?
- Extend the wp_users table
- Select Multiple meta_value from WP DB; Single Query
- Getting all the users who have author privilege
- How to Access wp_usermeta Data Immediately After a New User is Created
- Best practice to import user base (subscribers) from one website to another?
- Users table missing from Database [closed]
- How to delete a particular row in a database table
- Recovering the table wp_usermeta from users
- Storing user submitted forms [closed]
- wp_insert_user not creating account correctly when ID is manually set
- Select From wpdb – Author/User Directory page
- how add more field to wp user and save it to database
- Move Non-WordPress users table to WordPress database
- How to get the id of recently registered user from database?
- How to get specific table by current user login
- update multiple user meta field based on another meta field
- Using wpdb to connect to a separate database
- WPDB Insert or if exists Update
- Multiple developers / editors working on a site in progress
- get_results using wpdb
- $wpdb won’t insert NULL into table column
- How many users can WordPress handle?
- Get error messages when $wpdb->insert() returns false?
- Detecting errors generated by $wpdb->get_results()
- Does dbDelta delete columns as well?
- wpdb update add current timestamp not working
- How to fetch Data in WordPress using MySQLi or $wpdb
- wpdb->insert multiple record at once
- WordPress Unit Testing – Cannot Create Tables
- How to define composite keys with dbDelta()
- Does wpdb add considerable overhead on queries with large result sets?
- How to track user progress?
- Why does $wpdb return strings for mysql integer values?
- $wpdb->prepare() warning in WordPress 3.5
- Inserting data into custom tables
- Hook into $wpdb
- Display data from a non wordpress database on a page template
- How does $wpdb handle COUNT(*)
- Performance tips for a large user base [closed]
- How might I retrieve a featured post image from an external WP site and display it as a link back?
- WordPress database error: [Query was empty] [closed]
- Export wordpress table to excel
- How to close wpdb connection? [duplicate]
- LEFT JOIN, INNER OUTER JOIN, LEFT OUTER JOIN is driving me crazy. Please help?
- Inserting Post Meta From SQL
- Search multiple meta keys at once
- Why does dbDelta() not catch MysqlErrors?
- Querying Email Addresses for a List of Users with Same Last Name?
- Connecting to external oracle database
- Efficiency on displaying random authors based on large database
- What’s the most efficient database method to add and query usermeta?
- Can’t save ajax value to database
- What causes the “max_user_connections” warning on WordPress frontend?
- $wpdb variable throw this error Call to a member function get_results() on a non-object in
- Updating all rows of table with $wpdb
- Safe way to find last inserted id in a table?
- How to execute mulitple statement SQL queries using $wpdb->query?
- Is $wpdb->prepare escaping to much? How to use it properly?
- Database slowdown after update to 3.4.1
- How to use user table of a different database for WordPress users?
- How to get top 10 user is based on user meta value
- When and why should I use $wpdb different return types?
- Subscribers to posts
- How wordpress accesses its own database
- Remove database entries where post_date > expiration date
- Error connecting to DB in /wp-includes/wp-db.php on line 1538 [closed]
- Set Display Name to first and last name (phpmyadmin SQL Query)
- update_user_meta() does not work
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- Get data from database using $WPDB
- How to use a different database to list and manage comments in the backend
- Is it possible to store visitors IPs in wp_postmeta table?
- Multiple postmeta with same name for one post in wp_postmeta table
- Which is more efficient? Using usermeta, or creating a new MySQL table?
- WP Database Table to CSV file
- Cannot update custom database table row
- wpdb_prepare with multiple or condition
- Does WordPress always create unique passwords?
- Show last modified date of database
- $wpdb->insert is not working
- Extracting the post_id via the wp_insert_post action (external db query)
- WordPress database error – Error in SQL syntax – I can’t identify any error?
- A field with dashes in the slug [closed]
- Why is it that not all users have a ‘session_tokens’ meta_key record in the usermeta table?
- Change WordPress prefix for only one table?
- Best way to tell if a user account is active, using the database only
- Multiple wp_options tables to share content across installs
- Advanced SELECT query with condtional statements
- $wpdb doesn’t like to store arrays
- Select two sums with single get_var statement
- WordPress choose wrong database
- Using GROUP CONCAT in my-sql query with wp_usermeta table
- wp_get_current_user always returns 0 continued
- mysql query two database tables, users and usermeta and sort by custom meta int value
- Is it safe to delete unnecessary user metadata?
- How to replicate a user plugin made table value, to this user’s custom meta table value?
- Redirecting to old domain after migration website
- Is there a smart way to obtain a list of only some selected user meta data?
- How can i customize the export personal data file?