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?

CommentFileSizeAuthor
#6 nodereference_count_by_status.patch2.49 KBalexku
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gilgabar’s picture

Yes, 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.

mohd hazreen’s picture

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

jaarong’s picture

I second a vote for this feature.

mohd hazreen’s picture

Status: Active » Closed (won't fix)
gilgabar’s picture

Version: 6.x-1.0 » 6.x-1.1
Status: Closed (won't fix) » Active

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

alexku’s picture

Status: Active » Needs review
FileSize
2.49 KB

Here is my patch. It adds radios to field configuration form and joins node table if needed. Please review :)

gilgabar’s picture

Yay! 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.

mr.andrey’s picture

subscribing...

Thithi32’s picture

I`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.

gilgabar’s picture

Status: Needs review » Closed (fixed)

Thanks Thithi32, I'll consider that rtbc. Committed and should be available in a dev release shortly.

CatherineOmega’s picture

Looks good--this is just what I needed!