From fb75ba758e3ea754f3d3909ed28a74823bff07a1 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 10 Oct 2006 05:44:24 +0000 Subject: [PATCH] r1235: Add a user moderation tool --- admin/usergroup.php | 59 +++++++++++++++++++++++++++++ includes/class_admin_navigation.php | 1 + 2 files changed, 60 insertions(+) diff --git a/admin/usergroup.php b/admin/usergroup.php index 69b49b1..22b7930 100755 --- a/admin/usergroup.php +++ b/admin/usergroup.php @@ -288,6 +288,65 @@ if ($_POST['do'] == 'update') // ################################################################### +if ($_POST['do'] == 'doapprove') +{ + $bugsys->input_clean('approve', TYPE_UINT); + + $idlist = array(); + if (is_array($bugsys->in['approve'])) + { + foreach ($bugsys->in['approve'] AS $id => $yesno) + { + if ($yesno > 0) + { + $idlist[] = $bugsys->clean($id, TYPE_UINT); + } + } + } + + if (sizeof($idlist) > 0) + { + // TODO - maybe send some kind of email? + $db->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE userid IN (" . implode(',', $idlist) . ")"); + } + + $admin->redirect('usergroup.php', _('The selected users have been promoted to the "Registered" usergroup.')); +} + +// ################################################################### + +if ($_REQUEST['do'] == 'approve') +{ + NavLinks::usergroupsAdd(); + $navigator->set_focus('link', 'usergroups-approve', 'usergroups'); + + $admin->page_start(_('Moderate Awaiting Users'), 3); + + $admin->form_start('usergroup.php', 'doapprove'); + $admin->table_start(); + $admin->table_head(_('Moderate Un-Approved Users'), 3); + + $admin->table_column_head(array(_('Username'), _('Usergroup'), _('Approve'))); + + $users = $db->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE usergroupid IN (3, 4)"); + while ($user = $db->fetch_array($users)) + { + $admin->row_multi_item(array( + '' . $user['email'] . '' => 'l', + $bugsys->datastore['usergroup']["$user[usergroupid]"]['title'] => 'c', + '' => 'c' + )); + } + + $admin->row_submit(false, ':save:', ':reset:', 3); + $admin->table_end(); + $admin->form_end(); + + $admin->page_end(); +} + +// ################################################################### + if ($_REQUEST['do'] == 'modify') { NavLinks::usergroupsAdd(); diff --git a/includes/class_admin_navigation.php b/includes/class_admin_navigation.php index 5a7caf2..9d2589b 100644 --- a/includes/class_admin_navigation.php +++ b/includes/class_admin_navigation.php @@ -386,6 +386,7 @@ class NavLinks $navigator->add_component('section', 'usergroups', 'users', _('Usergroups'), null); $navigator->add_component('link', 'usergroups-add', 'usergroups', _('Add New Usergroup'), 'usergroup.php?do=add'); + $navigator->add_component('link', 'usergroups-approve', 'usergroups', _('Moderate Awaiting Users'), 'usergroup.php?do=approve'); } // ################################################################### -- 2.43.5