One thing the Views support lacks is "real" exposure of the 'flag_content' table. This table stores flaggings. Currently, because of a "let's hide the frightening word 'flaggings' so users feel comfortable" philosophy, this table doesn't get the treat it deserves. Exposing this table is 90% of implementing the "Ability to flag flaggings" feature, but it also enables most trivial things like filtering by flags

CommentFileSizeAuthor
#1 flag.views_.txt3.68 KBmooffie

Comments

mooffie’s picture

StatusFileSize
new3.68 KB

I'm attaching a schema of how this can be done. This is a rip off of once-functional old patch I had laying around.

mooffie’s picture

  // Advertise this table as a possible base table
  $data['flag_flagging']['table']['base'] = array(
    'field' => 'content_id',
    'title' => t('Flaggings'),
    'help' => t('Get at the individual flaggings.'),
    'numeric' => TRUE,
  );

'field' should point to 'fcid', of course, not to 'content_id'. (That snippet was written long ago, when we didn't yet have a primary key on that table.)

Rosamunda’s picture

subscribing!

mooffie’s picture

Another reason to expose this table:

Is there any trick to making the view sort on total flags within the past 24 hours?

If we expose this table, we will be able to do a "summary" on the flaggings done during the past X days/hours/etc.

mooffie’s picture

Another reason to expose this table:

I need to get all flagged nodes from the users I have flagged.

[...]

Flag's Views implementation [...] should make the flagged content table (node) available for use as fields, filters, arguments, etc.

The patch achieves this by exposing three relationships: "The flagged node", "The flagged comment", The flagged user".

mooffie’s picture

Another reason to expose this table:

[I want to add a section] "Users who have favorited this object have also favorited..."

(The "flagged node" relationship I mentioned in the previous reply solves this as well.)

mooffie’s picture

There are many reasons to exposes this table. The code here complements the "flagging flaggings" feature which in itself solves many feature requests.

mitchell’s picture

Issue tags: +flag 1.2

Tagging as 'flag 1.2' to try to help draw more attention to it.

Also added #464970: Natively support aliases for base tables.

mitchell’s picture

Component: Code » Views integration

Marked #433308: Get all nodes from all users I have flagged? (Flag Users) as a duplicate of this issue.

Moving.

camaromelt’s picture

I feel this would be a great addition as I am wanting to also view the number of flags a node has in a given timeframe and then cause the top flagged item to be hard posted to a front page. Any thoughts if this idea is on the same wavelength? I'd love to get involved but I am totally newb with PHP.

jday’s picture

I would like the table exposed in views so that we can create a view of all the users who have flagged a particular node.

quicksketch’s picture

I would like the table exposed in views so that we can create a view of all the users who have flagged a particular node.

You can do that already. See the handbook page on this exact task: http://drupal.org/node/326308

jday’s picture

ok almost have it, the handbook says
"you can easily turn it into a block. Add a "Block" display. Since blocks don't get arguments from the URL, you'll have to add the "Node ID from URL" default argument."

but I don't see this "Node ID from URL" option, where is it?

Nevermind, found it under "Provide default argument"

awolfey’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

Please read #859822: Views integration for private flags module and then come back here.

I currently have time and funding to do the flag views integration rewrite. Views is not really a specialty but I should be able to figure it out.

But I'd like to have buy in from the module maintainers before I start. If not, I can still do what I need for my project. It really should be views though.

Please test the module posted here #750578: Patch creates hook_flag_delete() and let me know what you think. I plan to have this done one way or another in the next few weeks.

Thanks

mooffie’s picture

[...] to do the flag views integration rewrite

What's described in this thread isn't a rewrite. A rewrite entails writing an "upgrade path" for all the old views and to rewrite the handbook pages, and we don't have energy for this.

What's described here is a supplemental (or "alternative"), that could even reside in a separate module. The existing Views integration isn't modified.

Please read #859822: Views integration for private flags module and then come back here.

I've read it. You wrote:

Currently the only way to use flag_content fields is with the user relationshp, which limits the a user's flagged nodes to a single flag.

And this proposal (#371432) makes this possible. Don't you think so?

But I'd like to have buy in from the module maintainers before I start.

I can't speak on behalf of Nate. As for me, I've been AWOL so I'm not a factor. But it'd be easier for me to spend the few hours needed to complete this task than to make various promises. I may have good news for you: it's possible that I'll need to implement this anyway, to accommodate #871064: Making flaggings fieldable better.

awolfey’s picture

Moofie, [#871064 ] sounds great for D7, but I need this in the next few weeks for D6. Will you be working on anything for d6 in that time frame?

I think your suggestion of make views integration a separate module makes good sense for my project, so could go down that road. No sense in duplicating our efforts, so let me know what you think.

henrijs.seso’s picture

following

a_c_m’s picture

following as well :)

nunoveloso’s picture

another follow

bleen’s picture

subscribe

mooffie’s picture

Title: Exposing the flaggings table » Exposing the flaggings table: Alternative Views support
mooffie’s picture

Title: Exposing the flaggings table: Alternative Views support » Exposing the flaggings table

#981912: List flags & its count user is falgged with - Views & Flag was marked a dup of this issue.

(It contains nice examples of views that are hard to make with the current Views support.)

mooffie’s picture

Title: Exposing the flaggings table » Exposing the flaggings table: Alternative Views support
Issue tags: -flag 1.2

(Fixed changing the title by mistake.)

mooffie’s picture

Status: Active » Fixed

I bet you lost hope, after two years, this moment would come :-)

There's now an alternative, better Views support for Flag:

Flag Vista

mooffie’s picture

(Some may ask why wasn't "Flag Vista" posted as a mega-patch for Flag. Because it would have taken years to review it and write code to convert existing, old views. I suspect changing the Catholic doctrine would be easier. Instead, we should decouple Flag's built-in Views support into a separate module to give users the chance to simply not have it.)

henrijs.seso’s picture

lol

Status: Fixed » Closed (fixed)

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