Get all users who flagged a node

Public

This returns all users who flagged this node and it is for only one flag.

</> CopyGet raw version
php
  1. function get_users_node_one_flag($node_nid, $flag_name) {
  2. $array = flag_get_entity_flags('node', $node_nid, $flag_name);
  3. return $array;
  4. }

This returns all users who flagged this node and it includes all the different types of flags that are used.

</> CopyGet raw version
php
  1. function get_users_node_all_flags($node_nid) {
  2. $array = flag_get_entity_flags('node', $node_nid);
  3. return $array;
  4. }

Same as either above but return just an array of the keys (keys are the user id of the users who flaged)

</> CopyGet raw version
php
  1. function get_users_node_one_flag($node_nid, $flag_name) {
  2. $array = flag_get_entity_flags('node', $node_nid, $flag_name);
  3. $usersAsValue = array_keys(array);
  4. return $usersAsValue ;
  5. }
  6.  
  7. function get_users_node_all_flags($node_nid) {
  8. $array = flag_get_entity_flags('node', $node_nid);
  9. $usersAsValue = array_keys(array);
  10. return $usersAsValue ;
  11. }