Hide tab for user page for specific roles I am trying to hide tab for user page. This is good script but work only for node type. How can I make it work for user pages?
Thanks to all!

function bartik_preprocess_page(&amp;$variables, $hook) {
    if (!empty($variables['node']) &amp;&amp; $variables['node']-&gt;type == 'article' &amp;&amp; in_array('editor', $variables['user']-&gt;  roles)) {
        $to_be_removed = array('node/%/edit', 'node/%/view');
        foreach ($variables['tabs'] as $group_key =&gt;$tab_group) {
            if (is_array($tab_group)) {
                foreach ($tab_group as $key =&gt;$tab) {
                    if (isset($tab['#link']['path']) &amp;&amp; in_array($tab['#link']['path'], $to_be_removed)) {
                        unset($variables['tabs'][$group_key][$key]);
                    }
                }
            }
        }
    }
}


/--------
Update
--------/

Now I tryed this:

function my_theme_preprocess_page(&amp;$variables, $hook) {
    /* Hide Tabs in users page */
    global $user;
    $arg = arg();
    if (($arg == 'user') &amp;&amp; in_array('gestore', $variables['user']-&gt;roles)) {
        foreach ($variables['tabs'] as $group_key =&gt;$tab_group) {
            if (is_array($tab_group)) {
                foreach ($tab_group as $key =&gt;$tab) {
                    if (isset($tab['#link']['path'])) {
                        unset($variables['tabs'][$group_key][$key]);
                    }
                }
            }
        }
    }
}


But not work.

/----- Last Update -------/

This works. Thx @Yogesh.

global $user;
if ((arg(0) == 'user') &amp;&amp; in_array('editor', $variables['user']-&gt;roles)) {
    foreach ($variables['tabs'] as $group_key =&gt;$tab_group) {
        if (is_array($tab_group)) {
            foreach ($tab_group as $key =&gt;$tab) {
                if (isset($tab['#link']['path'])) {
                    unset($variables['tabs'][$group_key][$key]);
                }
            }
        }
    }
}
You can use arg() function. The function returns a component of the current Drupal path. i.e. if you're on edit user page, the values returned by arg() function will be arg(0) as 'user', arg(1) as user ID, arg(2) as 'edit'.

function bartik_preprocess_page(&amp;$variables, $hook) {
  $arg = arg();
  if (('user' == $arg) &amp;&amp; (!empty($arg[1]) &amp;&amp; is_numeric($arg[1])) &amp;&amp; in_array('editor', $variables['user']-&gt;roles)) {
    // Your code goes here..
  }
}