I'd like to have the authors name automatically created as a term for bio. NAT won't work as the created term doesn't link to the bio. I tried experimenting with computed field just to create a term using this code

 db_query("INSERT INTO term_data (tid, vid, name, description, weight) VALUES ('', 1,'someterm','', 0)");

This nearly worked. The term appears in the term_data table in mysql but not as a term in Drupal's vocabulary.

Afterwards when I try to add a term from the add terms form in Drupal, I get in error and then term which I tried unsuccesssfullly to insert using computed field then magically appears!

Any idea of code I can use to add a term to a vocabulary from computed field?

Once I get this accomplished I should be able to substitute the authors name using a variation of this code:

global $user;
$node_field_item['value'] = $user->name; 

Comments

notarealperson’s picture

Any luck with this? I am trying to accomplish the same thing!

lordgilman’s picture

I've posted my solution as a snippet here in the Computed Field handbook.