Configuration data

The current data model assumes that each vocabulary can be linked to an user once (just like every vocabulary can be assigned to a node just once).

There is a requirement to extend that, allowing to associate (terms of) certain vocabularies to an user multiple times.

Example:
- there is "country" vocabulary defined in taxonomy, vid = 1
- admin sets up a user<->vocabulary relation called "Where I have been". It is based on vid = 1 and has its own unique relation id, rid = 1.
- now admin sets up another relation "Where I want to go", based on the same vocabulary as previous relation, vid = 1, but relation has new id, rid = 2

To store the neccessary fields, configuration settings table "user_tags_vocabulary" should contain 2 additional fields, rid and label_profile.

Taking the example above, the "user_tags_vocabulary" data looks as follows:

rid     vid	
----------
1       1   	
2       1   	

Optional: we also need to store related labels, one for profile editing / view page, another for overview page ("people who have associated with term x")

for that 2 additional fields needs to be defined

rid	vid	label_profile	label_overview
-----------------------------------------------------------------------------------
1     1     "Where I have been"      "Users who have been in %a"
2     1     "Where I want to go"     "Users who want to go %a"

If the userwith proper permission visits his profile edit page, he can see following fields:

Where I have been
[                                 ]

Where I want to go
[                                 ]

User term data

To support storing term data for multiple instances of same vocabulary, new column needs to be added to the "term_user" table, rid.

If user (uid = 10) fills, say "Where I have been" field with "United Kingdom" (tid = 100) and "Where I want to go" with "Brazil" (tid = 200), the data in table term_user looks as follows:

vid     tid     uid     rid
----------------------------
1     100     10     1
1     200     10     2

Related API and UI changes will follow.

CommentFileSizeAuthor
#7 updated_table.jpg149.27 KBflk
#6 user_tags_relations_edit.png45.01 KBkika
#3 export.jpg134.79 KBflk
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

flk’s picture

at first i was wondering why would you want to store the labels and not just create a taxonomy with your chosen label...but now i see by creating a labels you can theme the same taxonomy with different labels and make use of the same taxonomy...where as at the moment in order to do such an activity you would need to create 2 different categories.

kika’s picture

Yes, that is the key. Drupal taxonomy system does not support having a term belonging to multiple vocabularies.

Introducing multiparent terms (or shadow copies of of a vocabulary - depends how you look at it) gives more power to fill edgy user cases like mine, but then again complicate UI for user vocabulary setup a lot. We need to figure out the UI that can work just like before (just select the vocabularies that can be assigned to an user) AND if needed, the admin could add "shadow copies" of vocabularies with custom label and description.

flk’s picture

FileSize
134.79 KB

ok i have just quickly drawn the tables and have noticed one a redundancy...we really dont need to have vid in the term_user table if we are storing rid in there.
since rid is the primary key of the vocab table which stores vid. we use the rid as a foreign key in the term_user table to reference all the other rows.

kika’s picture

good thinking. lets not duplicate vid data.

kika’s picture

Here is the mockup how relation editing/adding UI should look

associated table fields are displayed in the right.

I am worried about the amount of these overhelming options. I'd put "Custom labels" to a collapsible fieldset that is closed by default.

Open issues:
- sloppy wording
- default values: have them inside descriptions or auto-populate them to the fields. Drupal seems to follow the former approach.

kika’s picture

FileSize
45.01 KB

Here is the mockup how relation editing/adding UI should look

associated table fields are displayed in the right.

I am worried about the amount of these overhelming options. I'd put "Custom labels" to a collapsible fieldset that is closed by default.

Open issues:
- sloppy wording
- default values: have them inside descriptions or auto-populate them to the fields. Drupal seems to follow the former approach.

flk’s picture

FileSize
149.27 KB

sloppy wording in regards to what (I speak great engrish i know lool :P)

btw i was just looking at he UI, and have updated the table user_tags_vocabulary accordingly to

rid, vid, label_profile, label_overview, label_enabled, label_disabled

find ERD diagram attached

flk’s picture

wait or i could make use of varaible set for the last 3 variables....

kika’s picture

I personally hate polluting the relation table with string desctiptions. But how to map it into variable system? variable_get(user_tags_label_profile_) ?

flk’s picture

i was thinking of using variable_set for the following 3 variables: label_disabled, label_enabled,label_user and keep label_profile and label_profile in their user_tags_vocabulary table as you first suggested.
ie:
variable_get(user_tags_label_disabled)
variable_get(user_tags_label_enabled)
variable_get(user_tags_label_user)

hmm for some reason this doesnt feeel right..should i keep all of them in one table or set all of them as variable set

kika’s picture

all in same repo. either in variable_get(user_tags_label_profile_<rid>) or in our relations table

Pomliane’s picture

Status: Active » Closed (won't fix)

This version of User Tags is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.