This topic is locked

dynamic Landing Page

5/21/2022 3:55:52 PM
PHPRunner General questions
P
ppradhan@live.com author

Hi,
Is it possible to dynamically assign Landing Pages for each group or users in phprunner?
I have like 4 groups, and willing to create 4 different menu pages (copy of menu page and modify for each group).

Is there any inbuilt function that I call after Successfull Login for assigning landing pages? Assuming that A,B,C,D are 4 groups and menu1, menu2, menu3, menu4 are the supposed landing page.

After Successful Login{

$groups = Security::getUserGroups();
if($groups["A"] ) { setLandingPage menu1 ; }
if($groups["B"] ) { setLandingPage menu2 ; }
if($groups["C"] ) { setLandingPage menu3 ; }
if($groups["D"] ) { setLandingPage menu4 ; }

Please advice if this is applicable, or any trick to achieve?

Admin 5/22/2022

Instead of setting a landing page you can simply redirect the user to the required page:
Redirect in PHPRunner

P
ppradhan@live.com author 5/22/2022

@admin,
sir, redirecting to external link is a temporary act. As soon as user clicks at the menu or logo in the site, it goes back to default menu.php and cannot achieve what I have been looking for.

fhumanes 5/22/2022

Hello @ppradhan@live.com,

I think your solution approach is wrong and that is why you have a problem to integrate it into phprunner.

Not normal is that you have a single menu and this is configured according to the connected user (through their belonging groups).

Make as many menus as groups and with the common possibilities of these, I understand that it is a bad definition of the problem.

If you indicate the reason that leads you to create this solution, we may help you.

Greetings,
fernando

mbintex 5/23/2022

Dynamic landing pages are fairly easy - I have them in all my applications.

In the events for Welcome page (Before process) just do a redirect for your needs and conditions like this:

if (MobileDetected())
{
$_SESSION["starturl"]="";
}

if ($_SESSION["starturl"]!="" and $_SESSION["starturl"]!="menu.php")
{
header("LOCATION: ".$_SESSION["starturl"]);
}
P
ppradhan@live.com author 5/24/2022

thank you @mbintex5, I tried the way you mentioned but with no luck. Please find below my code and advice.

After Successful Login:
$groups = Security::getUserGroups();
if ($groups["A"] ) { $_SESSION["starturl"]= "menu.php?page=menu1"; }
if ($groups["B"] ) { $_SESSION["starturl"]= "menu.php?page=menu2"; }

Welcome Page: Before Process:
if (MobileDetected()) { $_SESSION["starturl"]=""; }
if ($_SESSION["starturl"]!="" and $_SESSION["starturl"]!="menu.php") {
header("LOCATION: ".$_SESSION["starturl"]);
}

with regards
Prakash Pradhan