It would be nice to be able to enter the uid instead of username when masquerading as another user.

Many times I'm looking at table data (via phpMyAdmin) that contains uid, but not username. So to masquerade as that user, I first have to find it in the users table.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Title: Add option to enter user id » Make username input field also accept user ID (instead of name)
Version: 6.x-1.x-dev » 8.x-2.x-dev

I think this is a good idea.

deekayen’s picture

Title: Make username input field also accept user ID (instead of name) » Make username input field also accept user ID (in addition to name)

My concern is supporting with themed usernames like with http://drupal.org/project/realname, so just clarifying this wouldn't switch to uid-only.

sun’s picture

Oh yeah, sorry for the confusion. I definitely meant "in addition to". :)

The concrete use-case I'm commonly facing is that I only have a user's ID through the means of a support ticket from a completely separate helpdesk system. In such cases, it would be great if I could just simply paste the uid into the form field and hit ENTER.

andypost’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

Module already using core's entity_autocomplete element that support name and ID

andypost’s picture

Status: Closed (cannot reproduce) » Active

Actually not

rdatar’s picture

Assigned: Unassigned » rdatar
rdatar’s picture

Hi,
I have modified code to allow user id as input in addition to username.
Adding patch user_id_input-92950-#7.patch
Please review.

andypost’s picture

Issue tags: +SprintWeekend2016
+++ b/src/Form/MasqueradeForm.php
@@ -66,22 +66,17 @@ class MasqueradeForm extends FormBase {
-    $form['autocomplete'] = array(
...
-    $form['autocomplete']['masquerade_as'] = array(
-      '#type' => 'entity_autocomplete',

removal of wrapper will break form
also removal of autocomplete is no-go, so should be added own controller

andypost’s picture

andypost’s picture

Assigned: rdatar » Unassigned
Status: Needs review » Needs work
Issue tags: +Needs reroll
RumyanaRuseva’s picture

sreenivasparuchuri’s picture

Hi I created new module where I had extended the masquarde, so that now we can able to search with role,email,user id,username

Masquerade Extra

sreenivasparuchuri’s picture

I created new module where I had extended the masquerade, so that now we can able to search with role,email,user id,username

Masquerade Extra

andypost’s picture

@sreenivasparuchuri Thanks! I could be great foundation for #1926876: Fix and rework the masquerade_advanced sub-module

Otoh I prefer to keep module slim so better to keep all UI additions separate

andypost’s picture

I bet current core allows to use view result as autocomplete so you just need to alter existing form

Technically is not API break but I'm sure that lots of custom modules and themes alters current keys in the form