Questions tagged [users]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
35 views

How to render a webform inside Entity form

My drupal system has the user entity with a field webform submission. The system has more than one webform also. What I need is, Whenever a new user came to register, the registration form needs to be ...
-2
votes
0answers
23 views

Using saved data when creating content [closed]

I have a website which ordering and delivering things, to make an order user creates content. At that time he or she should fill the address and name of person who takes the parcel. Nowadays He or ...
1
vote
1answer
35 views

How do I programmatically create a node with an entity reference (to an user)?

It is kind of strange because my code creates the node with the referenced user uid in node_field_data, but when I open this node the user reference isn't working. Then I navigated the database and ...
1
vote
1answer
47 views

How can I print user field values in page.html.twig?

I've created a couple of fields for the user in Drupal 8, example: first name. And i'm trying to print it in the home page (page.html.twig) but to no avail. I tried the following: {{ user....
1
vote
1answer
37 views

How do I change the salt used for the user password when creating an account?

I am working on Drupal 8 site where the client has asked us to use their own custom salt when storing the user password in the database. Is it possible to set a custom salt for a Drupal site? The ...
0
votes
0answers
8 views

Entity reference add users autocomplete, autofill email in multiple fields

I have a D7 content node content type which has an entity reference users field with an autocomplete widget, addressfield. When I select an user the user entity and addressfield is automatically is ...
-2
votes
0answers
18 views

How to create form for single field from user content type?

Drupal has a user content type to save registered user's datas. I created a file field on the user content type to get some file from the logged in users. I want to display the file field separately ...
1
vote
1answer
17 views

How to get one time URL when we are writing hook_mail_alter?

My Question is already present here but the previously given answer for my question can applied to Drupal 7 and I can not use the same solution in Drupal 8. I hope it is okay not put the same ...
0
votes
0answers
8 views

How to make global permissions available in OG Role permissions?

In OG Role permissions only some are listed, not all that are available under drupal site wide roles. I want to make a global permission available under OG Role permissions, as I need to make the "...
-1
votes
1answer
43 views

Redirecting Anonymous Users to external URL on Drupal 8 site

Still pretty new to Drupal, but I am attempting to create a custom module that redirects anonymous/unauthenticated users away from the site. This site is only supposed to be used by admin's so in ...
0
votes
0answers
18 views

Track/Log changes to permissions

I was trying to find contributed module for Drupal 8 to track practically everything users do on site. I was able to find some good modules like Events Log Track but it only works for entities (...
2
votes
2answers
243 views

Write complex access control in a reusable way

We deal with nodes representing humans with two important properties: mother and father. Your parents as well as your aunts and uncles should get extra permissions, like to see you in a certain view ...
-1
votes
1answer
28 views

How does drupal 8 handles redirect respose? [duplicate]

Iam using a RedirectResponse in drupal 8 in my custom module when a user is logging in, $user = User::load(\Drupal::currentUser()->id()); $userRoles = $user->getRoles(); if(in_array('admin',$...
1
vote
1answer
52 views

How do I re-save all users?

I need to re-save about 300 user to initialize geo-coding on their address fields. On /admin/people, I don't see any bulk action that would fit my needs. I have tested the update path-alias but with ...
0
votes
0answers
35 views

Hook into password change on user update

Question in short: How do I hook into password change in order to get plaintext old and plaintext new password when password change is accepted? What I have tried so far: I tried hook_form_alter with ...
0
votes
0answers
49 views

Show admin field based on field value

In the admin of a certain Content type (node/31/edit), I Added a select list field field_hero with two key|value's: carousel|Carousel video|Video when the site editor select carousel, I want to ...
0
votes
1answer
11 views

Changing field instance display settings for view_mode

Background In the user.module file in user_build_content(), there is a line that adds fields for a given view_mode: $account->content += field_attach_view('user', $account, $view_mode, $langcode);...
0
votes
1answer
41 views

Change default format for date field on user register form

I'm new to Drupal 8. In the user registration form, i've added a Date field via manage fields in user account settings. However, I need to customize this field and change its format. I tried 'manage ...
-1
votes
1answer
35 views

Accessing user email from object of type \Drupal\user\UserInterface

If a method of a class is returning an object of the interface \Drupal\user\UserInterface How do we access the user email of that user?
1
vote
1answer
47 views

How Do I Change My Drupal Admin Password From a Drupal Test Install on My Local Machine [closed]

I am a complete Drupal beginner. My Drupal site is hosted with a provider. I have these questions and would really appreciate your insight. 1) I want to be able to change the front end log in pass ...
0
votes
1answer
24 views

Print module theming address for user page

I am using the print module to have print-friendly pages. I followed theme suggestions, I could not make the theming work for user pages. So far, I tried the following I would like to theme user pages ...
1
vote
1answer
53 views

How to run alterRoutes on particular condition ? Does it run on cache clear and not on normal Request?

I am trying to implement a feature where I need to run different flow than default flow while the registering user on the site. I am trying to alter the route of "user password reset" for the for the ...
0
votes
1answer
37 views

How to add/remove a permission from a user role to a particular user without modifiying the user role?

Let's say that I have a user role called ARTICLE_VIEW_EDIT which has permissions to view and edit own articles nodes. I have the following 2 cases. I want to give extra permission, delete own ...
2
votes
1answer
40 views

How to manually check if a username and password is correct? [duplicate]

There are a lot of answers on how to log in as a specific user. But I can't find any answer on how to check if the username and password is valid without logging in. I want to be able to do something ...
0
votes
0answers
22 views

Show a block on the user registration form depending on destination parameter

How can I show a block, or a a mini panel, on the user registration form depending on the destination parameter? Right now, I'm showing, in a view, a link that leads the users to user/register?...
0
votes
0answers
34 views

Limiting the number of options to be selected based on user role

I have a tag field in article content type. It's a Drupal 8 Project. I want to limit number of tag to be chosen according to role. For example; Role A can choose max 3 tags Role B can choose max 7 ...
0
votes
1answer
114 views

How to prevent email address from displaying on edit profile page?

I have set up my site so that some users with a specific role can't edit their email address. This works fine - users with role type A can navigate to the edit tab on their profile and edit their ...
0
votes
2answers
47 views

How to hide a specific user profile?

I would like to be able to hide a specific user profile. I want to completely hide it from Drupal and search engines. How can I achieve this?
0
votes
1answer
25 views

'Edit' tab does not appear on user's account page?

On my site when a user navigates to their account page there is no 'Edit' button for them to be able to edit their details. From the documentation online it seems this should appear automatically. Is ...
1
vote
1answer
39 views

How to create a role without some permissions an “Authenticated User” has?

I have created a custom role. It automatically receives any permissions given to authenticated users. Is there a way to prevent this from happening? What I would like to achieve is: Authenticated ...
2
votes
1answer
75 views

How do I override the $message value of the UniqueFieldConstraint class?

I am new to Drupal 8 and I have added Core Constraint called "UniqueField" on my custom field "Customer_no" which is attached user to Entity. Below is that code which I am trying to override error ...
0
votes
1answer
28 views

How to allow users to cancel their own account?

I gave the permission cancel own user account to authenticated users. Now they can see a Cancel account button on their profile edit. But when they click on that button, a confirmation form opens. ...
-2
votes
1answer
43 views

How to get all values of particular custom field of user entity using EnitityQuery?

I have added one custom field to user entity called as "customer_no". On User Registration Form, I want to check whether customer_no already exists. For that, now I want to Fetch all user's values ...
2
votes
0answers
41 views

How to access PrivateTempStore data when user registers

I have a form for anonymous user some steps before the user registers. I save the data in the PrivateTempStore. A final step is to register and log in. But when a user is logged in, the ...
0
votes
1answer
50 views

Deny access for Authenticated Users

I'm using the moduke Permissions by Term and I love it. It works great and my complete system is now build around it. But I ran into a certain case and I am wondering if this is even possible. I ...
1
vote
1answer
28 views

Drupal 8 correspondence to node_access function on Drupal 7

I feel like asking a silly question, but here it is anyway: I need to test if a given user (in my case, the logged in, current user) has access to a given node for one of the existing operations (view,...
0
votes
0answers
12 views

Add property labels from address field properties in the view display

I use address field module and added this field to my customer profile (for Drupal Commerce integration). In the form you see decently the labels above the input fields (frontend). After filling in ...
0
votes
0answers
18 views

user_login_submit doesn't work when called in an inner function

We have a shared register function that multiple pieces of our app use. When registration is successful, we log the user in. But for some reason, when a user completes this project via browser in the ...
-1
votes
1answer
23 views

Remove Passwords match: text from Registration form

How do I remove/disable "Passwords match:" text in Drupal 8.
0
votes
3answers
70 views

How to redirect a user on login?

I have a registration form, when submitted, the user gets logged in automatically. I want to redirect the users to a specific page on login. Whether they are logged in using the login form or through ...
0
votes
1answer
21 views

How can I programmatically deactivate multiple user accounts?

I have tried the following code, but something doesn't work, could you please help. I need to deactivate several accounts at once, if they satisfy the conditions: $ids = \Drupal::entityQuery('user') ...
0
votes
0answers
22 views

What is the appropriate hook for hiding/editing user data?

We have a field on the user that I just need to hide one field from. This user object may be loaded from an API service endpoint or just in a regular login. Is there a hook I can use to obfuscate the ...
0
votes
1answer
46 views

How to create a user with custom fields?

On my drupal site, using the User module, I have added extra fields to the user registration form such as 'Organization'. I notice that this has created a mysql database called '...
0
votes
0answers
101 views

There was a problem creating field: SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value

I've recently downloaded a Drupal website to work on a local host (xampp). After importing the database, changing the base_url and running the update.php script, I managed to make it work. However, ...
0
votes
0answers
103 views

Form errors cannot be set after form validation has finished. When trying to edit user password in webform presave hook

I'am trying to edit a user account based on the values submitted through webform, the webform is Ajax enabled and I'am using the following code to achieve this. function ...
2
votes
1answer
99 views

How can I redirect a user after login to the current page? [duplicate]

I have a Drupal 8 site. And I have approximately 5 pages in a site. For example if a user hits login from the contact-us page the user should not redirect anywhere, they should stay on same page. How ...
0
votes
2answers
33 views

How can I have a employee ID read-only in Drupal Profile, set by Admin?

I need to have a field in user profile named Employee ID, this field should only be set by admin (Read and write), read-only to user, and hidden from all other users. Thank you.
-1
votes
1answer
24 views

How can I programmatically create a Profile 2 profile?

I am taking a look in the Profile 2 API documentation: http://api.drupalhelp.net/api/profile2/function I guess profile_create() or profile2_save() are what I need. But I have read somewhere ...
0
votes
1answer
37 views

Querying the user list from the database

There is a need from a different team in our organization to provide a periodic export of users, roles, and users-roles relationship data in a certain Aveksa-specific format. Where (which table(s)) ...
0
votes
2answers
25 views

Rules Redirect User at Login by Role to URL not working

I am trying to redirect any user with a particular Role at login to a URL. I am using Backdrop (Drupal 7). I have looked at most of the posts relating to this problem, and tried many of the examples ...

1 2 3 4 5 131