Questions tagged [users]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
14 views

Users chosen from a field in a content type see only their result

I have a list of students who are users in my Drupal 8 site. I want to publish their result but I want each student to see only his/her result. I have a content type where I can get marks and an ...
2
votes
2answers
29 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
votes
0answers
19 views

php send email to multiple recipients from variable [closed]

I have a problem. I am new in php so I need your help. I want to send multiple emails via phpmailer but the send must be individual to each email in part. Bellow is my example. The code is working but ...
1
vote
1answer
33 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
34 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
15 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
155 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
29 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
19 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
43 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
31 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
52 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
23 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
383 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
36 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
53 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
48 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
64 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
37 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
11 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
54 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
32 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
38 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
37 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
7 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-&...
0
votes
1answer
31 views

Which hook to use to detect new members added to group?

What is the best way to make a hook that only fires when new members are added to a group? I have a function that exports group memberships to moodle course enrolments. Right now I have it bound to ...
0
votes
0answers
33 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
1answer
37 views

How to display the user's preferred language in a User profile page

In a Drupal 8/9 site, I can select the User's preferred language. In the "Manage form display" page (for user's fields), there are two rows which are about language: Language settings (...
0
votes
1answer
52 views

How do I access profile fields? [duplicate]

I have installed the Profile module. I am trying to programmatically load profiles. The code works, but I am not able to access any field value. class IdCardController extends ControllerBase { /** ...
1
vote
2answers
46 views

Programmatically uploading and validating a user_picture

I use the following code to modify the image in the user_picture field of user with uid 42: // Get user. $user = \Drupal\user\Entity\User::load(42); // Create file. $file = file_save_data( ...
0
votes
0answers
34 views

How do I limit my views of “Message” to the current user registration date?

I have created a "Message" views. "Message" module for Drupal 8 : https://www.drupal.org/project/message I want to display only messages created after the creation date of the ...
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 ...
-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 ...
-1
votes
2answers
46 views

how a user can add another user but this is not an admin [closed]

I have 5 roles (Admin, HRM, Registrar, Staff, and HOD). Admin users will give special access to HRM users to add new users whose role is Staff. Registrar and HOD roles shouldn't be shown in the Add ...
0
votes
1answer
62 views

Hiding a tab on a user profile based on the user role

I'm making a site using Drupal 8 and I have several roles defined, one of them is Writer. I made a view to show as a tab in the user profile pages called Backlist. If the user is a writer, they can ...
0
votes
2answers
47 views

How can I limit the password reset attempts?

I have Google Recaptcha, but some users try to recovery password too often. I didn't find any solution for this problem. I want to make 5 attempts limit for this.
0
votes
1answer
60 views

How do you programmatically get the current user's status?

I'm trying to get the currently logged-in user's status (active or blocked) in template_preprocess_user. I tried the following with no luck. function MYTHEME_preprocess_user(&$variables) { $user ...
0
votes
1answer
25 views

Can't log in as admin

Someone let us know about an error on our site. I logged in (as an admin). I was able to move the site to maintenance mode and then went through the steps to clear the cache on the site. Once I did ...
2
votes
1answer
40 views

How to limit country list for address form drop-down?

In my store I defined list of supported billing and shipping countries at store settings. This list is respected during checkout process - limited list of countries is shown when customer is entering ...
2
votes
1answer
46 views

Can user UUID be null?

I have a Drupal 7 site with a bunch of users. I want to migrate the users to Drupal 8 but not any of the content so I'm writing a crosswalk. Drupal 8 has uuid in the users table. Is there a way I can ...
0
votes
0answers
30 views

User own account, cancel account button not showing on edit form

I'm using Drupal 8, on my website I have 2 users roles, both can delete their own data, on role 1 cancel account button show on the edit form in both languages, Portuguese and English(default), but on ...
0
votes
0answers
40 views

Why do I get an “can't add field due to unmet dependency” error?

In order not to manually duplicate a field from the staging environment to production, I'd like to programmatically create some user fields. I've tried with drush generate field, which basically gave ...
1
vote
1answer
67 views

How to delete a field programmatically

I've got a service managing the install/uninstall of my module. Install create a field attached to the user but I am not able to delete it during the uninstall process... stacko.services.yml services: ...
0
votes
0answers
22 views

403 Access Denied only on homepage as anonymous, but page displays for all users

I have inherited a very old, oddly customized Drupal 6 website here http://thomascranelibrary.org/. I would like to create a static copy of the site and send it into retirement, but the 403 error is ...
2
votes
1answer
51 views

How to resave all user accounts on a schedule?

I want to re-save all user accounts on my site weekly because I wrote some code in hook_user_presave() that I want to update every week. Specifically, my hook_user_presave() code updates the values of ...
-3
votes
1answer
27 views

Is it possible to schedule approving and blocking users (user status) triggered for example by date? [closed]

On D8, any recommendation on approving and blocking user status (active or blocked) by schedule (for example triggered by some dates)? Use case e.g. users as members on subscription, will require ...
0
votes
0answers
15 views

How to reset user anonymous & user authenticated role (both currently blocked)?

Few years ago I made some changes to user roles on my drupal website but I don't know where and how :) I wanna probably block role: anonymous user & authenticated user. Is there any way to change ...
0
votes
1answer
37 views

Access denied to all profiles of a certain type

I am migrating from D7 to D8. I've had success with everything but the profiles from D7's profile2 module. Four profile types have to be migrated. One of them is being migrated without issue: I can ...
0
votes
0answers
21 views

Complex Group Permissions for Users and Content

My application holds content about projects. Projects have a number of entity reference fields including ones giving them both a team and a region. Projects live inside of units (1-to-1 relationship)...

1
2 3 4 5
132