I have a table that shows every all the users including the admin
and the seo
, I want to restrict the privileges to the users only see other users ( And not see the admin nor seo). Here's list of users:
Array
(
[0] => Array
(
[uid] => 1
[rid] => admin
[first_name] => Admin
[last_name] => Admin
[email] => admin@admin.com
[password] => b2be38504e4c8dedffab96534ff3df93
[date_register] => 2014-02-18 08:27:28
[last_connexion] => 2014-03-11 18:18:54
[enable] => 1
)
[1] => Array
(
[uid] => 2
[rid] => seo
[first_name] => SEO
[last_name] => SEO
[email] => seo@SEO.com
[password] => 74709b45674cab2d2e9928578237a3c4
[date_register] => 2014-02-18 08:27:28
[last_connexion] => 0000-00-00 00:00:00
[enable] => 1
)
[2] => Array
(
[uid] => 3
[rid] => user
[first_name] => Test
[last_name] => Test
[email] => test@yahoo.com
[password] => 2b2809a2b67df0e17d44de3b0d33e880
[date_register] => 2014-02-18 08:27:51
[last_connexion] => 0000-00-00 00:00:00
[enable] => 1
)
And here's my code :
foreach ($users as $key => $value){
if (user('rid') != 'seo' && user('rid') != 'admin') {
unset($users[$key]['seo']);
unset($users[$key]['admin']);
}
}
Hope you understood what I mean. Is there a error in my code?
Thanks