PUN_ADMIN) message($lang_common['No permission']); // Add/edit a group (stage 1) if (isset($_POST['add_group']) || isset($_GET['edit_group'])) { if (isset($_POST['add_group'])) { $base_group = intval($_POST['base_group']); $result = $db->query('SELECT * FROM '.$db->prefix.'groups WHERE g_id='.$base_group) or error('Unable to fetch user group info', __FILE__, __LINE__, $db->error()); $group = $db->fetch_assoc($result); $mode = 'add'; } else // We are editing a group { $group_id = intval($_GET['edit_group']); if ($group_id < 1) message($lang_common['Bad request']); $result = $db->query('SELECT * FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch user group info', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) message($lang_common['Bad request']); $group = $db->fetch_assoc($result); $mode = 'edit'; } $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups'; $required_fields = array('req_title' => 'Group title'); $focus_element = array('groups2', 'req_title'); require PUN_ROOT.'header.php'; generate_admin_menu('groups'); ?>

Group settings

Setup group options and permissions

Below options and permissions are the default permissions for the user group. These options apply if no forum specific permissions are in effect.

Group title
User title This title will override any rank users in this group have attained. Leave blank to use default title or rank.
Read board tabindex="3" /> Yes    tabindex="4" /> No Allow users in this group to view the board. This setting applies to every aspect of the board and can therefore not be overridden by forum specific settings. If this is set to "No", users in this group will only be able to login/logout and register.
Post replies tabindex="5" /> Yes    tabindex="6" /> No Allow users in this group to post replies in topics.
Post topics tabindex="7" /> Yes    tabindex="8" /> No Allow users in this group to post new topics.
Edit posts tabindex="11" /> Yes    tabindex="12" /> No Allow users in this group to edit their own posts.
Delete posts tabindex="13" /> Yes    tabindex="14" /> No Allow users in this group to delete their own posts.
Delete topics tabindex="15" /> Yes    tabindex="16" /> No Allow users in this group to delete their own topics (including any replies).
Set user title tabindex="17" /> Yes    tabindex="18" /> No Allow users in this group to set their own user title.
Use search tabindex="19" /> Yes    tabindex="20" /> No Allow users in this group to use the search feature.
Search user list tabindex="21" /> Yes    tabindex="22" /> No Allow users in this group to freetext search for users in the user list.
Edit subjects interval Number of seconds after post time that users in this group may edit the subject of topics they've posted. Set to 0 to allow edits indefinitely.
Post flood interval Number of seconds that users in this group have to wait between posts. Set to 0 to disable.
Search flood interval Number of seconds that users in this group have to wait between searches. Set to 0 to disable.

Please note that in order for a user in this group to have moderator abilities, he/she must be assigned to moderate one or more forums. This is done via the user administration page of the user's profile.

escape($user_title).'\'' : 'NULL'; if ($_POST['mode'] == 'add') { $result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\'') or error('Unable to check group title collision', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result)) message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.'); $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES(\''.$db->escape($title).'\', '.$user_title.', '.$read_board.', '.$post_replies.', '.$post_topics.', '.$edit_posts.', '.$delete_posts.', '.$delete_topics.', '.$set_title.', '.$search.', '.$search_users.', '.$edit_subjects_interval.', '.$post_flood.', '.$search_flood.')') or error('Unable to add group', __FILE__, __LINE__, $db->error()); $new_group_id = $db->insert_id(); // Now lets copy the forum specific permissions from the group which this group is based on $result = $db->query('SELECT forum_id, read_forum, post_replies, post_topics FROM '.$db->prefix.'forum_perms WHERE group_id='.intval($_POST['base_group'])) or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $db->error()); while ($cur_forum_perm = $db->fetch_assoc($result)) $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$new_group_id.', '.$cur_forum_perm['forum_id'].', '.$cur_forum_perm['read_forum'].', '.$cur_forum_perm['post_replies'].', '.$cur_forum_perm['post_topics'].')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error()); } else { $result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\' AND g_id!='.intval($_POST['group_id'])) or error('Unable to check group title collision', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result)) message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.'); $db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_read_board='.$read_board.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_edit_subjects_interval='.$edit_subjects_interval.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Unable to update group', __FILE__, __LINE__, $db->error()); } // Regenerate the quickjump cache require_once PUN_ROOT.'include/cache.php'; generate_quickjump_cache(); redirect('admin_groups.php', 'Group '.(($_POST['mode'] == 'edit') ? 'edited' : 'added').'. Redirecting …'); } // Set default group else if (isset($_POST['set_default_group'])) { confirm_referrer('admin_groups.php'); $group_id = intval($_POST['default_group']); if ($group_id < 4) message($lang_common['Bad request']); $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$group_id.' WHERE conf_name=\'o_default_user_group\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error()); // Regenerate the config cache require_once PUN_ROOT.'include/cache.php'; generate_config_cache(); redirect('admin_groups.php', 'Default group set. Redirecting …'); } // Remove a group else if (isset($_GET['del_group'])) { confirm_referrer('admin_groups.php'); $group_id = intval($_GET['del_group']); if ($group_id < 5) message($lang_common['Bad request']); // Make sure we don't remove the default group if ($group_id == $pun_config['o_default_user_group']) message('The default group cannot be removed. In order to delete this group, you must first setup a different group as the default.'); // Check if this group has any members $result = $db->query('SELECT g.g_title, COUNT(u.id) FROM '.$db->prefix.'groups AS g INNER JOIN '.$db->prefix.'users AS u ON g.g_id=u.group_id WHERE g.g_id='.$group_id.' GROUP BY g.g_id, g_title') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); // If the group doesn't have any members or if we've already selected a group to move the members to if (!$db->num_rows($result) || isset($_POST['del_group'])) { if (isset($_POST['del_group'])) { $move_to_group = intval($_POST['move_to_group']); $db->query('UPDATE '.$db->prefix.'users SET group_id='.$move_to_group.' WHERE group_id='.$group_id) or error('Unable to move users into group', __FILE__, __LINE__, $db->error()); } // Delete the group and any forum specific permissions $db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error()); $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$group_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error()); // Regenerate the quickjump cache require_once PUN_ROOT.'include/cache.php'; generate_quickjump_cache(); redirect('admin_groups.php', 'Group removed. Redirecting …'); } list($group_title, $group_members) = $db->fetch_row($result); $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups'; require PUN_ROOT.'header.php'; generate_admin_menu('groups'); ?>

Remove group

Move users currently in group

The group "" currently has members. Please select a group to which these members will be assigned upon removal.

Add/setup groups

Add new group
Base new group on
Select a user group from which the new group will inherit it's permission settings. The next page will let you fine-tune said settings.
Set default group
Default group
This is the default user group, e.g. the group users are placed in when they register. For security reasons, users can't be placed in either the moderator or administrator user groups by default.

Existing groups

Edit/remove groups

The pre-defined groups Guests, Administrators, Moderators and Members cannot be removed. They can however be edited. Please note though, that in some groups, some options are unavailable (e.g. the edit posts permission for guests). Administrators always have full permissions.

query('SELECT g_id, g_title FROM '.$db->prefix.'groups ORDER BY g_id') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); while ($cur_group = $db->fetch_assoc($result)) echo "\t\t\t\t\t\t\t\t".''."\n"; ?>
Edit'.(($cur_group['g_id'] > PUN_MEMBER) ? ' - Remove' : '').''.pun_htmlspecialchars($cur_group['g_title']).'