Basic Views Integration
abloodworth - April 14, 2008 - 05:29
| Project: | Community Tags |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | entrigan |
| Status: | closed |
Description
I'm wondering if it's at all possible to use this module to allow a user to view a tag cloud with *only* their own tags? It would also be nice to be able to configure this module so that users could add tags to a personal tag cloud, but not to the vocab/tag cloud that all users see.

#1
Yep, I needed this on my project too. Here's a patch that adds a vews hook for the maintainer(s) to look at.
#2
Please could you tell me how I apply this path and where I have to go to configure that or to build a View with the users tags.
My problem is that I want to do a Tag cloud with the user's tags.
Thanks in advance!
#3
I solve this thanks and sorry for the comment before go in a deep manner.
I clean the cache and then the option "Community Tags: Items Tagged by Current User" in filters section appears!! :)
Thanks for helping me to close a ticket in my site ;)
See you
#4
Hi there.
I'm a Drupal newbie, and can basically only use the admin frontend. I have applied some patches by simply copy-pasting in Notepad++ (I'm in a Windows environment), but that's about the extent of my ability.
I have also copy-pasted this patch. I've looked for "return implode(', ', $typed_tags);" in the original .module file, but couldn't find it, and have therefore simply removed all +es and pasted the resulting text at the bottom of the .module file. However, nothing happens. I've unchecked the module in the Modules list, pressed 'Ok', then rechecked it and pressed 'Ok', and I've cleared the Cache in the performance part.
Am I just messing with things that I really shouldn't mess with, or am I overlooking something basic here? Could anybody please point me into the right direction?
Thank you very much for any help you can give!
Kind regards,
Gjalt-Jorn
#5
Hi matherion...
I just copy-paste that code (inside the .patch file) at last in the community_tags.module file.
After that I clean the cache (and the views cache).
I enter the in the "edit" in myTags view definition and in the filter section now I can see: "Community Tags: Items Tagged by Current User"
I add that filter, save the view and just that, begin to work.
Tell me If this little comment help or not, I will look a little more in my site and tell you.
Cheers
#6
thanks and bookmark this.
#7
What would it take to get this to work with views2 / 6.x version of community tags?
#8
this would be a really nice add-on for 6.x/Views2 indeed
i've turned this into a feature request against 6.x as Drupal 7 is behind the corner, please revert if it's the case
thank you
#9
I wrote some views integration for 6.x-1.x-dev Please review.
EDIT: Hmm, I have a feeling I did not create that patch properly. When you apply it, it asks for the path of the file to patch, which is community_tags.module
EDIT2: I guess I should explain what it does. It adds a base view table of "community tags" that can be used to display information.
E.G. you can choose this view type, then add a relationship of "Community Tags: Term ID of Tag" then add the field "taxonomy: term" using said relationship. Then filter by "Community Tags:User" to get a list of all tags by current user.
E.G.2 you can create a view of type node, add the same relationship, and display terms per node per user.
Available fields are TID, NID, DATE (of last tagging), and UID
#10
updating title to better reflect nature of feature
#11
Updated Patch: Now includes User Relationship, a few more fields, and better formatting.
#12
patch didn't apply well, try a re-roll.
Also seems not possible to output the term name, only ID, creation date and other bits..
seems to work fine for the rest, no warnings whatsoever
---- followup -----
tried adding 'name' field, but seems no term name column exists in community tags table.. attaching my error-prone extra code below:
'name'=> array ('title'=>t('Tag Name'),
'help'=>t('The name of the Tag'),
'relationship'=> array (
'base'=>'term_data',
'base field'=>'name',
'relationship field'=>'name',
'label'=>t('user flagged content'),
),
'field'=> array (
'handler'=>'views_handler_field_numeric',
'click sortable'=>TRUE,
),
'sort'=> array (
'handler'=>'views_handler_sort_numeric',
),
'filter'=> array (
'handler'=>'views_handler_filter_numeric',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
'skip base' => array('node', 'node_revision'),
),
'relationship'=> array (
'base'=>'term_data',
'base field'=>'name',
'relationship field'=>'name',
'label'=>t('Community Taxonomy Tagged Term'),
),
),
#13
Hmm, I will try a reroll tonight.
Per Merlin's advice, the way to get term names is to create a relationship to the term (which is provided with my patch), but Ill give your method a try as well.
#14
marco, can you give me more info about what went wrong when you tried to apply the patch? I just gave it a go, and it applied cleanly.
#15
damn, while switching projects i forgot the patch at http://drupal.org/node/293996 was already in place, therefore this one couldn't work.. applying to the original dev version works as expected, very sorry about that..
Also, using relationships to show term names work sweet, thank you :)
@entrygan: since seems there's some momentum in here, i'd propose also to be able to display the number of user's posts for each term. Not being a coder myself, what i can offer is bounty and testing. In the first case, my contact form is open, please just drop by to let me know. Cheers!
#16
Showing the number of posts per term (or the number of times a term has been used by a user) are both difficult problems. Views does not yet support counting. So the only two ways I know how to accomplish this are:
1) write a custom handler that does the counting (could be resource intensive)
2) add an additional table for Com Tags that records statistics (I believe this is how flag module handles their stats).
option 1 is probably the most reasonable route. If it proves easy I will post a patch here, if it is unwieldy then we can talk about possibly funding it. I am a bit busy at the moment, and there are a number of important patches that need to make it into community tags urgently. On that note, hopefully views integration will make it into the dev version by the end of the week.
#17
committed
#18
Automatically closed -- issue fixed for 2 weeks with no activity.
#19
i think that the fields 'label' and 'relationship field' in the relationship definitions can be removed, as those fields are ignored anyway. see : http://views-help.doc.logrus.com/help/views/api-tables
best,
walter