Hi, is there a possibility to flag Taxonomy Terms? This would be very useful for sites with large taxonomies. E. g. to build a per-user bookmark list based on user-specific interests, which are represented by categories (terms).

Regards,
Daniel

Comments

mooffie’s picture

(It'd actually be easy to define a "taxonomy flag" class. Similar to the way the user flag class is defined. Even more flag classes can be defined: for node revisions, files, etc.)

Rysk’s picture

I'll cast my vote into the stack here too, being able to flag a term would be pretty handy. For instance, say you're using terms to pull off a fake node hierarchy. Flag the term, and in the view list for flagged terms list all nodes of a specific type (parent type node for instance), with an updated mark on it if the term has had any changes or node additions to it since the last time it was viewed, etc.

lennart’s picture

This functionality would be useful in binding users to the taxonomy system. Any plans to include this?

quicksketch’s picture

To clarify what Mooffie said in #1, this is already possible by creating a dependent module that uses Flag.module's API. Flag module in fact only implements it's on API to provide support for comments, users, and nodes. By creating another module that implements hook_flag_definitions(), other modules can provide flagging support on any other type of object (such as taxonomy terms).

Due to the number of special considerations for Taxonomy terms, I doubt this feature will be implemented in Flag module directly. It'll probably need to be added through an add-on module.

lennart’s picture

OK - thanks for the elaboration.

mooffie’s picture

Assigned: Unassigned » mooffie

I'll write a simple flag_taxonomy.module next week. I'll use (or rather misuse) hook_help() to show a flag link on taxonomy/term/x pages.

lennart’s picture

Great!

I am looking forward to testing it out!

niklp’s picture

I'd like to ask about a particular scenario if I may - I was pointed to this issue by Catch when I mentioned it before.

I'd like to be able to have a user (A) who has a content_profile node, with an arbitrary number of vocabs attached to that node. Secondly, the user can obviously "tag" themselves by assigning terms to their own profile node. This is all currently possible. Thirdly, I'd like *other* users to be able to vote on the assignment of those terms.

A specific example: user A purports to be an expert in fields x, y and z. User B values user A as an expert in fields x and z. User B flags (or votes, using perhaps votingapi, which is of course away from this issue) the fields (terms) x and z. User A can then assert that User B has confirmed their own rating by pointing user C to their content_profile page, which has a count of all "votes" on each of their fields (terms).

Any thoughts? Not sure if this is within the scope of flag, or would be better directed towards votingapi. I had thoughts about voting up/down, rather than just yes or no (implied by flagging). The up/down mechanism gives a ternary mechanism (good, bad, I don't know/care) rather than the simpler on/off of flag.

Hope this isn't too off topic! :)

mooffie’s picture

NikLP, this will be possible once we add the ability to flag flaggings (this feature is just around the corner).

It will go thus:

  1. User A flags all terms he purports to be expert in. (Each such flagging creates a row in the {flag_content} table and this is what we call "a flagging".)
  2. Other users flag user A's flaggings.

I think no custom programming will be needed. A view will be embedded in the user profile's page showing two columns: the term, and the count of users who flagged this flagging. A third column will be a link leading to a "Who's bookmarked this" view that will list all users who flagged a certain flagging (in other words, all users who think user A is an expert in bellydancing).

Of course, to prevent user A from flagging his own flaggings we'll have to implement #285237: Ability to disallow a flag/unflag operation.

mooffie’s picture

Here's a very simple flag_taxonomy.module (for Drupal 6). It was only lightly tested.

I think the main purpose of this module is to show what is *not* possible.

For exmaple, you *can't* tag other users (because we don't have a UI for flagging an object (a term) on behalf on another user (though this is possible via non-UI means)). You can only tag youself. So it's good for "my interests".

lennart’s picture

It works very well, thank you.

zigx’s picture

how can i install this?

marcvangend’s picture

Download both files in #10, rename the .txt to .module and place them in a folder called 'flag_taxonomy' inside your modules folder (probably sites/all/modules/).

catch’s picture

Status: Active » Needs work

This is interesting, marking as cnw since there's some code already.

niklp’s picture

This also relates to ongoing work on the vote_up_down module which is currently converging with updown module.

That module will have a direct interface to the Voting API of course, so may be more useful to some others than this.

Flying Drupalist’s picture

Ahh subscribe.

It would be great to be able to flag terms, and use the flagged terms to allow users to build their own custom node index and such.

quicksketch’s picture

This issue should be made into a separate project. I don't have any intention of supporting flag_taxonomy.module within the flag project itself. Any interested users in maintaining the module, please feel free to start a new project for it.

doublejosh’s picture

Seems to work great for me.

mooffie’s picture

Perhaps it's best to start a "Flag Bonus" module to provide all these extra features users are asking for. Some of the features it could provide:

(The drawback: if that module is maintained by the "wrong" hands, it might ruin Flag's reputation.)

Flying Drupalist’s picture

This is great, is it too much to ask for a node view filter that goes, show node if it is tagged with flag term?

dropchew’s picture

subscribe

Johnson2’s picture

If you need any help economically, please ask so. I am very interested in this.

pixelite’s picture

I installed the patch and it's working really well so far. Thank you! I was able to create a view to display a list of terms that users had flagged and display it on the user's profile page.

I just had to add one line to the top of flag_taxonomy.module to make it work:

require_once dirname(__FILE__) .'/../flag/flag.inc'

philbar’s picture

I would also like support of Flagging Revisions.

najibx’s picture

sorry, i' getting confused with all the new term here. Instead of just Flag yes | no, I also want to keep track some sort of status of that flag. i.e for registration flag, if it's being approved or not. maybe in combination with workflow possibly. So what should i keep eyes on? TQ

niklp’s picture

You could use a CCK field with whatever values you want, and then "monitor" them using the Rules module. Bit more hardcore, but probably worth it for the flexibility.

dobeerman’s picture

Great job!

Q: How to add flag_taxonomy link to forum list page for each taxonomy?

TUc’s picture

I need this functionality for a project, and wrote some code similar to that of mooffie.

I am willing to maintain a separate project for that code. I'm inclined to a Flag Taxonomy module instead of a Flag Bonus module though.

TUc

drupalina’s picture

I used the module in #10. Flagging/Unflagging works fine, but then I cloned the "My bookmarks" view and replaced the relationship with that of Flag_taxonomy of current user and the page gave me:
Fatal error: Call to a member function get_views_info() on a non-object in sites\all\modules\flag\includes\flag_handler_field_ops.inc on line 66

This would be a really useful module to create a streaming list of new nodes from the tags that interest the current user, so please someone create a project page for this module. IMHO, because taxonomies are as essential to Drupal as the concept of a "node", this module should really exist and be maintained.

It would also be great to have this Taxonomy Flagging from inside a block, with additional checkboxes to select the content types affiliated with that Vocabulary. (For example, while others are happy to receive all content types from a tag called Foo2, Mary Smith may like to subscribe to this tag and receive only new Events and Groups from that tag, but not every single new Blog entry that others post under that tag)

quicksketch’s picture

Status: Needs work » Closed (won't fix)

Per #17, this module will never be officially supported as part of the Flag project. It should be made into a separate project. Note that the module mooffie posted has not been updated for the 2.x version and will probably not work with any new versions. Anyone that is interested, please make a new project for maintaining this code.

tayzlor’s picture

Have taken the code in #10 and packaged a flag add-on module - http://drupal.org/project/flag_terms
updated the code so it now works on the 2.0 branch of Flag.

quicksketch’s picture

Super, you're a hero tayzlor!

njathan’s picture

thanks mooffie, tayzlor! this was exactly what i was looking for!

anwar_max’s picture

Category: feature » task
Priority: Normal » Major
Status: Closed (won't fix) » Active

Hi Mooffie, How can I integrate flag_taxonomy to glossary module.

Thanks in advance

quicksketch’s picture

Category: task » feature
Priority: Major » Normal
Status: Active » Closed (won't fix)

Please ask your question in the http://drupal.org/project/flag_terms queue, since that's the actively supported solution.

anwar_max’s picture

Sorry quicksketch

I am new to drupal.org that's why it happen.

c4rl’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Assigned: mooffie » Unassigned
Status: Closed (won't fix) » Active

In Drupal 7, now that taxonomy terms are entities, I'm wondering if the special considerations mentioned in #4 are lessened.

If so, would it be worth considering integrating the flag_terms module to become part of flag?

js’s picture

I need to flag taxonomy terms and am concerned that flag_terms appears quiet. I am concerned about adding that dev version. Would anyone currently recommend that approach?

I am also curious about any response to @c4rl question.

Thanks!

joachim’s picture

> If so, would it be worth considering integrating the flag_terms module to become part of flag?

Definitely. I need to contact the maintainer about that.

In the meantime, the patch at #1035410: Flag any entity will get you most of the way (apart from a core bug -- please help fix that!)

joachim’s picture

joachim’s picture

Status: Active » Closed (duplicate)

I'm closing this, as it's covered by #1035410: Flag any entity.

If anyone here cares to help move this forward, please help get this Drupal core bug fixed: #1067120: Missing hook_taxonomy_term_view() or hook_entity_view() when viewing a term.

warmth’s picture

joachim’s picture

The news is on the core issue. The patch needs to be committed to D8 first and then backporting. Please stop posting all over the place!

warmth’s picture

Sorry, my bad. Is there any standard awaiting time for this to happen? I'm in a hurry, do you advise me to apply the core patch meanwhile?

joachim’s picture

It depends entirely on when various community members find the time to make things happen.

As for Flag module, it should work as soon as there's a release of Drupal core with this fix in it. I've not tried the patch, and it'll be for D8 anyway.

warmth’s picture

So I can't apply the patch to Drupal 7.15 to make it work? I really need this feature

warmth’s picture

So now that the core has been fixed and taxonomy can be flagged on the flag page, is there any way to place the flag button beside the tag list on a node page?

Martin P.’s picture

Is there a Screencast or something like that, which explains the way how to set flags for taxanomy terms?

warmth’s picture

Regarding to my question #47 if you select the render display option the flag link will appear after every taxonomy term, very handy.

Ingmar’s picture

You can also try to add it via the Page (using Panels)