Giup do ve viec tao menu khac nhau tuy theo user

XIn chao. Minh hien dang gap mot van de sau day.

Minh dang tao mot module ca nhan. Module se co mot menu gom 4 onglets. Users su dung se co 2 loai. Loai 1 la super admin, co the thay 4 onglets trong menu. Loai 2 chi dc thay 2 cai. Minh suy nghi don gian , bang cach de mot condition tren 2 onglets dac biet, va test. Kieu nhu
function menu(){
--tao onglet 1
--tao onglet2
global $user
if(in_array('loai 1',$user->roles){
tao onglet 3
tao onglet 4
}
}.

Van de minh gap phai la. Khi minh connect giua cac account khac nhau de test. Module ko show nhu minh mong muon. Minh phai clear all cache thi menu moi thay doi theo yeu cau.

Co ai co the giai thich van de cho minh dc ko? Minh muon tat ca deu chay on thoa, ma ko can phai clear all cache.

Cam on moi nguoi.

Comments

cái này chắc module context

Demonthorn's picture

cái này chắc module context làm được, bạn thử xem sao

Vietnam

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week