How to display count to anonymous users along with flag

Created on 1 February 2023, almost 2 years ago
Updated 12 July 2023, over 1 year ago

I have enabled the module and configured.
Anonymous users are able to see the flag text, but my flag also includes a counter which is not visible.
Counter setup details here https://drupal.stackexchange.com/questions/263221/how-to-use-the-flag-co...

How can I display the counter also?

πŸ’¬ Support request
Status

Closed: works as designed

Version

1.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States aharown07

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @aharown07
  • Hi,

    I modified the twig template which comes with flag_anon:

    {% set count = flagcount(flag, flaggable) %}
    <div{{ attributes }}>  
      <span class="label btn btn-outline-success"{{ label_attributes }}>{{ label }}{% if count %}<span>{{ count }}</span>{% endif %}</span>
      {{ message }}  
    </div>

    Now it displays the label along with flag count with some buttons classes. When clicked, flag_anons login popup will show etc.

  • Status changed to Closed: works as designed over 1 year ago
  • πŸ‡©πŸ‡ͺGermany Antonnavi Berlin

    Hello aharown07 β†’ ,

    Flag counter can be added in the template, as described by Anssi ( anderz β†’ ) above.

    --
    Best regards,
    Anton

  • πŸ‡ΊπŸ‡ΈUnited States aharown07

    Much appreciated.

Production build 0.71.5 2024