Group dashboards

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
User avatar
jmcgov
Veteran Member
Posts: 40
Joined: 2018-12-19 01:31

Group dashboards

Post by jmcgov » 2019-07-15 23:39

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

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 659
Joined: 2018-04-01 10:12

Re: Group dashboards

Post by pböttcher » 2019-07-16 06:29

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;
}

User avatar
jmcgov
Veteran Member
Posts: 40
Joined: 2018-12-19 01:31

Re: Group dashboards

Post by jmcgov » 2019-07-16 07:33

Yes, that should do it. Thanks pbotcher.

User avatar
jmcgov
Veteran Member
Posts: 40
Joined: 2018-12-19 01:31

Re: Group dashboards

Post by jmcgov » 2019-07-16 23:29

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

Post Reply