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.
Hi,
I really like the 'favorite_nodes' module.
There is one quetion that I have.
I would like to show all users who have a node put to their favorites.
Means I'm on a node-page which can be put as favorite node. Now I want to see the users who put it at their favorite node (instead of just showing the counter).
I hope you understand what I mean ;o)
Is there a view like this?
Thank you for your hints,
Doris
Comments
Comment #1
ehaav CreditAttribution: ehaav commentedSubscribing
Comment #2
ehaav CreditAttribution: ehaav commentedI think, this should be done via views. We can create a user views type, and perhaps use arguments to filter for all users who faved that node
Comment #3
crusher82 CreditAttribution: crusher82 commentedCan you explain how you do that ?
Thx
PS : Subscribing too
Comment #4
SpikeX CreditAttribution: SpikeX commentedSubscribing. This is a heavily requested feature by my users. Please add functionality to be able to view who favorited a particular node.
Comment #5
SpikeX CreditAttribution: SpikeX commentedWell... since noone developing this module has responded with a solution, I'll post mine. But here's the disclaimer:
This is NOT efficient code. This is by far NOT the best way to go about this. But it does work. And if you want a quick and dirty solution, here it is.
Put this inside your template.php file, and then insert this code somewhere in your node.tpl.php file:
Like I said... it's quick and dirty, but it works.
Comment #6
mchelenSubscribing
Comment #7
henrykuo CreditAttribution: henrykuo commentedThanks for this! I'm considering using it on my site, as there's just obviously so much value displaying who favorited a particular node.
If you can, would you mind explaining any drawbacks of utilizing your down-and-dirty code? I understand how it works, but I'd just like to know, say, if the query is too basic that it puts undue load on querying the database. I don't know enough about optimizing queries to know whether this might be the case or not.
Comment #8
SpikeX CreditAttribution: SpikeX commented@7: You're only performing a single query, so it shouldn't be that bad. I don't know what kind of performance this gets, though, as I've only ever seen this function work with less than 50 users at a time (that are returned from the query), so I can't really answer your question. You could always test it on your site as an administrator before deploying it to everyone else.
Comment #9
henrykuo CreditAttribution: henrykuo commentedAhhhh I could see returning a large result set being problematic if it goes into the hundreds or possibly thousands, without incorporating a paging ability to retrieve only a subset of the whole.
I've already begun implementing it and it works great. I'll have to add on more hacked code for the paging. Will hold out hope that we'll get a proper update for this module, but many many thanks for your quick fix contribution here!