How can you set Default catogories on the fly?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
tedbow-gdo's picture

Is there a way I can set a default term for the "node add" form?

Here is my problem:

1.When a user first comes to a site they pick a geographic location which is taxonomy term for the "Location" vocabulary.
2.That term id is stored as a session variable.
3. The user later clicks a link to add a node, which also has the "Location" vocabulary .
4. I want the "Location" vocabulary to default to the term that is stored in their session.
5. they should still be able to change the term.

I am also using the Hierarchy Select Module.

Any ideas for modules and/or coding that could get this done?

Thanks,

Comments

Prepopulate

christefano's picture

The Prepopulate module is one way to do this, although it has nothing to do with session variables. It uses term IDs you put in the URL of the links your site members click on. Have you taken a look at that approach? It works well with core fields (like the taxonomy fields) as well as CCK fields.

thanks

tedbow-gdo's picture

This looks like a way I can do it. I could use the session variable when I create the link to the add form instead and put it in the URL.

I suppose I could also look at how the Prepolulate module does this and adapt it to the session variable.

Thanks

Taxonomy

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week