Try this snippet:
* change the
1 and
6 in these sections to the number of the group you want to check for:
if(array_value_count("1",$_SESSION['webDocgroups'])){
else if(array_value_count("6",$_SESSION['webDocgroups'])){
* change the $max_logins to suit
* modify the chunk name you want to print according to the group
<?php
/* Welcome_Message.snippet.php
[!Welcome_Message!]
*/
if(isset($_SESSION['webShortname'])){
$number_of_logins =$_SESSION['webnrlogins'];
function array_value_count ($match, $array)
{
$count = 0;
foreach ($array as $key => $value)
{
if ($value == $match)
{
$count++;
}
}
return $count;
}
$output ="";
// this checks for webDocgroup with id #1
// if its found, then it sets the output results
if(array_value_count("1",$_SESSION['webDocgroups'])){
$webgroup ="1";
$max_logins ="500";
$default_chunk ="Welcome_Message_1";
}
else if(array_value_count("6",$_SESSION['webDocgroups'])){
$webgroup ="6";
$max_logins ="2";
$default_chunk ="Welcome_Message_2";
}
else{
$webgroup ="No Web Groups";
$max_logins ="100";
$default_chunk ="";
}
if($number_of_logins <= $max_logins){
// print the results if $default_chunk is not empty
if($default_chunk !=""){
$output .="{{".$default_chunk."}}";
// debug output (uncomment to show)
// $output .="<br />
// <div>You have logged in ".$number_of_logins." times out of (".$max_logins.") and are a member of ".$webgroup."</div>";
}
}
return $output;
}
?>
Note that if the webuser is a member of both groups you are checking for, I think it will take the last value you check for before processing.
If you cant figure out the ID of the groups you are checking for, use this snippet on a page... log in as the webuser and check the array results for the ID’s which will show like this:
[webDocgroups] => Array ( [0] => 1 )
<?php
/* Session_Info
[!Session_Info!]
*/
$output ="";
if(isset($_SESSION['webShortname'])){
$output .= print_r($_SESSION);
}
return $output;
?>