I have a node with two separate flag link generated via flag_create_link(), with javascript toggle:

flag_create_link('heart_this', $node->nid);
flag_create_link('qc_no_problems', $node->nid);

When I click the "qc_no_problems" flag link, it updates as expected to show the "unflag text," but the problem is that the "heart this" link is also replaced with the unflag link for the "qc_no_problems" flag. See screenshot:

I've tried embedding the second flag in a block, tested with the default "bookmarks" flag, and still having the same problem. Any ideas on what's causing this?

CommentFileSizeAuthor
multi_flag_problem.png249.42 KBjordanmagnuson

Comments

jordanmagnuson’s picture

Interesting: the problem turned out to be in my implementation of hook_flag_flag, where I accidentally had an assignment operator rather than an equality check:

function message_un_flag_flag($flag, $entity_id, $account, $flagging) {
  if ($flag->entity_type == 'node' && $flag->name = 'heart_this') {
    message_un_create_message_user_hearted($entity_id, $account->uid, REQUEST_TIME);
  }
}

Problem: $flag->name = 'heart_this' should be $flag->name == 'heart_this'

jordanmagnuson’s picture

Status: Active » Closed (fixed)