How to alter tabs that have wildcard in bartik main menu
Solve this by page preprocess function. Not sure is this correct way or not.

function mobitek_custom_preprocess_page(&amp;$vars) {
  $nid = arg(1);
  $node = ($nid &amp;&amp; arg(0) == 'community' &amp;&amp; is_numeric($nid)) ? node_load($nid) : FALSE;
  if (!$node) {
    return;
  }
  $main_menu = &amp;$vars['main_menu'];
  $mobitek_menu_items = array(
    'communities',
    'reports',
    'administrators',
    'users',
  );
  // Remove links by this.
  foreach ($main_menu as $key =&gt; $menu_array) {
    if (isset($menu_array['identifier']) &amp;&amp; in_array($menu_array['href'], $mobitek_menu_items)) {
      unset($main_menu[$key]);
    }
  }

  ....

  foreach ($community_links as $title =&gt; $community_link) {
    $new_tab = array(
      'title' =&gt; $title,
      'href' =&gt; $community_link,
    );
    array_unshift($main_menu, $new_tab);
  }

  // Add link by this. 
  if (arg(0) == 'community' &amp;&amp; arg(2) == 'profiles-roles') {
    $on_roles_page = (arg(3) == 'user-roles');
    $profiles_item = menu_get_item('community/' . $nid . '/profiles-roles/user-profiles');
    $vars['tabs']['#primary'][] = array(
      '#theme' =&gt; 'menu_local_task',
      '#link' =&gt; $profiles_item,
      '#active' =&gt; !$on_roles_page,
    );
    $roles_item = menu_get_item('community/' . $nid . '/profiles-roles/user-roles');
    $vars['tabs']['#primary'][] = array(
      '#theme' =&gt; 'menu_local_task',
      '#link' =&gt; $roles_item,
      '#active' =&gt; $on_roles_page,
    );
  }
}