Sorry, this page is only available in one language

Go to grouppage after login

Suggested dropletname: redirectgroup

Published by: Dev4me

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;

How to use:

  • Name the droplet something like [[redirectgroup]]
  • Modify the list of url's for each group you want to have redirected.
  • Place the droplet [[redirectgroup]] in your template


« Previous droplet | Overview | Next droplet »