I have a few different “Dashboard” reports created in PHP Reportmaker and I want to display the reports based on user level access as the default page.I appreciate any input.Thank You
You may simply use “Page_Redirecting” server event from “Server Events” → “Other” → “Default Page” of your PHPMaker project.
Please read “Server Events and Client Scripts” topic from PHPMaker Help menu for more information and example.
It would work if I could designate the default page based on a user’s user level. I do not want to use a “static” page for everyone.
You may implement your business-logic dynamically in that server event I mentioned before. For example, each logged-in user’s user level will be redirected to the certain page that derived from your config setting in Database.
Can´t you use CurrentUserLevel() and Page_Terminate() in switch to make this happen?Ex:
switch (CurrentUserLevel()) {
case 1:
CurrentPage()->Page_Terminate(“dashpage_1.php”);
break;
case 2:
CurrentPage()->Page_Terminate(“dashpage_2.php”);
break;
case 3:
CurrentPage()->Page_Terminate(“dashpage_3.php”);
break;
default:
CurrentPage()->Page_Terminate(“dashpage_0.php”);
break;
}or even simpler: CurrentPage()->Page_Terminate(“dashpage_”.CurrentUserLevel().“.php”);
@riverman,No. You cannot use that code in the “Page_Redirecting” server event from “Server Events” → “Other” → “Default Page” I mentioned above. It will raise an fatal error if you put your code in that event.You only need to assign the only param in that event ($url), for example from your code above, it become:if (IsLoggedIn())
$url = “dashpage_”.CurrentUserLevel().“.php”;
@riverman,No. You cannot use that code in the “Page_Redirecting” server event from “Server Events” → “Other” → “Default Page” I mentioned above. It will raise a fatal error if you put your code in that event.You only need to assign the only param in that event ($url), for example from your code above, it become:if (IsLoggedIn())
$url = “dashpage_”.CurrentUserLevel().“.php”;
Is there a way to do this in v2022?There does not seem to be a “Server Events” → “Other” → “Default Page” in v2022,Thanks,
For v2022, basically is the same as v2021. This should help: https://discourse.hkvstore.com/t/default-page-for-anonymous-user/3901/4
riverman wrote:
Can´t you use CurrentUserLevel() and Page_Terminate() in switch to make this happen?> Ex:
switch (CurrentUserLevel()) {
case 1:
CurrentPage()->Page_Terminate(“dashpage_1.php”);
break;
…
I use something very similar with success to do what you are trying.
In ServerEvents-> Other → Login Page → UserLoggedIn
switch ($cul) { //current user level
case 6: //if owner
$this->terminate("page1");
break;
case 1: // if supervisor
$this->terminate("page2");
break;
case 2: // if accounting
$this->terminate("page3");
break;
default: // timecard users, all others
$this->terminate("pagedefault");
}
brianheim wrote:
I use something very similar with success to do what you are trying.
In ServerEvents-> Other → Login Page → UserLoggedIn
switch ($cul) { //current user level
case 6: //if owner
$this->terminate("page1");
break;
case 1: // if supervisor
$this->terminate("page2");
break;
case 2: // if accounting
$this->terminate("page3");
break;
default: // timecard users, all others
$this->terminate("pagedefault");
}
>
I think will not works with last versions of phpmaker if Multiuserlevels is enabled.
maybe you have to use:$cUL_arr = explode (",", CurrentUserLevel());