Conditional global redirect

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Satrapo
User
Posts: 39

Conditional global redirect

Post by Satrapo »

Hi, maybe it's a stupid question however I cannot figure how to do this.

PhpMaker 2023

My tables are: user, orders, item, service

In user table there is: "has_read_the_doc" field.
Well if this field is set to false from every page of the site (list,view,edit etc etc) the user has to be redirected to his specific userView page.

This code works but I nedd to put it in every Page Redirecting event

    if(!CurrentUserInfo("has_read_the_doc")){
    $theUrl = CurrentUserInfo("id");
    $url = "UserView/$theUrl?showdetail=";
    }

There is a way to obtain the same result without putting this code in every Page Redirecting event?

Thanks!


arbei
User
Posts: 9351

Post by arbei »

If you are not using modal pages, you may try Page_Unload server event, e.g.

// ... your code to set $url
Redirect(GetUrl($url)); // Redirect

Satrapo
User
Posts: 39

Post by Satrapo »

Thanks, it works.


Post Reply