Questions tagged [users]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
15 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
35 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
17 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
0answers
16 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
20 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
250 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
37 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
42 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
12 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
29 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
17 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
0answers
34 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
23 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
27 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
97 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
14 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
35 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
15 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
13 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
99 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
33 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
51 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
34 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
25 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
35 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
27 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
23 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
22 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 ...
0
votes
1answer
35 views

Provide autocomplete field with user's Display Name

Drupal core already supports autocompletion of username fields. However is there a way to provide autocomplete for user's Display Name? Since this is a virtual field, a database query with % like ...
-1
votes
1answer
113 views

Export/import users

I am looking for a way to export users from one Drupal 8 Site into another Drupal 8 site. Is it possible to do this by exporting and importing the Users tables? If so which ones? I see there are ...
0
votes
1answer
16 views

How to use view's relationships to pull user entity reference data?

I created 2 new user fields for the user (object/entity) on my D7 site. Using views, I can select 'content' or 'user' for querying data. When I use views to query the 'user', the 2 new fields come up ...
0
votes
0answers
19 views

Filter content moderation view according to user roles that I currently login to the site

The view I try to filter is only accessible to authenticated users and they have defined roles, that is, it is an administration view. I have several types of content and I want to show in the ...
0
votes
1answer
286 views

Programmatically get the results of a view

Using the group module in D8, I have the below view with machine name: group_members_per_group Machine Name of: (Member account) User: Full Name is: field_user_full_name (Member account) User: ...
-2
votes
2answers
77 views

How do I redirect a user to the front page after logging in? [closed]

Is there a way to redirect users to the front page after they log in, without using any additional modules other than the core modules. Right now they are redirected to their profiles.
0
votes
0answers
12 views

Drupal Open Social - How add new user fields to user information page?

I've a local installation of Drupal 8's distribution Open Social (DevDesktop). I added some new fields (f.e. birthday, skypename,...more fields to add) to the user's profile. Each user is able to ...
0
votes
1answer
36 views

Reference current user when creating a content type

I am creating a new content type and one of the fields I d like to add owner. I ve chosen reference - user as the field type Type of item to reference = user How do I make the default value the ...
0
votes
1answer
33 views

How do I know what setSetting is suppose to be?

I am creating a custom content entity and in the BaseFieldDefinitions, I am trying to create a field for assigning a user as the designated assigner and will follow up with a assignee. So far, the ...
0
votes
0answers
26 views

How to handle submit of a form that extends RegisterForm?

I have a form that extends the native RegisterForm When this form is submitted, I would like to register a user, but then I would also like to store the uuid & certain fields like name & ...
0
votes
2answers
166 views

Password reset link gives access denied

Password reset link is not working in drupal 8.6. The email with the one-time login link is sent just fine, but when the user clicks on the Login button, they get "You are not authorized to access ...
2
votes
0answers
20 views

How to tease access control content to non-authenticated users [closed]

I have member only content and using Roles and Access Control to serve it up. The goal is to display member only content in a view block to non-authenticated users so they would click on it but be ...
1
vote
1answer
36 views

Print Preprocessed username Field Value in User Template

$account->getDisplayName() Bypasses "username" Field Preprocessing in User Template? I am trying to print the value of the username field of the user account in a user--custom.html.twig file. ...
0
votes
1answer
102 views

Changing a Profile type Machine Name broke the Admin/People search

I'm working on a Drupal 7 website in which there are several Profile types. As part of a task, I had to change the "Label Name" and the "Machine Name" of one of them: specifically Professional ...
1
vote
0answers
64 views

How do I override the registration form?

I am trying to override the user registration form in Drupal 8, using the following code. RouteSubscriber.php namespace Drupal\registration_subscription\Routing; use Drupal\Core\Routing\...
0
votes
0answers
32 views

Show User Comments and/or Voting API on User/Profile Page

I have searched the internet for 24 hours now I can't seem to figure where I am going wrong here. I am attempting to add comments to the user profile page. The field to choose your selection to ...
2
votes
1answer
73 views

How to create a permission with logic

I need to create a permission to allow users to see the content overview page (/admin/content) only during business hours (9 AM to 5 PM). Drupal core comes with the "Access the Content overview page" ...
1
vote
1answer
72 views

Get the custom fields created for User entity in Drupal8

I was trying to get the custom fields created for User entity in Drupal8: Drupal::service('entity_field.manager')->getFieldStorageDefinitions('user') is returning all the fields Drupal::service('...
0
votes
1answer
105 views

Associate Every Displayed User Name With Corresponding users.data Table Row

Updated: I would like data from the users.data table displayed with every "User Name" however it is displayed. As an example, I have this in hook_preprocess_page_title(): function ...
0
votes
0answers
21 views

Drupal logout link does not hide the admin toolbar

I am experiencing some odd behavior around the logout process in Drupal 8. When I am logged in as admin and then logout, using either the Drupal "Log out" link or by appending "/user/logout" to the ...
0
votes
1answer
57 views

Let 'web-view' mobile iOS/Android app talk consume/feed site [closed]

I have a Drupal 8 site with the following modules: HAL. HTTP Basic Authentication. REST UI. RESTful Web Services. Serialization. Using the REST UI module, I configured it as follows. Settings for ...