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'm interested in this node but for a specific purpose. I'm doing a job listings site with two main content types - employer and job. Jobs node-reference employers. I want to create a block showing the top employers by active job listings. I like that this module gives me an option to do a node-ref count, but it doesn't seem like (unless I'm missing something), the count can be made to only count published nodes, or decrease the count when a node is unpublished.
Is this something that can be done, or is there a better way to do this?
Comment | File | Size | Author |
---|---|---|---|
#6 | nodereference_count_by_status.patch | 2.49 KB | alexku |
Comments
Comment #1
gilgabar CreditAttribution: gilgabar commentedYes, this can be done. All the counting is done in SQL, so it's mostly a matter of building a different query. We would also need a UI element to tell it to use that query. In this case it looks like we just need to join the node table and filter by status. It shouldn't be very hard if you feel like trying to put something together. Otherwise I will probably be able to add this in as I have time.
Comment #2
mohd hazreen CreditAttribution: mohd hazreen commentedgood work gilgabar. i think you should make this module. a lot of people want to use this module including myself. hope a good news from you gilgabar.
Comment #3
jaarong CreditAttribution: jaarong commentedI second a vote for this feature.
Comment #4
mohd hazreen CreditAttribution: mohd hazreen commentedComment #5
gilgabar CreditAttribution: gilgabar commentedThis is still an active issue. Won't fix is not appropriate as I am very open to fixing it. I just don't have a lot of time to write features I don't personally use, so this is really low on my priority list. If it is really important to you then I would encourage you to write a patch and submit it here.
Comment #6
alexku CreditAttribution: alexku commentedHere is my patch. It adds radios to field configuration form and joins node table if needed. Please review :)
Comment #7
gilgabar CreditAttribution: gilgabar commentedYay! Great job. The patch looks good to me based on my extremely quick test. If a couple other folks can review and confirm that there are no issues then I will roll a new release. Thanks alexku.
Comment #8
mr.andrey CreditAttribution: mr.andrey commentedsubscribing...
Comment #9
Thithi32 CreditAttribution: Thithi32 commentedI`ve tried it and it seems to work just fine (now I'd like some conditional flags but it`s a lot to ask ... I'll probably have to dive into the module).
Thanks for the patch.
Comment #10
gilgabar CreditAttribution: gilgabar commentedThanks Thithi32, I'll consider that rtbc. Committed and should be available in a dev release shortly.
Comment #11
CatherineOmega CreditAttribution: CatherineOmega commentedLooks good--this is just what I needed!