Redirect to different page, depending on user group
I have a site running on a local server where all users need to log in to access it.
I have a simple security setup, using the security created by Powercms builder, pcms2_users, so that all users can access the site using the built in ‘Administrator’ Rule. Any ‘real’ admin tasks can be done by the single ‘SuperAdministrator’ from the credentials in the wa_settings table.
I have applied SecurityAssist access pages manager to all of the main site pages, which is working great.
All I want to do, is redirect Admins to the site home page, and SuperAdmins to the admin_cms home page, on successful login.
On users_login.php, I have tries editing the following redirect block
<?php if(WA_Auth_RulePasses("Super Administrator")){ // Begin Show Region ?>
<?php header('Location: '.(isset($_GET['accesscheck'])?$_GET['accesscheck']:"index.php")); ?>
<?php } // End Show Region ?>
<?php if(WA_Auth_RulePasses("Administrator")){ // Begin Show Region ?>
<?php header('Location: index.php'); ?>
<?php } // End Show Region ?>
Putting a slash in front of the ‘Administrator’ redirect, this works if I login as an Administrator, but if I try to log in as a SuperAdministrator, I get into a redirect loop