Questions tagged [users]

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

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

How can we add a filter to /admin/people/switch-user-list? [on hold]

I am using the User Switch module for switching between users, but I have a big list of users listed on /admin/people/switch-user-list. I need a way to filter the user list by name or email. I didn't ...
1
vote
1answer
23 views

How to modify the D7 user login page html to remove the register and new password options for non-admins?

So, I'm maintaining a Drupal 7 site for which we recently switched the users over to SSO through a third-party OAuth provider. The implementation isn't fancy, but added a login link to what I assume ...
0
votes
1answer
22 views

Forward authenticated user to user.page on /login uri

If an authenticated user navigates to /login on a Drupal 8 site, she gets the "access denied" error. I want the site to redirect that user to /user (route user.page) instead. Unfortunately my ...
0
votes
0answers
42 views

The User Switch module doesn't list all the users [on hold]

I have installed the User Switch module to automatically switch between user accounts. It doesn't show all the user accounts registered on the site. I don't find any configuration too. I just ...
1
vote
0answers
28 views

Respecting permissions in getStorage('taxonomy_term')?

Edit: I just realized that Taxonomy permissions are not native to Drupal core, they are the result of a module we activated: Permissions by Term. (This will explain why they are not being respected by ...
0
votes
0answers
51 views

how to save user without hashed password?

I have to install drupal 8.7.6. I have a module for add user programmatically. Using /Drupal\user\Entity\User::create(); method. Using this module user registered successfully. So my query is how ...
0
votes
1answer
38 views

Recover a deleted user's content

A few weeks ago a site admin canceled a user account on one of my Drupal 7 sites and clicked on "Delete the account and its content." That user had created about half the content on the site in ...
1
vote
0answers
24 views

Is it possible to provide a temporary role to an anonymous session?

Use-case is to provide a set of permissions to an "anonymous" user i.e. we don't know who they are and they haven't logged in, we just have their IP range to confirm where they're coming from (yes I ...
1
vote
1answer
35 views

How to update custom paragaph which is added to User Profile?

I have a requirement to create/update a paragraph which is added as a custom field in USER profile. After surfing here, i got how to update a paragraph which is connected to node. But I am not able ...
0
votes
0answers
31 views

Getting white screen in Login /user and the page content

I was recently editing a website with Drupal 7 installed, and was integrating twitter feed. I created a block twitter_feed_block and assigned the block to the content section of the front page. It ...
0
votes
1answer
11 views

Anonymous permissions with Nodeaccess

Content type: Webform Allowed grants: View, Edit Allowed roles: Anon, authorized, admin Go to the webform node eg. node/20 Click Grants tab Tick authenticated and admin users can View, anonymous is ...
0
votes
2answers
47 views

How to detect the ip address of the device itself?

Using PHP and Drupal 8, I am trying to detect the ip address of the device itself and not the ip address of the router where the device is connected through the internet. $DeviceIP = \Drupal::request(...
0
votes
0answers
28 views

How can I update an user field via JSON:API?

How do I update user field via JSON API with D8? EndPoint:https://domainname.com/jsonapi/user/user/ Method:PATCH Request Header; Accept:application/vnd.api+json Content-Type:application/vnd.api+...
0
votes
0answers
20 views

How can I login via REST?

I am trying to login via REST API in Drupal8. Many people in the web are suggesting to post in the below format: POST: http://example.com/user/login?_format=json Content-type: application/json Data:...
0
votes
1answer
14 views

Changing the html and order of system fields(pass/email/locale/etc) of user edit form

I have changed a number of forms accessible by users to fit a certain style. To do this I used an #after_build function that adds prefixes and suffixes to fields, as well as a bit of javascript. This ...
1
vote
0answers
28 views

Delete user in transaction

I'm having trouble figuring out why the following code isn't working in Drupal 7. _queue_processor is a cron queue processor function: function _queue_processor($uid) { $transaction = ...
0
votes
0answers
15 views

Undefined property $uid when running update.php

I have had a minor issue which has been popping up whenever I run update.php such as after updating some modules, etc. Anytime I run update.php I get the following error: Notice: Undefined ...
0
votes
1answer
17 views

Prevent login except from Services

I would like to prevent my users to login except for those who login through my REST Service. Is that possible?
0
votes
1answer
32 views

How to grant create and update permissions to a custom role?

I have a new role as "Publisher". I want to grant Publisher 'create' and 'update' permission using code. My .permissions.yml file looks like this : 'delete contact entity': title: Delete entity ...
-2
votes
1answer
27 views

Send welcome email on one time login via admin UI

I am Importing all my users into drupal but I don't want to send the welcome emails now. When the site goes Live I want to be able to push a button or perform an action which sends all the users the ...
0
votes
1answer
48 views

How to modify default login page using theme?

Version: Drupal 8.7.x Currently, I am using a subtheme of the Bootstrap theme and I want to override the default login page because the interface doesn't look good. I was hoping to override the ...
1
vote
1answer
38 views

Unable to run update.php or update modules from web interface

I would really like to be able to install module updates through the web interface or run update.php when needed without changing settings.php, but something seems to be broken in my setup because it ...
0
votes
0answers
38 views

Checkout rule 'Create a new account for an anonymous order' not accepting mobile number field

I am using Mobile Number module to enable OTP verification. Also, with Drupal commerce, I have also enabled anonymous checkout. During the execution of the rule Create a new account for an anonymous ...
0
votes
0answers
28 views

Can't go anywhere from user edit page after login

Having an issue with a certain user that is not reflected on other users, when this particular user is logging in he isn't redirected to homepage or to admin/dashboard but to user/edit page, ...
0
votes
1answer
40 views

Overriding the User entity list_builder handler

I'm trying to override the User entity list_builder handler to add another column to the table and implement some JavaScript search functionality. The code I'm using is below which is in my modules ...
-1
votes
1answer
22 views

User password reset link leads to access denied page

Command: drush uli Output: http://default/user/reset/uid/..../...hash.../login The output URL normally logs you in automatically, but it gets takes to access denied error instead.
1
vote
1answer
254 views

How can I force the user to register/login first before being redirected back to the current URL?

I'm displaying a form using the Form API under a given URL. User gets this URL and accesses it. But before the user fills out the form, they need to be registered or logged in. How can I send the ...
1
vote
0answers
30 views

Checking if user logged-in by external script, fails

With a script on an external webpage (same domain), I need to detect whether the user that's visiting the page is or not logged in. [EDIT] This occurs when the script is into a subfolder. If it's put ...
0
votes
1answer
38 views

How to add Checkbox Fields to User Accounts? [closed]

Is it possible to add multi-choice checkbox fields to a Content Type or the fields of a User Type? Hoping it is possible to create the following when a User is registering for an account. They should ...
0
votes
1answer
44 views

How is the user logout process supposed to work?

I’ve built a complete private site. Everything seems to work. When users wants to log out, they are redirect from /user/logout /user/login?destination=/, which seems the normal behavior, for what I ...
0
votes
1answer
13 views

hook_custom_theme() works except if a user submits a user form with mismatched passwords. Then they get served the admin theme

Title basically. My hook_custom_theme() has been working for ages and I only just realised the admin theme is being served for an error when saving a user form ie. mismatched passwords. A snippet ...
0
votes
0answers
30 views

Is it possible to execute a function on a user object in Twig?

You can use hook_entity_load to add fields to the user object like so: function mymodule_entity_load($entities, $type) { if ($type == 'user' ) { foreach($entities as $e) { $e-...
1
vote
0answers
18 views

Incorrect User data being loaded after save

I am running into some data inconsistencies when attempting to load user data after saving the data. Basically, I have a callback that will update a field on the current user object. In a simplified ...
0
votes
1answer
48 views

Using REST to create user with CAS username

I would like my CAS server to POST an account to my client site when a new user registers. My CAS server is using D7, clients are using D8. Using the entity/user endpoint I can create a new user, ...
1
vote
1answer
24 views

Cannot assign roles creating User through REST endpoint

Sidenote, already seen this page, doesn't seem to help: How to create user with role(s) through REST service? I've setup a new endpoint on my platform to try to allow a 3rd party to create users on ...
1
vote
0answers
67 views

Set Default Value of User Entity Reference to logged in user

I have a Drupal 8 installation that has a user reference field and I would like the currently logged in user to be the default value for the field. I believe in Drupal 7 I would've used the [current-...
1
vote
1answer
100 views

Modified user record during presave hook not saving properly

A project I am working on has a bug where an array field on the user object is getting duplicated values. To fix this bug, I am implementing the hook_user_presave hook in one of our custom modules to ...
-1
votes
1answer
17 views

Watchdog in `hook_user_presave` implementation causing unknown error [closed]

In my own module, my_user.module, I am trying to implement the hook_user_presave invoked from user.module. Following the examples, I created a function in my module like so: /** * Implements ...
0
votes
0answers
36 views

How do I redirect a user basing on its roles?

I'm having an issue with writing a redirect based on whether or not the current user's role matches the one listed or not I've been trying to find solutions related to getting the current path for ...
0
votes
0answers
17 views

How to reference current user when creating taxonomy term

Using drupal 8.7.x I'm trying to create a vocabulary that references the user that creates the term The settings of the user reference field are the following. The taxonomy term is created using a ...
0
votes
0answers
14 views

When using /user/login as the default 403 access denied page, how can I add the tabs block to the login form?

After removing the anonymous permission to view published content, and setting the 403 access denied page to /user/login, the tabs block is no longer shown with the user login form. The tabs block ...
1
vote
1answer
103 views

How do I import entity related fields using drush migration?

I am trying to do data migration from a Drupal 7 site to a Drupal 8 site using drush migration. Example: I am trying to import users which has 5-7 fields and I tried to import fields using: ...
0
votes
1answer
69 views

Why do I get “Type does not correspond to an entity on this site” when POSTing to REST api behind an Apache Reverse proxy?

I have the REST api configured to allow POSTing new users to /entity/user. On my local machine, it works just fine. Once I push up to my remote host, it stops working. The key difference is that on ...
-1
votes
2answers
82 views

How to Restrict some special character in password field

I'm very new in Drupal, I would like to restrict some special characters from user password field Is there any way to edit configuration of core modules i'm trying to create preg_match modules . i ...
0
votes
0answers
39 views

D7: user_check_password() returns false but password didn't change

We've been having quite an unusual issue with Drupal: at seemingly random times it decides the password hashes for all users are invalid, and they have to do a password reset to be able to log back in ...
0
votes
1answer
36 views

How to check if a password reset token is still valid?

Is there a way to hook into the user_pass_reset form to detect if the provided hash is valid? Currently it seems to just throw a 403 error when submitting the form if the hash has already been used to ...
0
votes
0answers
43 views

User not logged in

I have a Drupal 8 installation and it is not logging in the users. Tried Google search and applied all solutions like setting cookie_domain, trusted_host_patterns and clearing cache. Note that, if ...
0
votes
1answer
30 views

Get Username from UID with Preprocess for Template

I'm a bit lost at finding the username based on the uid. I get the uid from the address using: $current_path = \Drupal::service('path.current')->getPath(); $urluid = (explode("/",$...
0
votes
1answer
25 views

Programatically copy an image from user entity to webform submission entity [closed]

Using a custom webform handler, I am trying to copy an image from the image field (field_usr_avatar_img) located at the user account page to the image element (avatar_img) located at the webform ...
1
vote
1answer
23 views

Are changes to the user status stored somewhere?

I've made a pretty serious error of judgement creating a view for a client that shows users created before a date AND still active. The error was adding a date filter. This was meant to be used at ...