"Friend" is the only relationship I have created. I used the following code to add a menu link to UR pages which has a default menu on top of the UR pages such as:

All | Pending | Friends


    $items['user/%user/associates'] = array(
      'title'             => 'Friends content',
      'description'       => t('Related content of friends'),
      'type'              => MENU_NORMAL_ITEM|MENU_LOCAL_TASK,
      'weight'            => 9,
      'access callback'   => 'user_relationships_ui_check_access',
      'access arguments'  => array('view'),
      'page callback'     => 'user_relationships_content',
      'page arguments'    => array(1),
    );

I added the above right under the below code block which starts on line 536 in file: user_relationships_ui.module


    $items['user/%user/relationships/list'] = array(
      'title'             => 'All',
      'type'              => MENU_NORMAL_ITEM|MENU_DEFAULT_LOCAL_TASK,
      'weight'            => -10,
      'access callback'   => 'user_relationships_ui_check_access',
      'access arguments'  => array(array('admin', 'user'), 1),
    );

The "user_relationships_content" in my code is the name of the view that comes built-in with UR as default, which I have tweaked to display the desired results correctly. I'm stuck only on adding my link.

Even after clearing caches, my link "Friends content" is not showing up on the top menu of UR pages. If someone knows what I'm doing wrong, that would be great.

Thanks.

Comments

buzzman’s picture

OK, I think I should further explain the above issue I'm facing:

I would like to know the correct way to add menu item(s) to the already existing menu items now on the top of UR pages. Just so that this is not confusing, I'm talking of adding simple Item(s) that each link to a views page display. The way I figured the code above is by copying the way the default menu items are currently coded in the following file in the UI folder of the UR installation:

user_relationships_ui.module

It would really help if someone could provide the correct code to add in the above file and perhaps explain what exactly should be added for each of the array elements.

Hope this clears up what I'm trying to get done.

Thanks again for reading.

buzzman’s picture

any update on this issue ? bump ...

Bilmar’s picture

subscribing

buzzman’s picture

Someone plz look into this ... ? Thanks.

buzzman’s picture

hullo again ... anyone out there ... ?

mtsanford’s picture

I'm talking of adding simple Item(s) that each link to a views page display.

If you're using views to create the page, you should not have to do any coding. You should just be able to specify the page menu setting as type = "menu tab". The default tab for the user page is user/%user/view, so you'd want to have 1 argument for the view, and use user/%/associates as the path. I think this will work, but not sure. You could also try user/%user/associates as the path.

mtsanford’s picture

    $items['user/%user/associates'] = array(
      'page callback'     => 'user_relationships_content',
    );

user_relationships_content? I don't think that's a defined function. Also did you rebuild your menus?

Are you using the view that is provided with user_relationships module? I think you should change the "menu" setting to get it to show as a tab.

buzzman’s picture

Status: Active » Fixed

Hi mtsanford:

Thanks for looking at this. I did end up tackling it another way but your input seems like right on target. Totally missed it since I guess I never had the requirement to link views to menus prior to this.

Cheers

Bilmar’s picture

@buzzman - could you please share with the community the method you used. Thanks!

Status: Fixed » Closed (fixed)

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