Is there any easy way of changing the flag count by the admin? (for example, I want change the flag count of a node from 5 to 500)

Maybe with Rules or changing the values in the database with a MySQL command?

I guess with some custom code it should be possible, but I'm not a developer, so I cannot do that.

Comments

delvalle created an issue. See original summary.

joachim’s picture

At the moment, the only way is to hack it in the database by hand.

delvalle’s picture

Thanks joachim. Is it a "risky" hack or there should be no problem with it?

Also, in the table "flag_counts" I see some nodes with the same "entity_id" but different "fid" (1, 2 or 3). I have no idea what that means here.

In case someone else want to do this hack, the code I used is the following (not sure if it's the best option, but it seems to work):

UPDATE flag_counts SET count='24' WHERE entity_id='40';

joachim’s picture

> Also, in the table "flag_counts" I see some nodes with the same "entity_id" but different "fid" (1, 2 or 3). I have no idea what that means here.

The fid is the flag ID. The {flag_counts} table holds the count for each entity, per flag.

tim berners lee’s picture

Status: Active » Needs review
StatusFileSize
new2.08 KB

I think this patch help you.

delvalle’s picture

Thanks a lot Andrew, it works and it's more convenient than editing via Mysql. :)

But it's not ideal, because I think it changes the flag count for all the flags that are used in that entity (the Mysql code I provided has that same problem). It would be better if we could indicate also the Flag ID that we want to change.

tim berners lee’s picture

Category: Support request » Feature request
StatusFileSize
new3.98 KB

I added new features.

delvalle’s picture

Thanks, but those new features are not useful for my needs.

Let me give an example: I want to change the flag count to 24 for the flag ID 1 in the entity ID 40 (leave the other flags in that entity unchanged).

I think that's not possible in the latest patch (you can select the flag ID or the entity ID, but not both at the same time).

If this is difficult to implement in a patch, I will probably just do it with Mysql.

tim berners lee’s picture

StatusFileSize
new3.45 KB

I hope this time I understand you correctly

delvalle’s picture

I see changes in the code, but the configuration page looks the same to me as with the previous patch (3017024-7). I've cleared caches just in case.

I'm still unable to enter the flag ID and entity ID I want to change at the same time (it lets me enter only one of them).

Maybe it's easier to explain if I put the Mysql code that does what I want (the key here is the AND):

UPDATE flag_counts SET count='24' WHERE entity_id='40' AND fid='1';

tim berners lee’s picture

Try to reset unindexed changes:

  git checkout -- flag.module
  git checkout -- includes/flag.admin.inc

And then, apply patch again.

delvalle’s picture

I don't use Git, I'm applying the patch manually

tim berners lee’s picture

StatusFileSize
new29.52 KB

So, you can try to replace the files in your folder from this zip, that contain changes provided by the last patch.(3017024-9-change_flag_count.patch)

delvalle’s picture

Status: Needs review » Fixed

After uploading your files it works! Not sure what I did wrong applying the latest patch. :S

Thanks a lot Andrew!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.