Updating custom user meta

You can create a similar solution as the one with a form and submit button by adding an onclick event to your button:

<button id="updateMyUserMeta" name="updateMyUserMeta" onclick="window.location.href('http://example.com?my_custom_user_meta=true');">Update</button>

Then add this to the functions.php of your theme.

/**
 * Updates the 'my_custom_user_meta' field if the
 * user clicks the 'Update' button.
 */
function update_my_custom_user_meta() {

  if (empty($_GET['my_custom_user_meta']) {
    return;
  }

  $user_id = current_user_id();

  if (empty($user_id)) {
    return false;
  }

  update_user_meta( $user_id, 'my_custom_user_meta', true); 
}

add_filter('init', 'update_my_custom_user_meta');

Change http://example.com to the URL of your site and change my_custom_user_meta to the name of your user meta field.

To make this secure you should also look into adding nonce checks.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)