Say a user wants to create make a group of office friends and chemistry lab friends, or any custom list, this would enable that.

Restated: instead of the admin creating new flags and choosing between global or local, users could be given permissions to create new flags for themselves.

Comments

quicksketch’s picture

Architecturally speaking, Flag is not made to work in this way. Flag currently makes assumptions about how many flags are on a site (probably less than 10) and how often they'll be used (probably more than one flag per page) so to save queries it'll load all the flags on the whole site if even a single flag is shown, since loading all the flags (if there are a small number) is faster than making 2+ SQL queries.

Thinking on this for a moment, this generally would just be a large undertaking. A separate admin interface would be needed, new sets of permissions, separate loading APIs. Not to mention, once users made these custom lists, how would they view the items in these lists? You'd probably need a single view (or several) that took an argument for the flag to be displayed.

What I'm getting at with this is that I'm not sure adding this the main Flag module is a good idea. However it's not currently even possible to do this (efficiently) in a 3rd party module, since Flag would still load all the flags on every page load, when a site might have thousands of flags.

We could fix this easily though simply by adding a db_rewrite_sql:

    $result = db_query(db_rewrite_sql("SELECT f.*, fn.type FROM {flags} f LEFT JOIN {flag_types} fn ON fn.fid = f.fid"));

Problem fixed. :-)

However, no point in getting ahead of ourselves. I'm not interested in writing the module and mooffie's currently not coding. If there's an outside group that writes this theoretical "user_flags" module, I'll be happy to add APIs to Flag to make it possible.

mitchell’s picture

@quicksketch: That was a fun read :)

Who knows who this group or individual will be?

mitchell’s picture

Component: Code » Miscellaneous
Status: Active » Closed (duplicate)