Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [users]

One of the most important entities Drupal uses is the user entity.

1
vote
2answers
26 views

Triggering an action after user resets password?

I was hoping there was hook_user_pass_reset, but I seem to be out of luck. Some background: I made a new field on users called "email_confirmed" This field gets set = 1 when the user has confirmed ...
0
votes
1answer
18 views

How do I programmatically set the preferred language for a user?

I would like to update the preferred_langcode of a user as soon as he changes the language in a language switcher block. I'm already aware of the getPreferredLangcode method mentioned in https://api....
-1
votes
0answers
23 views

Displaying drupal_set_tittle and drupal_set_messages

I have implemented this code on my .module file in netbeans for my drupal website and its not displaying the tittle and the message on my drupal website ,what could be the problem? ?php function ...
0
votes
3answers
36 views

How can I display a list of users who have the same taxonomy term

The setup: A Taxonomy Vocabulary called "Area of work". The vocabulary has the following associated terms: A, B, C, D, E, F, G, etc. During registration users have to choose a department from the ...
0
votes
1answer
33 views

Cancelling user account set draft pages to published

When we cancelled a user account using the Delete the account and make its content belong to the Anonymous user method, we found that the author was set to Anonymous for the pages they were set as the ...
1
vote
3answers
62 views

Allow access to user information without giving access to view user profile page

The main concern is: Nobody (anonymous/authenticated) has the permission to see the profile of any registered user on the site, so I have UNCHECKED the View user information permission for all roles. ...
0
votes
0answers
27 views

Programmatically logging in users only works with accounts created by the gestor

I'm developing a custom module that should register and login users without use the native Drupal login/register form. The problem is that when I create an user in Drupal gestor, and try log it in, ...
0
votes
1answer
57 views

Custom user login in Facebook Auth modules

I try to run Facebook Login on my Drupal 8 site. I run it by Social API module and with Simple FB Connect, but both module generate user name from first and last name on Facebook. My user will not be ...
0
votes
1answer
32 views

Login user programatically (Create user session)

My question is based on this question: Programmatically User login not working i dont have this clear, to login an user (create an active session) only need use User::Load()? i'm triying make this on ...
0
votes
0answers
29 views

Need to mass delete users

I want to start by saying this is my first dealings with drupal of any kind. I can turn a wordpress site inside and out but have zero experience with drupal. My company has recently inherited a ...
0
votes
1answer
24 views

Permission for private file to anonymous

I have an ad content type, with a file field that is in a private directory when saving the node. Ads and their files are only accesible for authenticated users. I wish I could allow anonymous users ...
0
votes
1answer
33 views

How do I display all terms of nodes created by user in a user view field

I have a User view where I list user information with contextual filter UID. I want to display all the terms from the nodes that the user added. I added the Author relationship so that way I can ...
0
votes
0answers
23 views

Check if a user is logged in using default login form or using email direct login link

I'm working on a Drupal 8 project, my question is: is there any method to check if a user is logged in using email direct link or he did using the default site login form? to check I think the right ...
0
votes
1answer
31 views

How to limit access to vocabulary term by role?

We have two roles: Reviewer and Editor along with two content types: Basic and Article. We have a couple vocabulary terms and taxonomy fields on each content type. Currently only users with Administer ...
0
votes
0answers
28 views

How to get all users with a specific permission

Is there a way to retrieve all users with a specific permission (eg "Post comments"). I only found the possibility to get them by their role: Drupal::entityQuery('user') ->condition('status', 1) -&...
0
votes
0answers
22 views

Field permission seems not working with multiple registration

Can I use these two modules together to create a registration form and limit access to certain fields? Module installed : field permissions multiple registration Wat is working ? The creation of ...
1
vote
1answer
100 views

How can I apply logic in user registration welcome emails?

I am trying to put some logic into user registration welcome emails. Simple "if-then" logic, based on tokens. The tokens I use show up as expected, but both twig and php code gets sent as plain text....
0
votes
0answers
30 views

Username is generated after update user informations

in a drupal 8 project I've a problem with users usernames, when updating a user from BO and save change the username changed to be email_registration_{a generated key} this happen even with admin user ...
0
votes
0answers
31 views

How to trigger Rules from Ajax-picture-uploader

I'm using Rules with event "After updating an existing user account". It should trigger whenever a user uploads a new profile picture. Now I've added an ajax uploader for user pictures, the Avatar ...
0
votes
0answers
24 views

Is there a hook invoked after user confirmation?

This question asks it (presumably for Drupal 7), but the solutions all appear to be specific to D7 and not applicable in D8, so that's effectively a different question. It appears that ...
3
votes
1answer
57 views

How do I add secondary tabs to the user (profile) edit tab?

In earlier versions of Drupal, there were categories of users which showed up as tabs on the user (profile) edit page, located at /user/{user}/edit. How can we define new tabs on this page in Drupal 8?...
-1
votes
2answers
74 views

entityQuery condition for users without a role

In Drupal 8 - Is there a way to do a 'NOT IN' in a user based entityQuery? $uids = \Drupal::entityQuery('user') ->condition('uid', 72) ->condition('status', 1) ->sort('...
0
votes
1answer
29 views

Add paragraphs item to user entity

I want to create a new paragraph item to a user bundle. This is the code: $name = "Test"; $userdata = user_load($user->uid); $paragraph = entity_create('paragraphs_item', array('field_name' => '...
0
votes
1answer
28 views

Trouble redirecting users after implementing LDAP

We had a feature on our site where we redirected users with certain roles to a particular landing page upon logging in. In a custom module, we implemented hook_user_login(\Drupal\user\UserInterface $...
0
votes
2answers
22 views

Access denied to all users after migrating site to new server

Please don't consider this as a duplicate post. I have tried all the solutions that worked for others, but still struggling to fix the problem (all users including admin taken to 403 page). This is a ...
2
votes
1answer
69 views

Administrator role missing

I have installed Drupal 8.6.3 minimum profile and found out that there's no Administrator role under permissions section. Is this normal or am I missing something? We have few people that needs to ...
0
votes
1answer
47 views

How can I create Change Password block?

We can create reset password block by \Drupal::formBuilder()->getForm('Drupal\user\Form\UserPasswordForm') in d8, but change password block \Drupal::formBuilder()->getForm('Drupal\user\Form\...
-1
votes
1answer
58 views

I need help with logging in

I'm in over my head. I work for a company who recently had to let go of a bunch of personnel. One of those people was the web developer. I have worked on Wordpress sites before but never a site built ...
0
votes
1answer
26 views

How to disable field on register form but keep show in edit profile?

I need to know how to disable field on register form but keep show in edit profile? because now if I can only enable in both section, edit profile / register. I need only show username + email field ...
2
votes
1answer
42 views

Conditionally register a user based on fields

I have a Drupal 8 User registration form that has several text fields to gather information about the user. I'd like to write a custom hook that examines the values in those fields and then either ...
0
votes
0answers
31 views

Views block doesn't show up at the user profile page

I created a views block and try to make it appear on the user profile page. I did the following steps, but it doesn't show up: Block layout -> Place block Tab Pages: Select "Show for the listed pages ...
0
votes
0answers
11 views

Managing Users on Multiple Drupal Sites

To give you some background: I help run a small website development company and we host close to 50 Drupal sites (each with their own, separate cPanel) on our dedicated server. We need more fine-tuned ...
1
vote
1answer
45 views

A Rule to copy the user's picture

In Drupal 7.. I'm trying to create a rule that copies the user's profile picture into an image field on another content type. How can I select the 'picture' from a user's account, as a source for ...
0
votes
0answers
25 views

Kep getting “access denied” when using a “user-cancel” link

I'm developing a simple troubleshooting menu on Drupal 7 to allow users request a new password or cancel their account depending on some factor. To do so I basically call $mail = drupal_mail('user'...
1
vote
2answers
48 views

What's the best infrastructure to set permissions to user roles that controls who can see which Nodes and which Views?

I'm building a bsite that needs pretty stringent permissions. I have already created the (4) user roles for the site, but not sure the best way to handle viewing permissions. I see that when creating ...
4
votes
2answers
106 views

How can I show the user login block on the 403 page?

With D8, I have a node (content type: basic page) that I use as a custom 403 (access denied) page. I set this as the custom 403 page on: /admin/config/system/site-information. The path is /node/21, ...
-1
votes
1answer
21 views

User role update report

Could you let me know how to check how many users converted from one role to another for a specific period of time (for example how many changed roles from user to superuser from 01/09/2017 to 01/02/...
0
votes
1answer
24 views

What does “Field values for name must use an array structure” mean?

I am try to login via the REST API; curl --header "Content-Type: application/json" \ --header "Accept: application/json" \ --header "X-CSRF: dx3hhNKGorFI_2alL_Zqde2ZFDpefAll2JZd8kNisTA" \ ...
0
votes
0answers
21 views

Dont show results a user has no permissions to

I have created a view that list media entities that are related to the module: Groups. These documents have certain restrictions to them. Each document can get 1 of 4 permissions: Permission A ...
0
votes
1answer
21 views

Allow editing of own content but not show 'node settings' block

Hello all and happy new year! .. I have a question that I thought would have been answered before, but could not find anything.. I want users of a certain role to be able to edit their own content ...
0
votes
1answer
31 views

Grant permission to current user at runtime in specific environment

Many Drupal contrib modules have inverse "feature flag" implementations vis-a-vis a killswitch variable added to settings.local.php to disable a feature: // Killswitch setting. $settings['...
0
votes
1answer
15 views

Print custom field in user edit form in block

Following code prints user edit form in block: function notifikacie_custom_block_info() { $blocks['user_profile'] = array( 'info' => t('User profile edit'), 'cache' => DRUPAL_NO_CACHE, )...
-1
votes
1answer
11 views

Is it possible to set a role specific value for “allow_insecure_uploads?”

I want to override the value for "allow_insecure_uploads" which is in system.file config, but only for specific roles. Am I going to need to do this in a module / does one already exist?
0
votes
1answer
18 views

Override site's registration restriction on accepting invite

We have a custom module that uses the invite module to send invitation to non users. Our site is set to allow registration only by administrator to avoid spam. When the invitees accept the invite they ...
0
votes
0answers
31 views

Embed user edit form in a block

I am trying to embed current user edit form in block. Actually I want just to embed some of the newly added fields. I tried to follow this code: Embed some user profile fields in a block form But I ...
1
vote
1answer
101 views

How to programmatically update a user role name

I would like to update role name programmatically in Drupal 7. Does Drupal provide its own functions to do that, or do we need to query the database and update the name manually? Please note that ...
0
votes
1answer
26 views

When the admin changes(Add/Remove) roles of the user, how to get assigned and removed roles of that user?

There are more than 20 user roles(Editor,approver,new admin..) in the project. Whenever the admin assign/delete the role to user then the user should be notified with email. Email should say Hey ...
0
votes
0answers
29 views

How can I get term id or term name on user profile page

I have a vocabulary(lessons) with terms as math,art,chemistry etc.. These terms are on user page in my lesson field. For example: My Lessons: Math,Geography,Art Scenario: I'm gonna use linked field ...
1
vote
0answers
28 views

How to store all saved values of a field on User entity?

We plan to store a string as a field on a user account page. This is easy to do, but requirement is also to be able to track value changes of the field. Based on my restricted knowledge in Drupal, ...
0
votes
0answers
39 views

Displaying same username for all users with a specific role as comment author

I need to display the same username for users of a specific role as comment author. I have a Role 'Board Moderator'. When users with this role are commenting, a uniform name 'OneUserNameForAll' ...