By vjuhasz on
hi,
I have a free-tagged taxonomy vocabulary called 'cities', taxonomy-id = '41'. Each user inputs one value.
How can I later display the city for the current user? Basicly I need to print that value this city value holds for the current user.
What should go between these tags?
<?php
print
?>
Comments
Not that easy
Need another piece of information, how/where does the user input this value? In general the answer is
Not so easy
Unfortunately for you, the taxonomy table (term_data) does not store the userid of the person who created it. Is there a reason why you do it this way rather than adding a City field to their profile?
The only thing I can think of is to locate a node they created with this vocabulary and extract the term from that angle.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
Also, how do you prevent the
Also, how do you prevent the users from putting more than one city in the taxonomy field?
Taxonomy's really for categorizing nodes, not users. Maybe you could do something with a user-node module, but I think there are better solutions. Profile, or something like it seems like the best bet.
-----
Übercart -- One cart to rule them all.
More details
Thank you for all the responses, very kind of you.
What I did:
1. Created a user profile with CCK, one of the fields is the city ['field_city'], based on a text field. The user profile is based on this tutorial http://www.shellmultimedia.com/node/5
2. I got the city displayed here like this
etc.
As you can see it prints the [field_city] CCK text variable. This works well.
However I thought I could use a freetaged taxanomy category instead of the plain text field, and this would build me up a city database. Now I would like to modify the above code by printing the freetagged taxanomy value instead of the text field. (tid = 41)
A quess
Instead of '#value' try '#view'. If that does not work add
to see the parts of $node->content.
If I switch from the text
If I switch from the text field to a free-tagged category, the [field_city] will not exist anymore.
I need to extract the data form the city category of the user profile.
In that case you will need something like
The taxonomy terms are stored as an arrray in $node->taxonomy so you will want something like