Questions tagged [flags]
Use it for the module implementing a flexible flagging system, completely customizable by the administrator users: the Flag module.
459
questions
-2
votes
0answers
22 views
Saving a views list of flags and generate a link to it
In Drupal 9 I am generating a list of flagged media elements with views for any not logged in user.
I need to save the result somehow and generate a permanent link to this result (to be shared then).
0
votes
0answers
12 views
try to hide button with certain class in js file
I've got flags in a paragraph field, I try to hide other flags of the paragraph if one is clicked.
Here is the html:
<div data-quickedit-entity-id="paragraph/10" class="paragraph ...
0
votes
1answer
21 views
How to unflag/reset a flag again, when matching some conditions in onFlag event?
in my custom module I have an event subscriber service for flag module. I used the tutorial here as a base for learning: Link to Tutorial
Here is my code:
namespace Drupal\MYMODULE\EventSubscriber;
...
1
vote
0answers
26 views
Flag commerce product variation breaks page
I am building a shop on Drupal 9 ,Commerce 2, and want to implement a "my favorite products"-bookmark, so that a user can bookmark products and save them for later. So, I installed flag ...
0
votes
0answers
32 views
How do I limit the number of nodes created after the flag was raised?
I created a custom module to display a news feed. When a node is created, the module creates a message, users flag the parent group and receives the messages.
When users flag a group, they receive all ...
0
votes
0answers
14 views
How do I add the flag bundle as a field in Views for all users?
I have a view of flaggings. My site has three types of flags:
Fruits
Vegetables
Mushrooms
In Views, under Filter Criteria, I can add Flag: ID and then select the Flagging type in order to filter by ...
1
vote
1answer
40 views
In hook_form_alter(), how can I access the entity that is being flagged?
In hook_form_alter(), I want to load the entity being flagged so that I can do some processing based on the field values of that entity.
However, I can't find an entity object using kint($form). I ...
0
votes
1answer
23 views
How to have users set a value for a flag field upon flagging?
I added a field (Text list of options) to my flag. But, when a user flags the content, they don't get a chance to set the value for the field (the flagging form does not show the field to edit). ...
2
votes
1answer
47 views
With a view of flaggings, how do I get the flagged entity?
I want to create a view of flaggings and show content from the flagged entity.
However, on a flaggings view (Flag 4.x, Drupal 8/9), when I try to add a relationship, I can only add a relationship to ...
0
votes
1answer
47 views
How to update the TWIG flag conditions?
I have this code in my sub theme :
bootstrap_subtheme_front_office_old.theme
<?php
/**
* Implements hook_preprocess_HOOK() for user.html.twig.
*/
function ...
1
vote
2answers
56 views
How do I redirect on flag save programmatically?
I want to redirect users to a view when they flag a taxonomy term.
This question is about how to use Rules to redirect on flag save. I want to do this programmatically.
I tried to use hook_form_alter(...
-3
votes
1answer
46 views
Unable to display message when account is flagged
I have this code in my sub theme :
bootstrap_subtheme_front_office_old.theme
<?php
/**
* Implements hook_preprocess_HOOK() for user.html.twig.
*/
function ...
0
votes
0answers
34 views
Send email notifications to Users who have flagged a node
For a site, I 'Events' which have a datetime field for the start time of the event. We also have 'Flags' to allow Users to add specific events to their calendar.
Now, we would like to send Users email ...
-2
votes
1answer
156 views
How to put a condition in TWIG “if the user is flagged”?
I have a site with Drupal 8 and the Flag module.
I would like to display a text when the user has the association role and when it is flagged with the following flag (his machine name):
...
-1
votes
1answer
58 views
How to automatically flag entities once (without PHP error)?
I created a custom module to automatically flag new entities and update entities. It works :-)
Here is the problem :
If I update a neud it is flagged. Perfect that's what I want to do, but if I update ...
-1
votes
1answer
78 views
How do I flag new user accounts or updated accounts?
I created a custom module to automatically flag new user accounts and updated accounts. When I create a new user or update an existing account, it is not automatically flagged and there is no error ...
0
votes
2answers
61 views
How do you target a specific type of content?
I have the content type (node), article, page, recipe.
The code below can be used to flag any type of content.
How do you target a specific type of content ?
For example I only want to flag the ...
1
vote
1answer
33 views
How do I get the administrator to automatically flag?
I created a module for flagging entities automatically when created or updated.
There are some errors in my code because only nodes work.
If a user "user1" creates a node, the flag will be ...
0
votes
1answer
61 views
How do I flag the update store automatically?
I created a flag to flag the stores. I want when a user updates a store, the store is automatically flagged. The code below does not work and there is no error message.
I don't want to use the Rules ...
-1
votes
1answer
59 views
Cannot flag nodes and comments automatically
I created a code to automatically flag nodes and comments. When I put only the code to flag the nodes, it works. But when I add the code to flag the comments it doesn't work anymore.
Which code should ...
0
votes
1answer
41 views
How can I automatically flag new comments?
I have a Drupal 8 site with Flag and Rules modules. How to flag a new comment ?
I want that when a user creates a comment, the comment should be automatically flagged.
I created a type of Flag on the ...
0
votes
1answer
110 views
How to flag an entity when it is created or updated?
I have a Drupal 8 site with the Flag module.
I want when a user creates or updates a node, product, store, group, ... the updated entity is flagged.
How to flag an entity when it is created or updated ...
0
votes
1answer
17 views
How do I get low level data from the Flag module?
Is it possible to get the following raw, low level data from the Flag Module and/or it's services?
Flagging count as integer
URL to flag/unflag as a string
Current user's flagging status as boolean
...
0
votes
1answer
30 views
How can I programmatically flag a user?
I am creating a new user programmatically in drupal7. At the time of user creation is there any way to flag the user automatically.
I am using flags module.
I tried in the hook_user_presave
function ...
0
votes
0answers
19 views
Print user field on a user profile?
I am using:
Drupal 8.8.8
Open Social 8.4
Profile 1.1
Flag 4.0-alpha3
I am using the Open Social module which uses profiles and have added a flag to users called āFollow Userā (Machine name: ...
2
votes
1answer
174 views
How can I show the flagging field edit form on a node?
On a flagged node, instead of showing the flag/unflag link, I want to show the flag edit form.
Here's my setup.
Basic page content type can be flagged with the flag Bookmark. Bookmark is a per-user ...
1
vote
2answers
41 views
How do I make a link to a flagging edit page?
I'm using Drupal 8 with Flag 4.0-beta1.
On my flag, I have several fields. I want users to be able to edit these fields after making the flag.
How can I make a link to edit the flagging?
I tried ...
0
votes
1answer
36 views
How do I make a link to a flag edit page?
I'm using Drupal 8 with Flag 4.0-beta1.
On my flag, I have several fields. I want users to be able to edit these fields after making the flag.
How can I make a link to the flag edit page?
I found ...
1
vote
1answer
117 views
Invalid CSRF token using flag.link_builder service (Flag module)
I have a REST route that returns a list of user accounts. I have a flag setup called 'following' as you can follow and unfollow other members. In my REST route, I use:
$flag_link = \Drupal::service('...
0
votes
0answers
8 views
Is there a way to make a view show current user content along with a following flag?
I am working on a project powered by Drupal 7 and I would like to have a page (Frontpage) powered by the views module which will show content (nodes) from the current logged in user and also content ...
1
vote
1answer
64 views
How can I write into a Flag's custom field programmatically?
I successfully managed to save a flag programmatically in Drupal 8 thanks to this help but I cannot manage to save data into a custom field I added to the flag entity.
The following code saves the ...
0
votes
1answer
32 views
How add sorting by Flag counter in Controller?
I get node list in my Conroller:
$query = \Drupal::entityQuery('node')
->condition('status', 1)
->pager(10)
->sort('created' , 'DESC');
$nids = $query->execute();
How can add ...
-1
votes
1answer
233 views
How to count the number of comment and flag in a node?
I want to display on my node the number of comment and flag.
What should I add to my TWIG to get this?
How to count the number of comment and flag in a node?
Here is an example :
1
vote
2answers
94 views
How to prevent certain users from adding (for example, a Node) to bookmarks with Flag Module
Flag Module >>> https://www.drupal.org/project/flag
How to disable/prevent some Users (NOT Roles) from adding (for example a Node) to bookmarks? Maybe showing a message after clicking on the Boomark ...
0
votes
2answers
910 views
How to print in twig a Flag Link field
I have a views-view-unformatted.html.twig template working fine where I can print fields from a view of nodes.
Example: having i = 3, print row number 3 title
{{ rows[i]['content']['#row']._entity....
2
votes
1answer
99 views
How to exclude views fields from display when a node is flagged
We use the flag module to mark items that will have delays in shipping so that the customer knows that those items will be delayed before adding them to cart. In drupal 7, we excluded our "add to cart"...
0
votes
0answers
37 views
Flag/Unflag Taxonomy term when updating Taxonomy field in user profile
I asked this question a few days ago: Send email to all users that are tagged with the same tag a node is when created
I decided to go a different route and use the flag and rules module to associate ...
0
votes
0answers
91 views
How to limit flagging in drupal 8?
Node compare is awesome plugin but it's just only in D7.
I'm using Drupal 8.
I have a views page which integrated with flag(compare it) and flipped table module to compare contents. It has limit to ...
2
votes
1answer
755 views
How can I get flag count of a flag?
I see extensive Drupal 7 documentation for the Flags module, but very little for Drupal 8.
I have a Signup flag on a Drupal 8 node (which is an event). I need to suppress the Signup link when a ...
3
votes
1answer
797 views
How to change the labels TRUE and FALSE of a boolean field in views exposed filter
I am using the flag module to toggle a node type 'Task' as Done.
I made a view that lists the tasks, and added a views exposed filter for the flag status, which is a boolean field.
In this way users ...
1
vote
1answer
16 views
Node is flagged, node author comes back to the site, how to show how many new flags since last visit?
I created a "new activity feed" view page in which a user can see how many new comments have been posted to his own nodes since his last visit
Eg : since you last last visit :
- 21 new comments have ...
-3
votes
2answers
186 views
How to redirect user to login page when anonymous user click on the flag link?
Redirect user to login page when anonymous user click on the flag link.
How to achive this?
I have created flag links by
function MYMODULE_preprocess_node(&$variables) {
$node = $variables['...
0
votes
1answer
37 views
Disabling node editing after first node flagging
I use flagging for signing petitions. Petitions should be editable until the first signing (flagging) is done.
Now I look for a solution to disable node edition after first signing.
My first thought ...
2
votes
2answers
200 views
Is there a way to add non indexed fields to a search api view?
Iām wondering if itās possible to add non-indexed fields to a search API indexed view?
I want the standard flags fields to be available on the indexed search view. And I was thinking I could do this ...
0
votes
0answers
88 views
Rules, Flags, Follower and New Content Notification
I am trying to setup a couple of rules. So far I have messed with rules some but since I am new, haven't had any success. This is what I am trying to achieve.
Have created a user flag called FOLLOW. ...
2
votes
1answer
442 views
View, flag, and followers
I have a user flag that is called "follow" and am trying to setup the following views in Drupal 8.
I want to create 3 views for my website's user profile pages:
A list of users flagged by a user (...
0
votes
1answer
244 views
Token for Total Flag Count
I have created a flag for my comments named HELPFUL. If users find a comment helpful they vote it as such.
The challenge that I have is how do I show the total votes for the flag next to the button? ...
1
vote
1answer
227 views
Flag count is incrementing only after page reload
I have a views with like and unlike flag. When I click on like flag the count not increments. But when I reload the page, then only like's count will change. How can I solve this issue?
Note: I have ...
2
votes
1answer
284 views
How to show users who have not flagged a node with any flag?
Drupal 7. I have a content type that can be flagged with 3 different flags. I need to display a view of users who have not flagged any of them.
The users that are allowed to flag are listed in an ...
2
votes
1answer
33 views
How to stop users from flagging other users if they have a custom taxonomy term?
I'm working on a project where users vote other users using the Flag module. Each user has a department term reference field. I would like to stop a user from flagging another user if they have the ...