cotonti.com : Group type setting https://www.cotonti.com Neueste Themenbeiträge Cotonti en Thu, 06 Aug 2026 22:17:11 -0000 GHengeveld Enabled dısabled ıs ınterestıng we could do more wıth that.

Pardon my spellıng, usıng a turkısh keyboard ıs quıte trıcky... (ım on vacatıon ın alanya)]]>
So, 03 Mai 2009 02:17:01 -0000
Trustmaster Di, 28 Apr 2009 12:27:50 -0000 pieter
I was looking once how to hide users from a specific group.

eg all banned users.
It is nice to keep them for there IP and usernames. But also nice to get them out of the user list, to see all normal users.

Maybe an idea to think about when you change some stuff of the usersgroups.]]>
Di, 28 Apr 2009 02:05:03 -0000
Trustmaster right-less groups

UPD:

So far we found these types of groups usable:
  • Normal group
  • Hidden group
  • Sub group only
  • Right-less status group

I think there should be just one field (grp_type) in the sed_groups table for all of them and group type should be selectable with a dropdown in Admin. Then scripts will check this field and implement appropriate behavior depending on group type.

What do you think?]]>
Mo, 27 Apr 2009 12:08:31 -0000
GHengeveld This is especially useful if you have a lot of different groups and multiple website administrators (with the right to edit a user's group).

1. Adding database column
Run the following SQL query on your database:
ALTER TABLE 'sed_groups' ADD 'grp_type' VARCHAR(4) NOT NULL DEFAULT 'both';

2. Adding language items
Inside system/lang/xx/admin.lang.php on line 358, add:
$L['adm_rights_grouptype'] = 'Can be set as';
$L['adm_rights_grouptype_both'] = 'Main and sub group';
$L['adm_rights_grouptype_sub'] = 'Sub group only';

3. New group selectbox
In system/core/admin/admin.users.inc.php on line 255, add:
$adminmain .= "<tr><td>".$L['adm_rights_grouptype']." :</td><td>";
$adminmain .= "<select name=\"ntype\">";
$adminmain .= "<option value=\"both\">".$L['adm_rights_grouptype_both']."</option>";
$adminmain .= "<option value=\"sub\">".$L['adm_rights_grouptype_sub']."</option>";
$adminmain .= "</select>";
$adminmain .= "</td></tr>";

On line 47, add:
$ntype = sed_import('ntype','P','TXT');

On line 50 there should be an SQL query, replace it with:
$sql = (!empty($ntitle)) ? sed_sql_query("INSERT INTO $db_groups (grp_alias, grp_level, grp_disabled, grp_hidden,  grp_maintenance, grp_type, grp_title, grp_desc, grp_icon, grp_pfs_maxfile, grp_pfs_maxtotal, grp_ownerid) VALUES ('".sed_sql_prep($nalias)."', ".(int)$nlevel.", ".(int)$ndisabled.", ".(int)$nhidden.",  ".(int)$nmtmode.", '".sed_sql_prep($ntype)."', '".sed_sql_prep($ntitle)."', '".sed_sql_prep($ndesc)."', '".sed_sql_prep($nicon)."', ".(int)$nmaxsingle.", ".(int)$nmaxtotal.", ".(int)$usr['id'].")") : '';

4. Edit group selectbox
On line 81, add:
$rtype = sed_import('rtype','P','TXT');
$rtype = sed_sql_prep($rtype);

Somewhere around line 88 there should be an SQL query, replace it with:
$sql = (!empty($rtitle)) ? sed_sql_query("UPDATE $db_groups SET grp_title='$rtitle', grp_desc='$rdesc', grp_icon='$ricon', grp_alias='$ralias', grp_level='$rlevel', grp_pfs_maxfile='$rmaxfile', grp_pfs_maxtotal='$rmaxtotal', grp_disabled='$rdisabled', grp_hidden='$rhidden', grp_maintenance='$rmtmode', grp_type='$rtype' WHERE grp_id='$g'") : '';

On line 170, add:
$selected_both = ($row['grp_type'] == 'both') ? ' selected="selected"' : '';
$selected_sub = ($row['grp_type'] == 'sub') ? ' selected="selected"' : '';
	
$adminmain .= "<tr><td>".$L['adm_rights_grouptype']." :</td>";
$adminmain .= "<td><select name=\"rtype\">";
$adminmain .= "<option value=\"both\"$selected_both>".$L['adm_rights_grouptype_both']."</option>";
$adminmain .= "<option value=\"sub\"$selected_sub>".$L['adm_rights_grouptype_sub']."</option>";
$adminmain .= "</select></td></tr>";

5. Modifying groups selection
In system/functions.php, on line 1249, find sed_build_groupsms(). Replace the entire function with:

function sed_build_groupsms($userid, $edit=FALSE, $maingrp=0)
{
	global $db_groups, $db_groups_users, $sed_groups, $L, $usr;

	$sql = sed_sql_query("SELECT gru_groupid FROM $db_groups_users WHERE gru_userid='$userid'");
	while ($row = sed_sql_fetcharray($sql))
	{
		$member[$row['gru_groupid']] = TRUE;
	}
	
	$sql = sed_sql_query("SELECT grp_id, grp_type FROM $db_groups");
	$onlysub[] = '';
	while ($row = sed_sql_fetcharray($sql))
	{
		if ($row['grp_type'] == 'sub') $onlysub[] = $row['grp_id'];
	}

	foreach($sed_groups as $k => $i)
	{
		$checked = ($member[$k]) ? "checked=\"checked\"" : '';
		$checked_maingrp = ($maingrp==$k) ? "checked=\"checked\"" : '';
		
		$readonly = (!$edit || $usr['level'] < $sed_groups[$k]['level'] || $k==SED_GROUP_GUESTS || $k==SED_GROUP_INACTIVE || $k==SED_GROUP_BANNED || ($k==SED_GROUP_TOPADMINS && $userid==1)) ? "disabled=\"disabled\"" : '';
		$readonly_maingrp = (!$edit || $usr['level'] < $sed_groups[$k]['level'] || $k==SED_GROUP_GUESTS || ($k==SED_GROUP_INACTIVE && $userid==1) || ($k==SED_GROUP_BANNED && $userid==1) || in_array($k, $onlysub)) ? "disabled=\"disabled\"" : '';

		if ($member[$k] || $edit)
		{
			if (!($sed_groups[$k]['hidden'] && !sed_auth('users', 'a', 'A')))
			{
				$res .= "<input type=\"radio\" class=\"radio\" name=\"rusermaingrp\" value=\"$k\" ".$checked_maingrp." ".$readonly_maingrp." /> \n";
				$res .= "<input type=\"checkbox\" class=\"checkbox\" name=\"rusergroupsms[$k]\" ".$checked." $readonly />\n";
				$res .= ($k == SED_GROUP_GUESTS) ? $sed_groups[$k]['title'] : "<a href=https://www.cotonti.com/\"".sed_url('users', 'gm='.$k)."\">".$sed_groups[$k]['title']."</a>";
				$res .= ($sed_groups[$k]['hidden']) ? ' ('.$L['Hidden'].')' : '';
				$res .= "<br />";
			}
		}
	}

	return $res;
}
[/][/]]]>
Sa, 11 Apr 2009 03:50:41 -0000