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)?

2 Answers 2

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

3
  • Interesting idea! Could you please give me a hint how to write an "if" structure with such checkboxes? Something like
    – jksport
    Commented Oct 24, 2014 at 16:53
  • Something like if ('checkbox exists') {unset($form['support']['client_dependencies']['assigned']['#options']['user id']);}
    – jksport
    Commented Oct 24, 2014 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.
    Commented Oct 24, 2014 at 17:17
0

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

4
  • Or just unset it, something like: unset($form[something_here]['#options][user id]);
    – 2pha
    Commented Oct 24, 2014 at 13:07
  • Assuming it's only one, yes. But the post was talking about "list of Drupal site users". Commented Oct 24, 2014 at 13:18
  • I took it that 'How can I hide a specific user' meant one.
    – 2pha
    Commented Oct 24, 2014 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
    Commented Oct 24, 2014 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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