2

I have created a view for user profile page. I also want to show the user's current email address and last login time. It is working fine for admin but email and last login time is not visible to authenticated user on front end. I have granted the View User Information permission to authenticated users but no success after that too. Is it a permission issue or something else ? What I am missing ?

| improve this question | | | | |
  • I have the same behavior, very strange, maybe a bug? – Adrian Cid Almaguer Feb 14 '18 at 16:01
1

EDIT:

I set up a test View myself and confirmed the issue you reported. Upon some search, I see this is intended behaviour.

There is a thread discussing it here: https://www.drupal.org/project/drupal/issues/2799049

The thread has a very simply Core patch to resolve the issue that could be applied. Or, there's also information on using hook_entity_field_access() to grant field-level access to User fields.

https://www.drupal.org/project/drupal/issues/2773645

************************ORIGINAL INFO***************************

From what you've said, it seems like it should work as you'd expect.

One thing you can try is checking the "Disable SQL rewriting" checkbox in your View. This will bypass ALL permission checking for the View. It is located in the Query Options setting in the Advanced section of your View config.

If checking this works then you'll know that,at least, the issue is permissions related.

| improve this answer | | | | |
  • Your solution don't solve the problem. – Adrian Cid Almaguer Feb 14 '18 at 16:00
  • See new comment edit above. – quantumized Feb 14 '18 at 16:22
  • I don't think that the patch will solve the problem, I made the view and I can't see my own information, and to see my own information I don't need this permission because I can see my email from my user page. – Adrian Cid Almaguer Feb 14 '18 at 17:03
  • The core patch is just to make it simpler to then alter the default access rules and make that information visible. You still need some custom code in hook_entity_field_access() or use a contrib module that allows that. I believe there is one mentioned in the issue. Have a look at what the test module in that issue is doing. – Berdir Feb 15 '18 at 7:20
0

You have to give "Administer users" permission to view the email and last login details of any user.

Note: This permission needs to be given for trusted user.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.