The following code in bio_menu():

34 : 	// user has a bio
35 : 	if ($nid) {
36 : 	  $node = node_load($nid);
37 : 	  $access = node_access('update', $node);
38 : 	}
39 : 	else {
40 : 	  $node = (object) array('type' => $type, 'uid' => arg(1));
41 : 	  $access = (($user->uid == arg(1)) && node_access('create', $type)) || user_access('administer nodes');
42 : 	}

Specifically line 40 has 'uid' => arg(1) which is useless since in node_form():

2052 : 	// If this is a new node, fill in the default values.
2053 : 	if (!isset($node->nid)) {
2054 : 	  foreach (array('status', 'promote', 'sticky') as $key) {
2055 : 	    $node->$key = in_array($key, $node_options);
2056 : 	  }
2057 : 	  global $user;
2058 : 	  $node->uid = $user->uid;
2059 : 	}

$node->uid will be overridden anyways in line 2058.

Comments

owahab’s picture

Status: Active » Needs review
owahab’s picture

Title: Useless code in bio_menu() » Code in bio_menu()

After testing, I found out that in line 40:
adding a 'name' => $user->name (without removing uid) makes managing bio nodes from paths rather then user/uid/bio working better.

sun’s picture

Status: Needs review » Needs work

Please submit a proper patch.