Basically, I'm trying to do the second version of the "Who Bookmarked This" as described in http://drupal.org/node/326308. The only differences are that I am doing it as a page display and I'm setting it up for all nodes, rather than for one node. The flag is global so it should display the one user who has flagged it (if any), but instead it shows the node author.

I brought in the "Flags: Node flag" relationship and I brought in the "Flags: User" relationship. I also made sure that I associated the user name field with the flag relationship. When I set up the flag count it correctly displays 0 on the nodes that are unflagged and 1 on the node that are flagged. When I set up the flag time, it also works perfectly.

Could this be happening because the flag is global? I only want one user to be able to flag but I want to be able to track who that user is.

Other Details:

I don't know if it is relevant but I've themed my flag to use an image as described in the Flag documentation. I also unchecked the "display link on node page" option and placed it manually in my theme's node.tpl.php.

I'm using Views 6.x-2.3.

Query:

SELECT node.nid AS nid,
users.name AS users_name,
users.uid AS users_uid,
node.title AS node_title,
flag_counts_node.count AS flag_counts_node_count
FROM node node
LEFT JOIN flag_counts flag_counts_node ON node.nid = flag_counts_node.content_id AND flag_counts_node.fid = 2
LEFT JOIN flag_content flag_content_node ON node.nid = flag_content_node.content_id AND flag_content_node.fid = 2
INNER JOIN users users ON node.uid = users.uid

Comments

johnnytyranno’s picture

Status: Active » Closed (duplicate)

I see now that this is almost definitely because the flag is a global flag as described in http://drupal.org/node/339657. Sorry about that, it didn't dawn on me until I was writing the Issue. I'm going to mark this as duplicate myself.