Change the default value of the node reference via hook_alter_form
I can't think of any reason why your code would need to be in an after_build function, you would usually put it straight into the form alter hook. At the moment you've got the array keys the wrong way round. Without being able to see the structure of your form it's difficult to say exactly where the correct element is, but one of these should work:

function mymodule_form_node_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  global $user;

  // Try this one
  $form['field_userid'][LANGUAGE_NONE][0]['#default_value'] = $user-&gt;uid;

  // Or this one
  $form['field_userid'][LANGUAGE_NONE][0]['uid']['#default_value'] = $user-&gt;uid;
}