Skip to content

Instantly share code, notes, and snippets.

@hanamizuki
Created December 18, 2012 14:13
Show Gist options
  • Save hanamizuki/4328301 to your computer and use it in GitHub Desktop.
Save hanamizuki/4328301 to your computer and use it in GitHub Desktop.
A different method, get_user_count(), is used for counting the items a user has flagged. This method is less efficient than get_count() because an SQL COUNT query is issued.
$flag = flag_get_flag('votes') or die('no "votes" flag');
// We assume an $account variable exists in this template.
print format_plural($flag->get_user_count($account->uid),
'This user has participated in 1 voting.',
'This user has participated in @count votings.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment