0

I have a rating website and on every node i have two separate flags, one is Like, and another one is disklike, so that i can get a count of how many people likes that particular div and how many of them dislikes them. What i want to achieve is, that say if someone likes a node, the dislike should be disable or even invisible , and vice versa. I am using a view to show the nodes a the moment, so will i have to uses pre process of views to do it or what is the way going about it?

0

I would start by looking at the Flag Module Documentation and look into several of the ways you might accomplish this:

  1. You can hook into the Flag Module via PHP, so, in preprocess, you can see if a node has been flagged by either the like or dislike flag (or none yet) and display just the one or both of them when the node is displayed.

  2. You can also hook into the Flag Module via Javascript: it provides two events you can act upon, so, for instance, after a user has clicked on a flag, you can via jQuery hide the other flag.

And of course, with Views, you can filter on whether or not a node has been flagged by a particular flag or not and then list them accordingly.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.