Download & Extend

Exposing the flaggings table: Alternative Views support

Project:Flag
Version:6.x-2.x-dev
Component:Views integration
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

Comments

#1

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.

AttachmentSize
flag.views_.txt 3.68 KB

#2

  // 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.)

#3

subscribing!

#4

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.

#5

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".

#6

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.)

#7

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

#8

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

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

#9

Component:Code» Views integration

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

Moving.

#10

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.

#11

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.

#12

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

#13

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"

#14

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

#15

[...] 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.

#16

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.

#17

following

#18

following as well :)

#19

another follow

#20

subscribe

#21

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

#22

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.)

#23

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

(Fixed changing the title by mistake.)

#24

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

#25

(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.)

#26

lol

#27

Status:fixed» closed (fixed)

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