So I had wanted to be able to redirect people from my index page if they were logged in, that way it was only accessible by visitors. So I got this to work and wanted to share it.
In indexview.php put this:
Quote:
$group = $mysidia->db->select("users", array("usergroup"), "username ='{$mysidia->user->username}'")->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;
}
|
right under
$document->setTitle("Dino Tracks"); that's in the public function index area.
This looks at the viewer's current group and says if they are anything other than visitor, they get redirected. So this can be used in many other areas too.