Closed (fixed)
Project:
Flag
Version:
6.x-1.1
Component:
Flag core
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Dec 2009 at 12:11 UTC
Updated:
22 Jan 2010 at 14:10 UTC
Hi,
I wanted to count the number of flags of a special kind the currently logged in user has placed on nodes:
<?php
global $user;
$flag = flag_get_flag('name_of_the_flag');
$count = $flag->get_user_count($user->uid);
print $count;
?>
I wanted to use this code in a view as well as in the template for the the content type - in both cases "0" is shown although the logged in user used this flag for some nodes. Did I something wrong?
Greez,
Tobias
Comments
Comment #1
tobiberlinAny ideas?
Comment #2
quicksketchThat exact code works for me just fine.
Comment #3
tobiberlinOk, I just found out that the used flag was global so that in database table no user id is saved. By changing the flag to a non-global one this code allows to count the number of flags of a special kind a user has set.