I would like to get the display name and email address for all users who have registered to my multisite today with the role of subscriber. It needs to be an SQL query as it’s used outside of the WP files.
I’ve gathered I need the following:
Table: wp_users
Columns: user_registered, user_email, display_name
Table: wp_usermeta
Columns: wp_6_capabilities = a:1:{s:10:”subscriber”;b:1;}
I’m guessing I need to get the user ID’s from wp_users of all users who have subscribed today, then check against wp_usermeta to narrow those results down by the user role. Then I need to go back to wp_users and get the email and display name.
I’ve been trying to write an SQL query to do this for a while and can’t seem to come up with anything.
Any help is appreciated.
Thanks.
I’m no SQL expert, but I think it would look something like this: