views exposed filter select list users with specific role I created a content type coty1.

I have 2 user roles that can create that content type. role1 and role2.

1.How can I create view that one of the filter field is expose that allow me to choose just users that have role1 or role2 (not all the users of the site).

2.How can I create view that one of the filter field is expose that I can choose just users that realy created one or more from coty1 content type?

Thanks a lot.
You need some custom code in order to do something like this.

You can put #access on any form element, and along with hook_form_alter you are able to alter the views exposed form and require a permission that the two roles have, making it so that only users with those roles can see and use the exposed filter.

The same technique can be used for the 2nd field you want alter.

In code this could look something like this:

module_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'foo') {
    $form['exposed_filter_1']['#access'] = user_permission('special permission role 1 and 2 have');
  }
}


This is example code. You need to find out the form id, and maybe do other checks. Also You need to do a SQL query to figure out if the user has created a node of that type.