Hi all,
I want to ask if someone has tried to hide the "All" tab from the relationships page (nav menu > My relationships) .
I have only one of relationship type the "Friend" type. So the first tab (All ) gives the same result with the third tab (Friends) . The second tab (Pending Requests) works fine and i want to keep it.

I tried to find any option from User Relationships admin pages but i did'n find anything. I also tried to find any view with page path relationships and nothing....
How can I remove the first tab and leave the two others?
Thanks in advance.

CommentFileSizeAuthor
relationships.JPG11.8 KBaleada

Comments

alex.k’s picture

You need to implement a small hook_menu_alter function http://api.drupal.org/api/function/hook_menu_alter/6 in order to disable the "All" tab.

aleada’s picture

Do you mean that something like

function hook_menu_alter(&$items) {
  // Example - disable the page at node/add
  $items['relationships/list']['access callback'] = FALSE;
}

should be placed inside my template.php ?

aleada’s picture

Where is the place that i can place the hook menu alter function?
I searched all the files of the user relationships module but I did not find how to remove the first tab (All relationships) from view.

aleada’s picture

Hi again,

Can someone help me to solve my problem with the all tab on My Relationships page?
I want also to hide the elaboration message from the table list of my friends. I believe tha the elaboration message is usefull only once, before someome become friend to another. After request acceptance it is not very nice to display the initial elaboration message on My Relationships page.
Regards
Alex

aleada’s picture

Ok i found the answer .. It has to do with the template.php
http://drupal.org/node/68792

rburgundy’s picture

@amatech - can you please share the code you place into template.php
thank you

aleada’s picture

function yourtemplatename_preprocess_page(&$vars) {
  // Remove undesired local task tabs.
  // This first example removes the Users tab from the Search page.
  snd_removetab('******', $vars);    //The '********' is the caption  of the tab that you don't want to display for example 'All relationships' 
}

function yourtemplatename_removetab($label, &$vars) {
  $tabs = explode("\n", $vars['tabs']);
  $vars['tabs'] = '';
  foreach ($tabs as $tab) {
    if (strpos($tab, '>' . $label . '<') === FALSE) {
      $vars['tabs'] .= $tab . "\n";
    }
  }
}

drupal_rebuild_theme_registry();  // Optional ... I am not  sure if this line helps.... :) 

Be sure that you have replaced the yourtemplatename prefix on the two functions with your template name and that you have cleared all caches to see the changes.
The drupal_rebuild_theme_registry() I am not sure it is working and how affects the theme registry.

If you have any question feel free to contact me.

rburgundy’s picture

thank you amatech!
I will try with your instructions above.

igorik’s picture

it works for me, but it destroy rest two tabs (only links are shown instead tabs)

mrf’s picture

Status: Active » Fixed

igorik, if you are having issues with additional tabs not showing up I'd do some print_r's near:

    if (strpos($tab, '>' . $label . '<') === FALSE) {

And make sure that other tabs aren't being selected by this statement.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pitxels’s picture

I think this is something should be done in the logic side, not on the theme.

It is not about the aesthetic of the page having an extra word, Its about the usability.

If there is only one relationship available, this page should be different.

Lets say the only relationship is friends
The title should be "My Friends" instead of "My relationships"
"No Friends found" instead of "No relationships found"

Then we will have 2 Tabs: Friends and Friend Requests

Just my opinion. great module :)

pitxels’s picture

Status: Closed (fixed) » Needs review
mrf’s picture

Category: support » feature
Status: Needs review » Closed (fixed)

Hi pitxels,

Thanks for the feedback and I definitely agree this could be cleaned up.

This issue was a specific request on how to do this on your own, if you think this needs to be fixed / cleaned up I'd open up a feature request against 7.x First check to make sure that this isn't already in place, as a lot of changes have already made it into the ui for 7.

Any new feature that is sufficiently popular and well defined for 7 might get moved back to the 6.x branch but right now all new feature development is happening for 7.