Registration can occur with just a username and email. Those fields are stored in wp-users
wp-users stores
ID
user_login
user_pass
user_nicename
user_email
user_url
user_registered
user_activation_key
user_status
display_name
The following data gets added when a user edits his profile
wp_usermeta stores
umeta_id
user_id
meta_key
meta_value
with the meta_keys being
first_name
last_name
nickname
description
jabber
aim
yim
wp_capabilities
wp_user_level
rich_editing
and the meta data displaying the data for each key.
Thread Starter
Phunky
(@phunky)
BigJohn, i know what is stored in each table within MySQL
My issuse is that the functions within WordPress dont seem to be updating the correct tables for my plugin.
update_user_option() is used in profile.php in the backend to update the users email and url and others use update_usermeta() but for some reason update_user_option() wants to place everything in wp_usermetadata
Im trying to stick to WP functions instead of using MySQL. Otherwise it would be simple!
Thread Starter
Phunky
(@phunky)
Ive bitten the bullet and just used $wpdb->query() and made it insert into the DB myself.
But i’ve come across a very strange issuse, below is the code im using to update the details of a user.
$wpdb->query("UPDATE wp_users SET user_url='$_GET[website]' WHERE ID='$_GET[id]'");
$wpdb->query("UPDATE wp_users SET user_email='$_GET[email]' WHERE ID='$_GET[id]'");
# update/create usermeta
$username = explode(' ',$_REQUEST[username]);
update_usermeta($_REQUEST[id],'first_name',$username[0]);
update_usermeta($_REQUEST[id],'last_name',$username[1]); update_usermeta($_REQUEST[id],'user_telephone',$_REQUEST[telephone]);
update_usermeta($_REQUEST[id],'user_company',$_REQUEST[company]); update_usermeta($_REQUEST[id],'user_addr1',$_REQUEST[address1]); update_usermeta($_REQUEST[id],'user_addr2',$_REQUEST[address2]); update_usermeta($_REQUEST[id],'user_city',$_REQUEST[city]); update_usermeta($_REQUEST[id],'user_postcode',$_REQUEST[postcode]); update_usermeta($_REQUEST[id],'user_country',$_REQUEST[country]);
Now the user_email and user_url at the top (one’s using $wpdb->query ) will only update if one of the usermeta feilds have been altered. If you just attempt to update the email or url on there own it just ignores it and refuses to update even tho it passes the query!
This really has got me confused!
Was curious if you found a resolution to this issue?
If not, I think I may have found a related thread here that might help:
http://wordpress.org/support/topic/68586?replies=4
BTW, I’m very insterested in your profile plug-in. How is that effort going?
Thread Starter
Phunky
(@phunky)
I basicly ended up writing my own function which would create a nice user object.
Also there is a sub-object within it with everything from wp_usermeta for that user.
Ive done it a few times over now :S i dont have the newest version of this at work, but if you want to have a look over the code email me on mark[at]phunky.co.uk and ill send you what ive done on my new project.
Hey,
Um, could this be used to update comments with new account information?
That is, could I use something like this to edit all comments with a new name, email address, and URI ? I am looking for a way I could update my old comments with my new account information. I have hundred of comments to update, and doing it by hand would be a nightmare. 🙁
See:
http://wordpress.org/support/topic/73508?replies=1#post-383593
Thanks,
Will