Mys 1.3.5 Redirect Based on Group-Type

Forum
Last Post
Threads / Messages

GeneticAlpha

Loving Mysidia!
Member
Joined
May 24, 2020
Messages
283
Points
18
Age
30
Location
Tennessee
Mysidian Dollar
13,356
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:
$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.
 
Last edited:

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,267
Messages
33,048
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top