1
I must say that I dislike having the short little screen tell me that I do not have permission to view a page and then redirect later. I have a suggestion that I have implemented.
Set up a new config variable called show_redirect_flash or something so that people can choose what way to be redirected.
In the xoops_redirect function in the functions.php file add:
if($xoopsConfig['show_redirect_flash']){
//normal xoops_redirect functionality
}else{
$url = preg_replace("/&/i", '&', htmlspecialchars($url, ENT_QUOTES));
setcookie ("XoopsRedirectCookie", $message, 0, "/");
header("Location: $url");
exit();
}
Then in header.php (maybe this should be somewhere else, but I am not sure where else to put it yet) add:
if $_COOKIE['XoopsRedirectCookie']){
$xoopsTpl->assign('xoops_redirect_message', $_COOKIE['XoopsRedirectCookie']);
setcookie ("XoopsRedirectCookie", "", 0, "/");
}
Then in the main template you can display the xoops_redirect_message anywhere/anyway you want to so that people are still alerted to the fact that something went wrong. This allows me to report all kinds of debug information that people may/may not want to see (ie. file not found).