Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [users]

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

0
votes
0answers
19 views

Upload a folder full of files (static html and assets) to the private files folder when creating a node

I need to be able to upload a folder full of files (static html and assets) when creating a new node and then to output a link to the index.html file in the uploaded folder. They files from a ...
1
vote
1answer
18 views

header and menu is missing from Login module page--user--login.tpl.php [on hold]

I am implementing Custom Login module but Header is missing... My Directory is : modules | --- module_name | --- css | --- module_name.info | ...
1
vote
0answers
33 views

How to handle validation (email along with custom user field) user registration via REST API?

I am using Drupal 8 default REST API end points for user registration and login services as per link below provided https://www.drupal.org/docs/8/core/modules/rest/javascript-and-drupal-8-restful-web-...
0
votes
2answers
78 views
+100

Adding field collections programmatically

I'm trying to add a field collection to my user account on an event, and it seems to be being created properly, the fields are updated as expected and it parents it to the user account, however, even ...
1
vote
3answers
149 views

Show if a user is online, idle, or offline on their account page?

I want to display the status of the user on the account page. I added the code below in the .theme file of my theme. It works, but users are never displayed offline. Why ? Is there a mistake ? ...
0
votes
0answers
12 views

Reusing logged in user fields in customer profile?

Is it possible to reuse registered users details in the Customer Profile? e.g. [current-user:display-name] in the default value. I tried this but can't get it to show in the commerce checkout - uses ...
0
votes
0answers
12 views

Login / Registration for Novice [closed]

I am NOT a professional programmer. I've got a website that is already developed using html and css and I want to add login / registration to my site. I'm looking for a really easy way to do this ...
0
votes
1answer
45 views

Sending an email to everyone with a certain role

Me: Small business owner with no coding or Drupal background who wants to learn by doing instead of hiring a developer for every small thing. Goal: I have a Drupal 7 website and would like to send ...
0
votes
0answers
17 views

How can I allow multiple accounts use the same email address? [duplicate]

I am running multiple domains off of one install with Domain module. I need to allow users the ability to have separate accounts on each. I'm pretty sure I can alter the log in fine, but don't know ...
1
vote
1answer
19 views

How to create a view to count comments per user?

I am trying to create a view with a table that shows all the users and the total number of comments that user posted in descending order. I am not sure what I am doing wrong but I spent hours on this ...
0
votes
1answer
18 views

Modify/Alter Password Policy Constraints Text

I'm looking for the easiest possible way to modify or alter the password policy constraints error text. The following is the default the users see. The password does not include enough variation to ...
0
votes
0answers
14 views

Log in error problem going to a /user/10 which is giving me problems

When I'm trying to log into my site, support.pegwriting, I'm redirected to http://support.pegwriting.com/user/10 and I get this error message: The website encountered an unexpected error. Please ...
2
votes
2answers
34 views

How do I display an error message on a basic page when the user does not have permissions to see the nested view inside the basic page?

I have a basic page, and inside of that basic page I have a view "newsletters". The view "newsletters" has permissions set on it based on role, so only admin and subscribers can see it. How can I ...
0
votes
1answer
18 views

Access_Callback problem

From time to time (and anytime after I run "drush cc all") my custom module with an access callback returns an 'access denied' error for Admins when they attempt to edit a user. I can solve this issue ...
0
votes
1answer
15 views

Programmatically / by Rules, remove reference of a deleted user from contents created by that user.

A user [content_editor] got deleted and the content created by this user is referring to anonymous user. While an administrator is editing that content, administrator is receiving user doesn't exist. ...
1
vote
2answers
33 views

User added with Drush not working

So, I have to work on a D8 site I don't have a user account for. So, when I brought the code and database over to my local environment, I thought this would be an easy fix for drush. My local dev ...
2
votes
0answers
25 views

Working with hook_node_access_grants

I am currently working with Permission by Term to set simple access control on two node types with terms. As noted here, I believe I found a bug where the access record isn't written the first time ...
2
votes
2answers
94 views

How to programmatically add custom markup to every displayed user name

Drupal 8.x I am currently using hook_preprocess_user(). I would like to alter the username to add some custom markup to every username. MYMODULE.module: function MYMODULE_preprocess_user(&$...
1
vote
1answer
114 views

How to display the status of the user?

I created a TWIG template for the "Teaser" view of the user account. I want to display a logo and change its color according to the status of the user : When the user is logged in <i class="user-...
0
votes
0answers
6 views

Is it possible to use drush migrate-import to import custom fields?

I am trying to migrate a Drupal 7 site to Drupal 8 on a new server I have copied the db so it can be used locally. I have run the drush migrate command and migrate-status shows a bunch of things that ...
0
votes
0answers
26 views

Users created from back-end doesn't trigger Welcome email

For some reason any user that is created by an authenticated user on my site, doesn't receive a welcome email...even when the Notify user of new account checkbox is checked. After the user is ...
0
votes
0answers
24 views

Rule to update or set value of a user custom field when creating a new node of a specific type

title just saying everything :) I need to a Rule that sets a value of users custom field (ex. field_custom) WHEN a new node of type (ex. page) is created/saved. For me it looks like I can only access ...
2
votes
2answers
46 views

Programatically assigning multiple user role ?

I am trying to assign multiple role while creating a user programatically. I am successfully creating a user and assigning one role using below code $user = \Drupal\user\Entity\User::create(); // ...
0
votes
1answer
9 views

After calling drupal_flush_all_caches, menu items with access callback TRUE are giving access denied error

I was building a custom module that affected the front page and I found myself having to go clear the caches for it to take effect. So as part of the code, I put in drupal_flush_all_caches(). After I ...
0
votes
1answer
23 views

How to make role field on approval in the Edit Profile page by Admin

This website has over 1000 users with different profiles. Each user choose their profile on registration. On their Edit Profile page, the authenticated users can change or add more profiles to ...
0
votes
0answers
23 views

How to specify a condition if the store is not store_pro?

I created a custom module. If the owner of the current store does not have the marchand_premium role, the add to cart button is overwritten. I want to add another condition : If the store is not ...
0
votes
0answers
17 views

Is exposing the UID a security issue?

I noticed that the UID of users is exposed in the HTML code of a page on my site that authenticated users can access. Is it a problem if authenticated users with "view user profiles" permissions are ...
1
vote
1answer
16 views

How do I create a block only for the user “owning” the profile page?

I made so the logged in user have a recap of their last comments/added node on their profile with a view. As I am making the profile page public, I need to be able to hide those blocks from others ...
0
votes
1answer
22 views

How to display the user's url in a template?

I created a template user-comment.html.twig to customize the rendering of the comments author. I can not display the user account url: user.url does not work. How to display the user's url in a ...
0
votes
1answer
17 views

Creat a test user with no access permisions

On a site where only authenticated users have the permision to access content, I want to set up one test user that can log in but not access any content. How would I achieve this? This user will ...
0
votes
0answers
13 views

ExternalAuth Table is Empty for SimpleSAMLphp_auth module

I'm using the simplesamlphp_auth module to integrate a SAML based IDP from my company. When a user logs in, their identifier (in this case their email) is checked against the authmap table. This ...
0
votes
0answers
46 views

global $user->uid for user with id 1 returning other user

I have a function that I'm calling to get data to display in a form with the following code: function mymodule_getData($dateMonthFrom, $dateMonthTo) { global $user; print $user->uid; ...
0
votes
0answers
37 views

How to conditionally bypass login restriction to access node

I have installed "redirect 403 user login" module to restrict nodes access anonymously. Now this condition working fine but my client gave another condition. He wants to display these node url's with ...
0
votes
1answer
130 views

When visiting /user/ID how to allow users to only visit their own user page

I created a Twig template for the user account /user/ID page on Drupal 8. How to display this template only if it is the account page of the current user? For example if I go to the page of my ...
0
votes
0answers
29 views

Login/Logout link doesn't show up in main navigation

I have moved the login/logout and the my account link from the user navigation to the main navigation as of this post: How to add a Login / Logout link in Main navigation menu? Now the my account ...
4
votes
0answers
63 views

How is password hashing/encryption performed?

I am fielding a question for a project that is asking if we use Blowfish crypt in Drupal, or, if we could. The class that performs password hashing in 8 is PhpassHashedPassword, based on https://www....
0
votes
0answers
25 views

How do I link accounts from a remote IdP to my local Drupal Accounts?

I'm using using the simplesamlphp_auth module and I've configured a remote IdP in my simplesamlphp config files. At this point, when I'm on the login screen, I see a link to login with my IdP, and the ...
0
votes
1answer
32 views

Drush upwd Changes Database Hash but Login Fails

I have a weird one. I have a site that was abandoned for a while and we need to get access to it again. So I tried to use drush to reset the admin password, but it's not working. I'm using Drush 8.1....
0
votes
0answers
20 views

Entity Form Builder bypasses Access Handler on submit?

I have a ECK Entity, it is allowed to be edited only by admins. Under a custom route /test I load the form with \Drupal::service('entity.form_builder')->getForm($entity, 'default'); Now as an ...
1
vote
1answer
31 views

How to programmatically set the user timezone

I am programmatically creating a user and wanted to assign a timezone for the user I am able to successfully create a user by the following code $user = \Drupal\user\Entity\User::create(); $user-&...
0
votes
0answers
24 views

Checkbox field to change the privacy of a User Profile

Currently, all the user profiles in the website are private, which means the pages are accessible only to authenticated users. I would like to put an additional field to the Edit Profile page (like a ...
0
votes
1answer
51 views

Disable user login, register and password reset

I am working on a Drupal 8 site that for all intents and purposes will be used as a company intranet. I'm also using the Social Auth Google module to allow only company-registered GSuite accounts to ...
0
votes
0answers
16 views

How do I enable translation tab for unpublished contents for users except administrators

In the node edit form the translation tab is hidden in unpublished contents for users except administrators and the author of the node? How do I give permission to translate those nodes for other ...
-2
votes
1answer
52 views

Redirect users to home page if already logged in

I am using a third party authentication mechanism to authenticate users. On successful authentication, I am able to redirect the users to the front page using the RedirectResponse class. If logged-in ...
-1
votes
1answer
24 views

How to render a custom user field in comments?

I want to render a custom user field from the commentator's profile in comment.twig programatically. How to realize that?
1
vote
0answers
28 views

check whether a user downloaded a file from private system file? [closed]

What I wanted to do is to show a tick icon (just next to download link), after a member downloaded a private file, which implemented by Protected File Module (files are saved on private file system). ...
0
votes
1answer
33 views

How can I (programmatically) display a custom block with user profile links in dropdown?

I would like to display a custom block with some links for authenticated users like drupal.org does. I would like to display username next to user's picture, and custom menu items. For example, "My ...
0
votes
1answer
23 views

Entity Reference - User reference field Hide “Restricted access” label instead of showing useless choices

i have an entity reference (7.x-1.5) select-list within a checkout pane which is being used to allow the user to attach a child to a product during a checkout process. The user can add multiple "...
1
vote
1answer
36 views

How to compare text input with a user password stored in the database?

I've been trying to compare password values using a custom form. Actually I want to show a relogin form after a particular amount of time. So I have created a custom form with two fields – email and ...
2
votes
1answer
34 views

Different registration procedures (with or without approval) for different roles?

I am currently setting up a simple LMS in D8 and would like to create different registration procedures for different kinds of users. In particular: There should be a registration page for simple ...