🇺🇦 |
This module is maintained by Ukrainian developers. Please consider supporting Ukraine in a fight for their freedom and safety of Europe. |
Module provides ability:
- Show configurable message "Login or Register to use this flag" to anonymous users instead of flag link
- Show original flag label, on click: Display popin with message "Login or Register to use this flag", Drupal 8 version
- Open Login and Registration form in popup (with ability to tune Login and Registration popups settings), Drupal 8 version
- Automatically "Flag" entity with clicked flag after successful Login or Registration
Basic usage
Flag anonymous module helps you to show existing "flagging" ability to anonymous users and motivate them to login or register in a simple way (on the same page using popup).
Requirements
Installation
- Install the module to:
- Drupal 7:
sites/all/modules/contrib
orsites/all/modules
- Drupal 8:
modules/contrib
ormodules
or with Composer:$ composer require 'drupal/flag_anon:^1.0'
- Drupal 7:
- Enable Flag anonymous module
Configuration (Drupal 8)
- Go to a Flags list page
/admin/structure/flags
- Click "Edit" link on Flag which you'd like to configure
- Or click "Add flag" button if you'd like to add a new Flag
- Scroll down flag edit page to "Anonymous settings" section
- Check "Show this flag to anonymous users even if they don't have permission to use it." checkbox to enable module functionality.
- IMPORTANT NOTE: Anonymous users shouldn't have Flag/Unflag permission for currently edited flag (shouldn't be able to use this flag). If anonymous users have Flag/Unflag permission remove it using
/admin/people/permissions#module-flag
page, otherwise module functionality will be blocked.
- IMPORTANT NOTE: Anonymous users shouldn't have Flag/Unflag permission for currently edited flag (shouldn't be able to use this flag). If anonymous users have Flag/Unflag permission remove it using
- Choose "Label display" option:
- "Keep original flag label (show Message on click)" - in this case original flag label will be displayed. On click by it: Popin with "Login or Register to use this flag" message will be displayed.
- Set "Dialog message title" - it's a title of Popin with "Login or Register to use this flag" message. Leave blank to have empty Popin title.
- "Show Message instead of flag label" - in this case flag label will be replaced with "Login or Register to use this flag" message.
- "Keep original flag label (show Message on click)" - in this case original flag label will be displayed. On click by it: Popin with "Login or Register to use this flag" message will be displayed.
- Set "Message" - it's a "Login or Register to use this flag" message. You can use:
@login
- Login link,@register
- Registration link placeholders there. - Set "Login link label" - a label for Login link placeholder.
- Set "Register link label" - a label for Registration link placeholder.
- Check "Show Login and Registration form in popup." checkbox if you'd like to show Login and Registration forms in Popup on click by "Login" or "Register" links
- "Login popup settings" - Login popup settings for
data-dialog-options
attribute. Valid JSON should be used like:{"width": "auto"}
- "Register popup settings" - Registration popup settings for
data-dialog-options
attribute. Valid JSON should be used like:{"width": "auto"}
- "Login popup settings" - Login popup settings for
- Fill or change other needed fields and click "Save Flag" button.
For developers
To add custom placeholders into configurable "Login or Register to use this flag" message implement hook_flag_anon_message_placeholders_alter()
and add additional placeholders there (see more details in flag_anon.api.php file).
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Content Display
- Ecosystem: Flag
- 610 sites report using this module
- Created by snufkin on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
8.x-1.1
released 7 July 2023
Works with Drupal: ^8.8 || ^9 || ^10
✓ Recommended by the project’s maintainer.
Drupal 10 support was added
Install:
Development version: 8.x-1.x-dev updated 10 Jul 2023 at 08:15 UTC
7.x-3.2
released 10 January 2019
Works with Drupal: 7.x
✓ Recommended by the project’s maintainer.
Development version: 7.x-3.x-dev updated 10 Jan 2019 at 12:38 UTC