Posted by Fayna on April 5, 2008 at 1:21am
Jump to:
| Project: | Community Tags |
| Version: | 6.x-2.x-dev |
| Component: | Rules integration |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Would this be possible in the future (maybe 6.x version)? ie: awarding a user points for tagging an item to encourage participation.
This seems like a great module!
Comments
#1
Agreed. I second the motion. That would be an amazing add on.
#2
Updating status with new issue settings.
#3
subs
#4
Yeah, I concur, integration with Userpoints would be awesome.
#5
I agree that the ability to award user points for tagging with keywords from your taxonomy vocabularies would encourage participation in creating a folksonomy.
#6
subscribe
I actualy hacked together a solution until something is added proper. I replaced the function in the community_tags.ajax.inc file with this. So It just gives 1 point for each tag added. No points are deducted when a tag is removed though.
<?php
function community_tags_from_js($node) {
global $user;
$tags = (isset($_POST['tags']) && is_array($_POST['tags'])) ? $_POST['tags'] : array();
$added_tags = drupal_explode_tags($_POST['add']);
// Merge in new tag and save.
$tags = array_unique(array_merge($tags, $added_tags));
$vid = array_shift(community_tags_vids_for_node($node));
community_tags_taxonomy_node_save($node, array('tags' => array($vid => $tags)), FALSE, $user->uid);
// Fetch updated list.
$tags = community_tags_flatten(community_tags_get_user_node_tags($user->uid, $node->nid));
// give user points for adding tags
$tags_added = count($added_tags);
if ($tags_added > 0) {
$params = array (
'uid' => $user->uid,
'points' => $tags_added,
'operation' => 'tag',
'description' => 'added tags to '.$node->title,
);
userpoints_userpointsapi($params);
}
// Output JSON.
print drupal_json(array('status' => TRUE, 'tags' => $tags, 'sequence' => $_POST['sequence']));
}
?>
#7
subscribe
#8
Is that feature unavailable through rules/actions? +1 for the idea anyway. subscribing.
#9
CBFPLC: I dont think this is available through rules because there is no action for "A term has been added to a node". I think however that rules integration would be the way to go to accomplish this so I am changing the title.
#10
the best workflow for a user point integration would be.
1.) user tags content
2.) an admin or mod must approve the tags -> accept and move to vocavulary X (accepted)
3.) User gets an amout of points for that.
if the tags are rejected nothing happens or the user gets a message "not accepted ...."?
#11
+1 for Rules integration. + a few more for everyone here: http://drupal.org/node/941538
#12
Subscribing
#13
I've added some Rules support to 6.x-2.x-dev.
Included is a "tag" event for tags added via community tags form or node edit form. Tags added as a result of a rebuild don't fire the event.
With the user points application in mind I included a couple of conditions for a) first tag (i.e. first user to tag node with particular term) and b) tagging user is node author.
#14
Anybody need an un-tag rule event?
#15
Can I set a condition if tagged node is type X, etc?
#16
Yes you can. The node, user, and term are all available for any conditions you care to add.
#17
Wow cool thanks! This is great, I can't wait to implement it. I can't think of a use-case for untagging, but you can bet someone will come along and need it.
edit: sorry one more question. This will allow me to both tag something as an action, and set another action to occur when I've tagged something, right? I haven't had a chance to set up the site yet so I haven't checked.
#18
I haven't put any tag actions in. It seems an unlikely requirement as community tagging is all about user interaction. I would expect actions to flow from the tagging event - not vice versa. Would you care to share your use-case?
#19
Well let's say I have Feeds set to automatically import nodes of type x, and I would like to have tags automatically added to it through community tags to jump-start the discussion. I'm not sure if Rules would be the best way to do it, or even - like you say, if it's necessary. I don't need it right now, but it seems like as soon as I think I don't need something, I build another site that does.
#20
@paidvideoreviews - Community Tags does this already if the feed includes tags. The tags are added as terms to the node by Feed API and Community Tags adds those terms as community tags. Note that in the latest 2.x-dev snapshot, the sub module "Community Tags Node" must be enabled and synchronisation option "Sync community tags with node terms" must be set for this to happen.
Also the latest 2.x-dev adds views support via a sub-module so that must be enabled as well. On the plus side - I have added an un-tagging event. This latest snapshot also makes a clear distinction between actual user tagging actions - i.e. that occur via the CT ajax form or API calls to community_tags_tag() and community_tags_untag() - and adding and removing tags due to some other operation e.g. node term synchronisation or Unitag processing or API calls to community_tags_add_tags() and community_tags_remove_tags(). Rules events are fired only for the actual user tagging/un-tagging operations.
I'm going to mark this as fixed as the original requirement was for Rules events which has been implemented. If somebody reading this needs Rules actions then feel free to raise another issue.
#21
Automatically closed -- issue fixed for 2 weeks with no activity.