This droplet will detect if a user has just logged in and will redirect the user to a url defined by group.
// Modify the list with links for each usergroup ($urllist[1] is for usergroup 1)
$urllist[1] = WB_URL.'/page-for-group1/';
$urllist[2] = WB_URL.'/page-for-group2/';
$urllist[3] = WB_URL.'/page-for-group3/';
$urllist[4] = WB_URL.'/page-for-group4/';
// Do not change below this line.......
global $wb;
if(isset($_SESSION['redirected'])) return true; // been here before
if(!$wb->is_authenticated()) return true; // not loggedin, no action
$_SESSION['redirected'] = true; // Logged in, make sure this is only done once
$url = '';
// Check if member is in one of the groups and set the url to go to
foreach($urllist as $key => $value) {
if($wb->is_group_match( $key, $wb->get_groups_id() )) $url = $value;
}
if($url) { // group detected, url set, go there
if(headers_sent()) {
echo '<script type="text/javascript">window.location = "'.$url.'"</script>';
} else {
die(header('Location: '.$url , TRUE , 301));
}
}
return true;