I am trying to figure out the best solution to this problem - but not being hot on PHP, i could do with a bit of help.
I'm building a site for Wordpress.
the site will have a number of different users who will have different levels of access to read pages. So 'User Group 1' might have access to view page 1, 2, 3 and 4. 'User Group 2' might have access to page 1, 4, 5 and 6.
What i am trying to figure out is - once 'user group 1' logs in and gets redirected to the index page i want to control which tabs are displayed in the nav bar.
- if user group 1 - display tabs 1, 2, 3 and 4 - if user group 2 - display tabs 1, 4, 5, 6
(however, there may be a large number of different user groups / access levels.)
and so on.
Is this achieved with 'switch' ? could someone point me in the right direction please.
Yeah that solution seems to be very logical. You might want to consider storing the variable in a PHP session, so that you can reuse it. The best way would be to have the logical expression (the if statement) on the login page, and then a variable is set that contains the path of the navigation, so...
I'm building a site for Wordpress.
the site will have a number of different users who will have different levels of access to read pages. So 'User Group 1' might have access to view page 1, 2, 3 and 4. 'User Group 2' might have access to page 1, 4, 5 and 6.
What i am trying to figure out is - once 'user group 1' logs in and gets redirected to the index page i want to control which tabs are displayed in the nav bar.
- if user group 1 - display tabs 1, 2, 3 and 4
- if user group 2 - display tabs 1, 4, 5, 6
(however, there may be a large number of different user groups / access levels.)
and so on.
Is this achieved with 'switch' ?
could someone point me in the right direction please.
many many thanks for your help.
if($group == 1)
{
include('nav1.php');
}
else
{
include('reg_nav.php');
}
Maybe store your groups in an array and make the nav available to the groups in that array?
And then when your user visits a page...
This solution will make it more manageable in the long run. Hope this helps.
-Tom