Help with page redirects
Does anyone know how I go about making a page only viewable by visitors, so if you're already a member it just takes you to a specific page? I know how to do page redirects, but I need something that checks to see if you're a specific group.
Basically I'm wanting my members to not be able to go to the home page unless logged out. So only visitors can access the page. |
You can use $mysidia->user->usergroup->gid to get the numerical value of the usergroup the current viewer has and block 'em out that way. Alternatively, $mysidia->user->usergroup should pull up a string version that is the name of the group. I can't remember off the top of my head what all the default usergroups are.
|
Does all this need done in the login.php file or index.php file? I'm so confused lol. The visitor group I think is the guest group and it's all number 6.
Edit: Oh my gosh!!! I got it! I had it in the wrong file! This is what I used: $group = $mysidia->db->select("users", array("usergroup"), "gid ='{$mysidia->user->gid}'")->fetchColumn(); switch($group){ case 1; //admin $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); case 2; //deluxe $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); break; case 3; //member $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); break; case 4; //beta tester $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); break; case 5; //moderator $document->add(new Comment("<meta http-equiv='refresh' content='0; URL=http://www.dinotracks.mysidiahost.com/account' />")); break; case 6; //visitor break; } |
So you know, you don't have to make a query for that information, its in the variable $mysidia->user->usergroup->gid, which exists in exactly the same way $mysidia->user->gid did in your query..
PHP Code:
PHP Code:
|
All times are GMT -5. The time now is 02:35 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.