Closed (fixed)
Project:
Flag
Version:
7.x-3.3
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Jul 2014 at 14:34 UTC
Updated:
25 Jul 2014 at 15:40 UTC
Jump to comment: Most recent
Comments
Comment #1
joachim commented> The part I am missing is what to use for the entity_id in flag().
Well what is it that you want to flag?
Your question makes it sound like the flag is actually on users. In which case the entity ID is the user ID. If instead your flag is on, say, nodes, then you want to give the ID of the node that you want everyone to flag.
Comment #2
mikejuic3 commentedHi Joachim, thanks for the response.
Its basically a flag that sets a subscription to a newsletter called daily_digest. Its an inherited site and has a custom module to generate this news letter.
I am back on this today so will let you know the results.
Comment #3
joachim commented> Its basically a flag that sets a subscription to a newsletter called daily_digest
Using Flag for that seems crazy. There are several perfectly good modules for actually subscribing to newsletters!
Comment #4
mikejuic3 commentedUnfortunately this is an inherited project and has many things happening which could have been done better.
Comment #5
mikejuic3 commentedFor anyone else who needs a quick way to set a flag for all users please see the code below. This code is setting a flag for the user entity rather than a node so the entity_id is the user id. For a node you would change the entity_id to be the node id.
Thanks joachim for the help.
Comment #6
joachim commentedThanks for sharing :)
Though:
That's going to totally keel over your site if you have a large number of users...
Comment #7
mikejuic3 commentedNot to worry, it's not in production yet although all the users from the old version of the site are now on dev/staging. It will only be run once fortunately.