Questions tagged [users]

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

Filter by
Sorted by
Tagged with
-1
votes
0answers
8 views

How best to export user accounts, delete them and then re-import to same site at a later date [closed]

For complicated reasons I need to delete a batch of user accounts from my Drupal 8 website and then re-import them at a later date. I am presuming that whatever does the export and import is working ...
1
vote
0answers
15 views

Create a user map with a results tables below it

I've been searching around for the past couple months, watched a lot of YouTube videos, and read a lot of tutorials, and I've made a lot of progress with an alumni directory our team is creating. But, ...
1
vote
1answer
46 views

How can I bulk delete users? [duplicate]

My site got hacked and I had an online service clean it out. However, it now has over 150,000 user accounts, the bulk of which have no role assignment. How do I delete these accounts and their content?...
0
votes
2answers
64 views

Map profile_id based on previously mapped uid when migrating user profiles from CSV file

I'm trying to migrate users and user profiles to site, where both entities might be already present. In this case I would like to overwrite specified fields and leave others in the original state. I'm ...
1
vote
1answer
73 views

How to determine which password hash is used?

We have migrated website from a vanilla coded PHP to Drupal, and I have also migrated all the users. The old website has been using the password_hash() function to encrypt the password. The website ...
-2
votes
1answer
47 views

Editing the "Send private message" link to include the username

I'm using the Private Message module version 8.x-2.0-beta16 and I want to change the message from 'Send private message' to 'Send private message to @username' which should display the username from ...
-1
votes
1answer
44 views

How do I get the (integer) uid from the User entity?

On the odd chance there was a "getUid()" method for the user entity, I tried it, but got: Call to undefined method Drupal\user\Entity\User::getUid() Is there a way to get the uid from the ...
0
votes
0answers
34 views

Cannot add user picture for administrator

I installed 2 servers with Drupal 9.1 and I updated to Drupal 9.2 I just noticed that there are problems with the modification of the administrator account "user 1". In the list of users, ...
0
votes
0answers
36 views

How can I get rid of 403 errors thrown when accessing /user/0?

We have a Drupal 8 site which allows anonymous comments. These comments are recorded with user ID 0. When indexing the site, we get 403 errors for any entity which has an internal link to User 0. In ...
0
votes
0answers
12 views

Custom User Field Hook_query_view_alter()

I want to dynamically filter a view using the hook_view_query_alter. My goal is to be able to display all the users for the sub-admin in a view that has the same custom field as it. But I don't ...
0
votes
1answer
163 views

How to get current user jwt token?

In a custom module, I need to get the jwt token (access_token) related to the current user. Following this issue I've tried to get it, but without success, because get_jwt_key() and jwt_token_params() ...
1
vote
1answer
20 views

How to display 'Welcome [first_name] [last_name]' in a custom views block? D8

I would like to create a custom block / view to display a welcome message to the currently logged in user in Drupal 8. I followed this answer but it isn't working for me. Maybe things changed in D8. ...
1
vote
0answers
17 views

What is the specific security implication with the permission "Select method for cancelling account"

Below the permission "Select method for cancelling account" there is the following hint: Warning: Give to trusted roles only; this permission has security implications. I understand that ...
1
vote
1answer
20 views

How do I let users cancel their account with JWT / JSON:API?

I am making an Ionic app with Drupal as the backend. Users log in via JWT. I'm using JSON:API to send data to Ionic. Now I want to allow users to cancel their accounts in the app (by JSON:API) ...
0
votes
0answers
16 views

Account Settings: "Access Denied" on emails translation

I'm having issues for accessing the "Email Notifications" from user configuration in Brazilian Portuguese. All Developer Portal "User Email Notifications" are being sended in this ...
0
votes
0answers
37 views

How can I sync just roles/permission config across multi-site instances?

On a Drupal 8 multi site, we need to have unified ROLES/permission config in all sites. Then we'll assign these roles to users via interface or Drush. How could I export / import? Or even better sync ...
0
votes
0answers
11 views

Does the login-link users receive upon registration actually expire?

I'm trying to expand the duration for the expiration of the one-time-login for the initial registration process: user clicks on "create new account" after filling name and email and sending ...
1
vote
1answer
46 views

how to set a node to anonymous author?

Change node author works : $node = \Drupal\node\Entity\Node::load($nid); $node->set('uid','45'); $node->save(); But i don't know how to set it to anonymous user ? or unset it ? $node = \Drupal\...
0
votes
1answer
36 views

How to get the contents created by a User?

How to get all contents from which the current user is author? $currentUser = \Drupal::currentUser(); $user = User::load($currentUser->id()); //get the contents from which $user is author?
0
votes
0answers
141 views

How can I programmatically create an user account and trigger an activation email?

I developed custom module to create users. And I setup config account setting "Require email verification" to "Require a verification email, but let users set their password directly on ...
0
votes
1answer
39 views

user deletion : user_cancel_reassign not working when user has more than 10 associated contents

I am attempting to suppress Users with no permissions/roles from our sites. The user associated contents should be kept on user deletion. This code below works when the user has a few associated ...
1
vote
0answers
69 views

Can I cast a generic type reference (EntityInterface) of an object, to a more specific, AccountInterface, if I know the object is a user?

Here is my code // implements hook_node_presave function mymodule_entity_presave(Drupal\Core\Entity\EntityInterface $entity) { if ( $entity->getEntityTypeId() === 'user' ) { so now I know the $...
0
votes
0answers
75 views

Error message for duplicate email for user registration

On my site, users sign up by submitting their email and name to a user registration form. They will get an email with a link that will allow them to complete the rest of the sign up process, like ...
0
votes
0answers
15 views

How do I automatically add a user to a group when a user role is added to the account?

What I would like is that when a Drupal user has a User Role added to their user, then this also adds them to a specific Drupal Group. When I talk about User Role, I mean the standard User Roles ...
0
votes
1answer
32 views

Headers already sent

I found this error repeated several times for two of the pages on my website. Warning: Cannot modify header information - headers already sent by (output started at /home/customer/www/mydomain....
1
vote
2answers
116 views

How do I get group to which the node belongs and redirect anonymous users to the login page if they land on it?

I'm using the Drupal Group module and I've added content to a Drupal group I've created. I've also added users to this Group. Works well: Drupal users have to login to see this content in that group. ...
2
votes
2answers
79 views

PostCreate/Hook on User Registration

I want to hook into user registration but there doesn't seem to be any hook for it anymore. This is what I see from Drupal 8.8: hook_user_cancel hook_user_cancel_methods_alter ...
1
vote
1answer
89 views

Migrating user accounts to Okta

I'm trying to migrate users exported from Drupal into Okta using the /api/v1/users API (specifically [creating users with import hash][1]), and am stuck, and desperate for help as I'm late on a ...
0
votes
0answers
35 views

How to redirect logged in user to different page rather than what is configured in basic site setting? [duplicate]

I have the following requirement: When an anonymous user visits the site, they will get /login page which is configured in Configuration -> Basic site setting -> Front page. After logging in ...
0
votes
1answer
27 views

How can I conditionally create a user account based on field in registration?

Here is the scenario: Prospective employees (PE) who need to access this Drupal site for onboarding resources will be sent an access code from someone in HR (to prevent random people from creating ...
3
votes
3answers
424 views

How to implement decoupled user registration with React / jsonapi?

I have built a React app that uses JSON:API to pull in data, but now I want to implement user registration. JSON:API doesn't do user registration because it isn't a CRUD operation. However, the links ...
0
votes
0answers
33 views

How can I migrate users?

I need to rebuild my website, actually built with Drupal 7, and install Drupal 8. I have some modules that don't exist in Drupal 8. So, I decided to install Drupal 8 and rebuild the website from ...
0
votes
0answers
20 views

Is there a way to ouput variables in a custom module?

I'm updating a custom module and I would like to output the $node and $user variable to see what is in it for a specific key. The value of this key can be one or multiple strings and I'd like to know ...
-1
votes
2answers
56 views

Updating user leads to sql integrity issue

Please help me find what I am doing wrong to update a user field. I am trying to update all existing users in my Drupal 8 instance. I could do the same thing easily in D7, but can't get it working ...
0
votes
0answers
32 views

I've placed blocks in hidden region, now no login to admin possible

I made a site in Drupal 9. I played a bit with blocks and I think I placed an important block in the hidden region. Now the login page doesn't show the login form anymore. The header, footer and some ...
0
votes
1answer
80 views

How to create Media entity and attach to user field

I'm trying to import user profile pictures from Drupal 7 to Drupal 8. So far I've managed to upload the picture from the url and save it to the file system, create Media entity and use the user id as ...
0
votes
0answers
25 views

Can't upload anonymously using webform

I am using varbase 9.0.0-rc1 distribution I have successfully uploaded files using the forms while I am logged in. But anonymously I get the following error: An error occurred while attempting to ...
5
votes
1answer
392 views

Locked myself out after enabling misconfigured Google Authenticator

I somehow managed to lock myself out of a Drupal 9 installation after setting up TFA with Google Authenticator login. So, i know my user1 name, my user 1 password, but TFA doesn't allow me backend ...
0
votes
0answers
40 views

User's Name, Roles and Mail not accessible throughout the CMS

I'm trying to access different properties of a Drupal user, such as name or mail, but they are not accessible, either from Drupal Rules module or from the emails sent when a new user has been created ...
3
votes
0answers
91 views

How can you require users to change their passwords on first login after migration?

We are planning to migrate users from another CMS to Drupal. We can migrate usernames, but not passwords as the encryption is different. So we shall have to assign passwords to them. Earlier versions ...
0
votes
1answer
101 views

How to migrate password with hash

I'm doing a user migration from Drupal 7 to Drupal 8 (the data is in json format) Most of the fields have been imported to the new website. Now, I'm in the process to migrate the password; this field ...
0
votes
1answer
123 views

How do I log in a user?

I want to log in Drupal 8 users from an external PHP file. I am trying the following code. use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; use Drupal\user\UserInterface; //$...
1
vote
2answers
46 views

Batch delete users and the content they created

When I received this Drupal 7 site to manage, it has had years of being open for people to make accounts and now I have ~ 300 PAGES of users with names like ismehacker1234568 and such, with under a ...
0
votes
0answers
12 views

How to add a password reset link in the "Administration Views"

The administration views on drupal 7 https://www.drupal.org/project/admin_views replaces user page with a new views. I would like add a password reset link which would send a password reset email to ...
0
votes
0answers
101 views

Multi-site user share with different databases

I am trying to setup multi-site on Drupal 9.1 using a shared codebase with separate databases. Working within each site separately has been fine, and I'm ready to start working on sharing users and ...
1
vote
0answers
41 views

How can I reliably login by username in hook_form_user_login_form_alter for SSO?

I'm integrating SSO for one of my Drupal 8 websites. We have on-premise SSO and getting user details and respective user roles from SSO response. When I try below code, sometimes it works. Sometimes ...
1
vote
1answer
46 views

Inconsistent behavior with user_logout function

For a drupal 8 site, I have a custom function that does the following: It logs out the user and sends them to an external url Inside the controller CustomController, I have: function custom_logout(){ ...
0
votes
1answer
60 views

SMS password recovery

I'm currently using D7. When my users attempt to request a password reset, 95% of the time, these reset emails land in their spam, or are blocked by whomever their email provider is. That being said, ...
0
votes
0answers
8 views

How do i hide a views field(button) based on rolde?

I have a question, I have created one custom button by altering the view and now i want to restrict that button for few roles like for role 1 & role 3 it should visible but for role 2 & role 4 ...
0
votes
1answer
21 views

How to set role on the registration form programmatically

I'm trying to create multiple registration forms with a role assigned to each. It seems that my default value for the role is not keeped, but it works with other fields Here is my code $form = $this-&...

1
2 3 4 5
132