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

CommentFileSizeAuthor
#9 Screen Shot 2015-04-20 at 9.35.56 AM.png167.57 KBdshields

Comments

ABDUL7887’s picture

Assigned: ABDUL7887 » Unassigned
dshields’s picture

Without 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.

ABDUL7887’s picture

thanks 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 ?

dshields’s picture

Nope
Not without a whole lot more context and detail
If you use your imagination, my suggestion probably holds water. Good luck.

ABDUL7887’s picture

Because 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 ?

ABDUL7887’s picture

Somebody?

dshields’s picture

Does selecting permissions for those roles in the views ui not hide the tabs for other roles?

ABDUL7887’s picture

It 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.

dshields’s picture

StatusFileSize
new167.57 KB

It should be possible if you set specific role-based solutions for each views display. See screenshot.

ABDUL7887’s picture

I 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 ?

ABDUL7887’s picture

No one is able to help ?

mustanggb’s picture

Status: Active » Closed (outdated)

Closing 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.