4
Try with following addtogroup.php
include "/mainfile.php";
global $xoopsDB;
$numgroup = '5'; // choose Group number
if (is_object($xoopsUser))
{
$groups = $xoopsUser->getGroups();
$uid = $xoopsUser->getVar('uid');
}
else
{
$groups = array(XOOPS_GROUP_ANONYMOUS);
$uid = 0;
}
if (($uid > 0) && (!in_array($numgroup, $groups)))
{
$query = "insert into ".$xoopsDB->prefix('groups_users_link')." (groupid, uid) VALUES('".$numgroup."', '".$uid."')";
$result= $xoopsDB->query($query);
if (mysql_error())
{
echo "Error in database : ".mysql_error();
exit();
}
}
redirect_header(XOOPS_URL.'/',0);
?>
In your bloc you make a php program
global $xoopsUser;
$numgroup = '5'; // choose Group number
if (is_object($xoopsUser))
{
$groups = $xoopsUser->getGroups();
if (!in_array($numgroup, $groups))
{
echo '';
}
else
{
echo "Welcome member";
}
}
else
{
echo "please register";
}
Not tested. Make a database backup first.