I have a content type with a user reference field set to populate via URL.

I have tried node/add/type&field=49, node/add/type&field=username, node/add/type/field=49, and node/add/type/field=username

All combinations bring the following error:

Fatal error: Cannot use string offset as an array in /.../includes/form.inc on line 986

Comments

phayes’s picture

Status: Active » Fixed

Fixed

phayes’s picture

P.S: use the user UID. node/add/type&field=49

bflayler’s picture

I'm looking to pass the UID from the url of the user profile page into a user-reference CCK field. Based off an example of code from the URLfill documentation (http://drupal.org/node/590452) I assume I need to find the UID of the user I'm looking to reference. Would you happen to have any ideas how to get the UID? I've tried replacing "node" with "user" and "nid" with "uid" from the following example.

Thanks for any help.

<?php
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1);
  print "<a href='/node/add/page&field_myfield=$nid'>Reference this node to a new one<a/>";
}
?>
phayes’s picture

global $user;
$uid = $user->uid;
print "<a href='/node/add/page&field_myfield=$uid'>Reference this node to a new one<a/>";

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.