Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have the attached view which has the settings:
- Two relationships: 1) Flags node (Include only flagged content, unchecked; By Any user). 2) Flags user which uses the Flags node relationship.
- Argument: User uid; Relationship: Flag user; Provide default from url: User id from logged in user; Validation criteria: me (me module); Only allow numeric uid.
- Filter: Flags flagged; Exposed; Required; Status defaults to True; Relationship: Flags node;
The view works perfectly for flagged content. However the unflagged content does not show whenever the filter is changed to false. If I make the filter statically set to false it also will not show anything. Any ideas?
Comment | File | Size | Author |
---|---|---|---|
flag-argument-view.txt | 7.67 KB | nicholas.alipaz |
Comments
Comment #1
nicholas.alipaz CreditAttribution: nicholas.alipaz commentedI guess I see the problem after turning on the preview of the SQL:
No way it is going
flagging_node.uid IS NULL
will work whenflagging_node.uid = '35'
is there. I will probably have to resort to two views displays and a ctools jump menu between the two I think.Comment #2
joachim CreditAttribution: joachim commented> Flags node (Include only flagged content, unchecked; By Any user
With this relationship, assuming it's set to 'required', you'll only ever get flagged content.
Comment #3
nicholas.alipaz CreditAttribution: nicholas.alipaz commentedActually, retracting my last statement, it seems there may be no way to do what I am seeking. I need to show a list of nodes that are flaggable by my flag but this particular user (in the url argument) did not tag. Any ideas on that?
Comment #4
nicholas.alipaz CreditAttribution: nicholas.alipaz commentedI have opted to add a new display with a path of user/me/collection/missing and then I have:
It works but not quite what I had in mind. I will make due.
Comment #5
joachim CreditAttribution: joachim commentedLike this perhaps:
node -> flag relationship (not required)
Then add a filter ON the relationship for the Flagging UID, set to the user you want.
Then add another filter on the flagging that filters OUT anything that's not NULL.
Comment #6
nicholas.alipaz CreditAttribution: nicholas.alipaz commentedPerhaps I am misunderstanding but wouldn't a filter ON the relationship for the Flagging UID not be an adequate solution if I need to pass in the UID as an argument?
Comment #7
joachim CreditAttribution: joachim commentedThat would get you all the nodes whether they are flagged by your user or not, and the flagging status is they are.
Comment #8
nicholas.alipaz CreditAttribution: nicholas.alipaz commentedI still don't follow your suggestion really, sorry. I think that would require a hardcoded UID in the filter section. UID has to be passed in as an argument. I did get a solution however, so no worries. Thanks for trying to help.
Comment #9
joachim CreditAttribution: joachim commentedSee https://drupal.org/node/299335, which is actually linked to from the UI.
Comment #10
nicholas.alipaz CreditAttribution: nicholas.alipaz commentedjoachim, yes I did use that guide but if you follow that and consequently attempt to add a UID as an contextual argument while allowing flagto the view it no longer works because the query then becomes something like, where uid is null AND where uid = X, which obviously will not workout.
Please note that I do not remember the exact query, I have since remade the view and have a working solution, but was not able to utilize the exposed flagged filter. I am however quite happy with the solution I came up with.