Hi all,
I have seen two great posts on this forum showing JS changes to the homepage, which I could maybe repurpose for my needs, but I want to do something on backend, if possible.
In essence, I have 4 groups - guest, admin, supplier and client. I'd like to use the default dashboard/homepage for all groups, except the client and create a different dashboard for clients. Can I do this from PHP hooks files, or must I get down with JS? TIA James
Group dashboards
Re: Group dashboards
Hi,
you can use the in the hooks/__global.php to redirect to another page after successful login.
function login_ok($memberInfo, &$args){
## Check group and set RETURNPAGE
return RETURNPAGE;
}
you can use the in the hooks/__global.php to redirect to another page after successful login.
function login_ok($memberInfo, &$args){
## Check group and set RETURNPAGE
return RETURNPAGE;
}
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Group dashboards
Yes, that should do it. Thanks pbotcher.
Re: Group dashboards
Hi pböttcher
I did a slight variation on that, to remove the risk of the page being called directly through other links in the app (i.e. after login), which seems to work very well - I have included it, in case it proves useful to others.
Thanks once again for your steer. James
In hooks/header-extra.php
#DASHBOARD REDIRECT, START
if(strpos ( $_SERVER['PHP_SELF'] ,'index.php')){
$mi = getMemberInfo();
if(in_array($mi['group'], array('Club Member'))){
header("Location: /hooks/_dashboard.php");
exit();
}
}
#DASHBOARD REDIRECT, END
I did a slight variation on that, to remove the risk of the page being called directly through other links in the app (i.e. after login), which seems to work very well - I have included it, in case it proves useful to others.
Thanks once again for your steer. James
In hooks/header-extra.php
#DASHBOARD REDIRECT, START
if(strpos ( $_SERVER['PHP_SELF'] ,'index.php')){
$mi = getMemberInfo();
if(in_array($mi['group'], array('Club Member'))){
header("Location: /hooks/_dashboard.php");
exit();
}
}
#DASHBOARD REDIRECT, END