Hey guys,
I'm creating a website with two users role (A , B).
using Views, I created two tabs ( published contents, unpublished content) that I want them to appear in user "A" profile as this user have been given a permission to
add contents. User "B" is not allowed to add content but in his/her profile, the tabs are displayed which makes no sense.
How can I hide these tabs from "B" user, But "B" can see "A"s published content tab.
I tried Tab Tamer which will hide the tab from all users profile. not what i need.
tried to create a hook_menu_alter that will remove the tab in role "B" profile but I wasn't able to do it as I don't know how to write such function.
what do you think can be done to achieve this?
thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | Screen Shot 2015-04-20 at 9.35.56 AM.png | 167.57 KB | dshields |
Comments
Comment #1
ABDUL7887 commentedComment #2
dshields commentedWithout looking at it in depth, my initial suggestion is to make 2 views displays for each of these tabs and restrict access for only one role each. Then customize each display as needed.
Comment #3
ABDUL7887 commentedthanks dshields,
I tried your way but I can't see how adding one more view will solve it.
If I restrict "A" from View 1
and restrict "B" from View 2
I can't find a way to do the Following:
_____________________________________
role"A" can see other "A" tabs and his own
role"A" can not see role "B" tabs
role"B" can see role"A" tabs
role"B" can not see role"B" tabs and Can not see his own
can you please help ?
Comment #4
dshields commentedNope
Not without a whole lot more context and detail
If you use your imagination, my suggestion probably holds water. Good luck.
Comment #5
ABDUL7887 commentedBecause the tabs are in user/%/published-contents and user/%/unpublished-contents
opening two views will only provide me with 4 tabs in each user profile.
What I think will work is to write a hook_menu_alter()
Which will hide the tabs if they are displayed in any one of role "B" profiles.
This will hide the tabs in "B" profile from "B" users and from "A" users to see
Unfortunately I dun know how to write this hook.
anyone ?
Comment #6
ABDUL7887 commentedSomebody?
Comment #7
dshields commentedDoes selecting permissions for those roles in the views ui not hide the tabs for other roles?
Comment #8
ABDUL7887 commentedIt dose, but it also prevent the roles from seeing other users tabs.
If i used permissions access:
"A" will see tabs in "b" profile. And "b" will not be able to see any tabs at all nigher in his own profile nor others. That not what I'm trying to achieve.
Comment #9
dshields commentedIt should be possible if you set specific role-based solutions for each views display. See screenshot.
Comment #10
ABDUL7887 commentedI tried this and it's not the right solution, this is not going to solve it.
View 1->permission->A
view 2->permission->B
how will B sees A profile ?
Comment #11
ABDUL7887 commentedNo one is able to help ?
Comment #12
mustanggb commentedClosing this as outdated to tidy up a bit around here. If you're still having problems with the latest release please create a new issue.