0

Could you please help me with one little question. I'm using Drupal module Support Ticketing System.

When the support ticket is created user can choose from dropdown form for whom this ticket is assigned. Usually it's a list of Drupal site users.

How can I hide a specific user from this list (admin for example)?

1

One possible solution is to add a new field show/hide Checkbox in account settings and then in drop down show only those whose show/hide field set to show.

This way if your client wants to hide another user go and edit the user and hide it

  • Interesting idea! Could you please give me a hint how to write an "if" structure with such checkboxes? Something like – jksport Oct 24 '14 at 16:53
  • Something like if ('checkbox exists') {unset($form['support']['client_dependencies']['assigned']['#options']['user id']);} – jksport Oct 24 '14 at 16:55
  • load user with $account = user_load($user_id) in and dpm($user) You will see field for checkbox just test date. Make sure you do this logic when you are building array for dropdown – Shabir A. Oct 24 '14 at 17:17
0

In your form_alter() function, run an array_filter() on the options array for the dropdown.

  • Or just unset it, something like: unset($form[something_here]['#options][user id]); – 2pha Oct 24 '14 at 13:07
  • Assuming it's only one, yes. But the post was talking about "list of Drupal site users". – Klaus Sonnenleiter Oct 24 '14 at 13:18
  • I took it that 'How can I hide a specific user' meant one. – 2pha Oct 24 '14 at 14:10
  • Thanks a lot for your answers! At the moment just one. But customer may want hide two or three or even more in future. It would be great to have a universal solution. – jksport Oct 24 '14 at 14:19

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.