Closed (fixed)
Project:
User Relationships
Version:
6.x-1.0-rc2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2009 at 23:18 UTC
Updated:
31 Jan 2010 at 04:00 UTC
"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
Comment #1
buzzman commentedOK, 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.
Comment #2
buzzman commentedany update on this issue ? bump ...
Comment #3
Bilmar commentedsubscribing
Comment #4
buzzman commentedSomeone plz look into this ... ? Thanks.
Comment #5
buzzman commentedhullo again ... anyone out there ... ?
Comment #6
mtsanford commentedIf 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.
Comment #7
mtsanford commenteduser_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.
Comment #8
buzzman commentedHi 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
Comment #9
Bilmar commented@buzzman - could you please share with the community the method you used. Thanks!