The problem is that $profileuser
is only initialised by user-edit.php
but the update is posted to /wp-admin/profile.php
and does not get as far as user-edit before running your user_contactmethods handler in the context of the save – i.e. $profileuser
is not available when actually running the update.
Fortunately there is another global $user_id
that is initialised both on the contact page and in the contact update handler. Instead, try:
function contactmethods($user_contactmethods) {
global $wpdb;
global $user_id;
$table = $wpdb->prefix . "table";
$myrows = NULL;
$myrows = $wpdb->query($wpdb->prepare('SELECT 1 FROM ' . $table . ' WHERE id = %d LIMIT 1',
$user_id));
if($ba_myrows == 1) {
$user_contactmethods['option'] = 'link';
}
return $user_contactmethods;
}
i.e. using $user_id
in place of your $id
calculated from $profileuser
.