Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('show_user_profile', 'addCityField');
- add_action('personal_options_update','updateCityField');
- // show input field for city information on the user's profile page
- function addCityField() {
- global $user_ID;
- $legend = 'Location';
- $group = 'field_group';
- $prefix_html = " <fieldset><legend>$legend</legend>";
- $postfix_html = '</fieldset>';
- $body_html = '';
- $body_html .="<p><label>City</label><br />";
- $body_html .= "<input type='text' name='city' value='" . get_usermeta($user_ID,'city') . "' />";
- $body_html .= "</p>\n";
- echo $prefix_html.$body_html.$postfix_html;
- }
- // if user makes changes to city field on his profile page, save the changes
- function updateCityField() {
- global $user_ID;
- $city = $_POST["city"];
- update_usermeta($user_ID,"city", $city);
- }
Add Comment
Please, Sign In to add comment