Hi, I want all the galleries for a user to show up, even if they're empty.
At /galleries/[uid], I see only the galleries with content. Same thing happens when I use views with Node Gallery Gallery: Gallery field. However, they show up on the /galleries/ page.
This should be default option ..
I'm going to use this query to generate the empty albums .. I hope it can be included into the module code somehow ..
SELECT *
FROM (
SELECT node.nid AS nid, node.title AS node_title, (
SELECT COUNT( * )
FROM node_galleries ng
WHERE ng.gid = node.nid
) AS image_count
FROM node node
INNER JOIN users users ON node.uid = users.uid
WHERE users.uid =6
AND node.type = 'album'
) AS a
WHERE a.image_count =0
the output is:
node | node_title | image_count
216 | birthdays | 0
217 | test album | 0
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | galleries cover grid.jpg | 149.25 KB | misthero |
| #7 | attachment display.jpg | 178.07 KB | misthero |
Comments
Comment #1
dbeall commentedHave a look at the handbook page,
http://drupal.org/node/544642 ;HowTo: Configure Node Gallery
see; Configuration for Each Gallery Relationship
In the second configuration screen is,
Default Cover Image:
Specify a default cover image to show when there are no images in the gallery.
Specifying a default image might solve the issue as it provides a cover image.
Comment #2
dbeall commentedI just tried using a default image and it works without views, but does not work in views.. But then, I have never been able to get arguments to work. I keep trying to figure out the arguments part with no success after a year trying, I have just given up on arguments.
Comment #3
Tally commentedViews will not display empty galleries. Near as I can tell, the data does not fully exist until an image is added to a gallery, then Views can identify the gallery ID.
Comment #4
dbeall commentedwell, that's why i can't get an argument to work. Return to sanity. I was beating my brains out with it, not realizing it could not be found..
Thank you Tally
Comment #5
dddave commentedMarked as duplicates:
#790834: Empty galleries being excluded from views
#747060: How to create view, which shows empty Galleries?
Comment #6
justintime commented2.x views bugs are won't fix - please try this in 3.x, and if it doesn't work there please open a new issue.
Comment #7
misthero commentedi know this is old, but if someone is still working with views 2 maybe I found a dirt workaround for this issue.
My situation:
I'm using the node gallery hierarchy module to show galleries of galleries (I'll call those "collections" in this post from now on).
My galleries use views slideshow but I don't want the slideshow to appear in collections, just in normal galleries with no children. To remove the slideshow in the collection and show just the child galleries I have to keep the collection empty with no image. But this cause views to ignore those, because of this issue.
I'm using the "Galleries Cover Grid" display.
Solution:
I noticed that if you remove the relationship "gallery cover image" in the display, empty galleries will show up! but there will be no cover, the relationship is needed to get the cover.
So i removed everything from the display (see first attachment), removed the relationship, placed an empty text field in the fields and changed the filters to show "Node Gallery: Gallery: Gallery Id < 0" (no gallery will appear)
So it's now just an empty display, noting will come out of it.
The dirt trick:
than I created an "attachment" display, attached it to "Galleries Cover Grid" and placed in it everything that was in the original display including the relationship and the filters (see the second picture i have attached).
this way it works, views will display both empty galleries (my collections of galleries) and normal galleries.
why it works? i don't know..
Hope this is useful for someone stuck with views 2 and drupal 6.
Comment #8
dddave commentedThanks for sharing. I changed the component so that it is easier to access for people searching.