I have a page where user can change their personal info. Now I want to give them a possibility to change their personal page link by changing theire user nickname. So I want to create simple form with two fields and one button. This form will change this column in this table:
<form role="form" name="profile_name_form" id="profile_name_form" action="#">
<label>Name</label>
<input type="text" name="user_nicename" id="user_nicename" />
<label>Pin</label>
<input type="text" name="pin_code" id="pin_code" />
<div id="update_message"></div>
<button type="button" onclick="update_profile_name();">Update</button>
</form>
Firts field for nickname and second field for checking pin-code. So, user can change his nicname only if he know personal pin. I have another database "DB_test" with table "list" where only two columns: "profile_id" and "pin".
So if user will put correct username and pin-code to his profile form it will update "user_nicname" in WP database.
Example:
Short Questions:
- How to update "user_nicname" in "wp_users" table? It acan be the simple example, only important part of jQuery.ajax with response messages and other functions of this form.
- How to verify username and pin-code from a separate database? or a table inside current website if it will be faster and easier?
Thanks a lot for any helpful information!