I request the option to add the posting user's username to the author list automatically on opening the posting form.

CommentFileSizeAuthor
#8 author_taxonomy_autocomplete.diff955 bytesdedalu
#5 mods.txt5.76 KBchawl
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nicholas.alipaz’s picture

I have added a hook_form_alter(), in a module I made, to my posting form for the time being:

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'my_formid_node_form') {
    global $user;
    if (!$form['taxonomy']['tags']['8']['#default_value']) {
      $form['taxonomy']['tags']['8']['#default_value'] = $user->name;
    }
  }
}

Still, would be a nice feature to add.

EDIT: added a quick if statement (line 5) that checks to see whether the field is empty before filling it in. Otherwise it wipes out any old values one might have.

Robbie Sternenberg’s picture

Assigned: Unassigned » Robbie Sternenberg
Status: Active » Fixed

Added this feature. Thanks for the suggestion.

nicholas.alipaz’s picture

thanks for the addition. I will grab the new version soon!

Status: Fixed » Closed (fixed)

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

chawl’s picture

Version: 6.x-1.7 » 6.x-1.x-dev
Component: User interface » Code
Assigned: Robbie Sternenberg » Unassigned
Category: feature » bug
Status: Closed (fixed) » Active
FileSize
5.76 KB

Relevant setting is not working for us. I even stripped the conditionals in author_taxonomy_form_alter() without success. Term textfield never gets the real author name or hardcoded test values when the node is saved.

And yes, we are using Ctools, but node/edit/% overrider is disabled.

Why I suspect Ctools that some other modules like HS also have/had trouble accessing or altering form values with Ctools enabled.

If I am missing something, sorry in advance.

Tx.

D 6.15, Ctools 6.x-1.x-dev (Jan 12), and others attached.

chawl’s picture

Version: 6.x-1.x-dev » 6.x-1.8

Pardon me...

dedalu’s picture

If an 'user name' is associated with an 'author term', then the linked 'author term' should be added to the list, not the 'user name', since they may differ.

Thanks.

dedalu’s picture

For #7, I propose this patch (attached).

ckng’s picture

IMO, this feature is incomplete and flaw
- shouldn't the username is appended to existing taxonomy list (author list) instead of overwritten? This help simulates multiple authors or at least that's my interpretation from the description "Automatically add username to author list"
- author term as in #7, example use case is RealName as author term that link to user account
- newly created author term should be automatically linked to the user account by default

Would gladly submit a patch if the above statements are correct.