I was thinking that maybe flag can act as a more advanced user (content) points. One problem that I think that might rise from such a feature is that an admin will see a certain content was 'flagged' 10 times, but won't be able to any user that actually flagged it.

On the other hand it opens a new set of functionlity, for example:
1) assign a user flags (points).
2) every content a user creates, remove one point.
3) When user reaches 0 - remove Role so user can't create another content.

I'll roll a patch in a few days - unless you think it's a bad idea :)

Comments

quicksketch’s picture

One problem that I think that might rise from such a feature is that an admin will see a certain content was 'flagged' 10 times, but won't be able to any user that actually flagged it.

You can easily make a view to see who as flagged a piece of content. See this handbook page: http://drupal.org/node/326308

As for your other request, users being "assigned" flags, I think this would make a great contributed module, but maybe not something that would be added to flag itself. There have already been almost a dozen flag_* modules created, which says a lot about the way people are interested in using Flag for different purposes. It seems to me what you're describing is exactly the User Points module, which is ridiculously extensive in it's support for all kinds of things, such as e-commerce through points and gaining points for everything from posting comments to assigning from administrators.

amitaibu’s picture

Assigned: Unassigned » amitaibu
Status: Active » Needs review
StatusFileSize
new1.98 KB

1) About the views - what I meant is that the admin will create a views and assume she will see users that flagged the content - as it's flag content is 10, but actually no user has flagged it so far. Just wanted to point this minor thing.

2) The reason I thought about adding this set_count() function to flag itself, as it should be an API function; Otherwise the contrib module will need to UPDATE/ INSERT flag's own DB. Attached patch adds this function. (If it's ok I can add test to it)

Indeed, the goal if this patch is to not need user points and allow *content* points not only users.

quicksketch’s picture

Ah, now this looks good! I should know better than to point you to handbook pages Amitaibu. ;D

This looks good to me, though I've not seen the "@private" PHPdoc word before, this function isn't really private is it? It seems like the entire patch is based on making this new (public) API function. Other than that it seems good to me.

amitaibu’s picture

StatusFileSize
new1.94 KB

Removed the private (I copied it by mistake from the original _update_count() )

amitaibu’s picture

Component: Code » Miscellaneous

From IRC with quicksketch, it was decided that it would best be implemented in user-points or a flag_points module.

crea’s picture

Isn't it a feature that could be implemented via Rules module ? You have event (flagging), you have conditions (who flagged what) and you have actions (afaik there are Rules actions for Userpoints).

amitaibu’s picture

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

@crea,
>afaik there are Rules actions for Userpoints

Indeed - some of them I wrote :) I just wanted see how easily we can create a lite userpoints using flag. It's possible, however it should live in contrib.