Wordpress- changing all subscriber passwords query

by Gina   Last Updated October 29, 2018 15:06 PM

I'm trying to mass change (120) subscriber passwords. The passwords are stored in table wp_users but I need to change the password based on information from another table wp_usermeta where it has information about what types of users there are.

I've been able to create this:

    UPDATE `wp_users` SET `user_pass` = MD5('default') WHERE `wp_usermeta` AND meta_value LIKE `%subscriber%` 

But I'm lost after WHERE since sql thinks I'm looking for a column called wp_usermeta when its actually a table.

    #1054 - Unknown column 'wp_usermeta' in 'where clause'

////Edit:

    UPDATE `wp_users` 
    SET `user_pass` = MD5('default') 
    WHERE EXISTS ( SELECT `meta_value` FROM `wp_usermeta` 
    WHERE `meta_value` LIKE '%subscriber%' )

But it changed all rows in the wp_users table.



Answers 2


Your WHERE clause is incorrect - you refer to 'wp_usermeta' but don't compare it to anything... Do you mean, perhaps WHERE wp_usermeta LIKE '%subscriber%' AND meta_value LIKE '%subscriber%'?

JHFB
JHFB
June 08, 2012 17:03 PM

UPDATE `wp_users` u, wp_usermeta m
SET u.user_pass = MD5('default') 
WHERE m.meta_value LIKE '%subscriber%' 
Mike Mackintosh
Mike Mackintosh
June 09, 2012 03:12 AM

Related Questions


Adding New Row (Record) To Each Existing Records

Updated May 30, 2017 06:06 AM


Modeling Database to Support Sub-Users for Users

Updated October 07, 2018 21:06 PM