Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.3.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=42)
-   -   Redirect based on group type (http://www.mysidiaadoptables.com/forum/showthread.php?t=5728)

Micolai 04-10-2021 01:28 PM

Redirect based on group type
 
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.


All times are GMT -5. The time now is 06:29 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.