в бд
Код:
ALTER TABLE `bb_groups` ADD `group_rank` SMALLINT( 5 ) NOT NULL DEFAULT '0';
открыть
ucp/user_register.php
найти
Код:
if ( ($mode == 'register') || ($bb_cfg['allow_namechange']) )
{
$template->assign_block_vars('switch_namechange_allowed', array());
}
else
вставить выше
Код:
if ( $mode == 'editprofile' )
{
$sql = "SELECT DISTINCT gr.group_rank, r.rank_title FROM bb_user_group g
LEFT JOIN bb_groups gr ON(gr.group_id = g.group_id)
LEFT JOIN bb_ranks r ON(r.rank_id = gr.group_rank)
WHERE g.user_id = ".$userdata['user_id']." AND gr.group_rank > 0 AND g.user_pending < 1
ORDER BY rank_title";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain ranks data', '', __LINE__, __FILE__, $sql);
}
$rank_select_box = '<option value="0">' . $lang['No'] . '</option>';
while( $row = $db->sql_fetchrow($result) )
{
$rank = $row['rank_title'];
$rank_id = $row['group_rank'];
$selected = ( $userdata['user_rank'] == $rank_id ) ? ' selected="selected"' : '';
$rank_select_box .= '<option value="' . $rank_id . '"' . $selected . '>' . $rank . '</option>';
}
}
else $rank_select_box = 0;
найти
Код:
'SMILIES_STATUS' => $smilies_status,
вставить после
Код:
'RANK_SELECT_BOX' => $rank_select_box,
'L_SELECT_RANK' => $lang['Rank_title'],
найти
Код:
$strip_var_list = array('email' => 'email',
вставить после в строку добавить
Код:
'user_rank' => 'user_rank',
найти
Код:
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "
user_opt = $user_opt,
user_email = '" . str_replace("\'", "''", $email) ."',
user_icq = '" . str_replace("\'", "''", $icq) . "',
вставить после
Код:
user_rank = '" . $set_rank. "',
снова найти
Код:
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "
user_opt = $user_opt,
user_email = '" . str_replace("\'", "''", $email) ."',
user_icq = '" . str_replace("\'", "''", $icq) . "',
вставить выше
Код:
$sql = "SELECT DISTINCT gr.group_rank FROM bb_user_group g
LEFT JOIN bb_groups gr ON(gr.group_id = g.group_id)
LEFT JOIN bb_ranks r ON(r.rank_id = gr.group_rank)
WHERE g.user_id = ".$userdata['user_id']." AND gr.group_rank > 0 AND g.user_pending < 1
ORDER BY group_rank";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain ranks data', '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) )
{
$rank_dost[] = $row['group_rank'];
}
if (in_array($user_rank, $rank_dost)) $set_rank = (int) $user_rank;
else $set_rank = 0;
открыть
usercp_register.tpl
найти
Код:
<!-- IF SHOW_DATEFORMAT -->
<tr>
<td>{L_DATE_FORMAT}:<h6>{L_DATE_FORMAT_EXPLAIN}</h6></td>
<td><input type="text" name="dateformat" value="{DATE_FORMAT}" maxlength="14" /></td>
</tr>
<!-- ENDIF -->
вставить после
Код:
<!-- IF RANK_SELECT_BOX -->
<tr>
<td class="row1"><span class="gen">{L_SELECT_RANK}</span></td>
<td class="row2"><select name="user_rank">{RANK_SELECT_BOX}</select></td>
</tr>
<!-- ENDIF -->
в конец lang_main.php
Код:
$lang['Rank_title'] = 'Лычка';
открыть
admi_groups.php
найти
Код:
$sql_ary = array(
'group_type' => (int) $group_type,
'group_name' => (string) $group_name,
'group_description' => (string) $group_desc,
'group_moderator' => (int) $group_moderator,
'group_single_user' => 0,
вставить после
Код:
'group_rank' => (int) $group_rank,
найти
Код:
$group_type = isset($_POST['group_type']) ? intval($_POST['group_type']) : GROUP_OPEN;
$group_name = isset($_POST['group_name']) ? trim($_POST['group_name']) : '';
$group_desc = isset($_POST['group_description']) ? trim($_POST['group_description']) : '';
вставить после
Код:
$group_rank = isset($_POST['group_rank']) ? trim($_POST['group_rank']) : '';
найти
Код:
$template->assign_vars(array(
'TPL_EDIT_GROUP' => true,
'GROUP_NAME' => htmlspecialchars($group_info['group_name']),
'GROUP_DESCRIPTION' => htmlspecialchars($group_info['group_description']),
'GROUP_MODERATOR' => replace_quote($group_info['group_mod_name']),
вставить псоле
Код:
'RANK_SELECT_BOX' => $rank_select_box,
'L_SELECT_RANK' => $lang['Rank_title'],
'GROUP_RANK' => replace_quote($group_info['group_rank']),
найти
Код:
else if (!empty($_POST['new']))
{
$group_info = array(
'group_name' => '',
'group_description' => '',
'group_moderator' => '',
'group_mod_name' => '',
вставить после
Код:
'group_rank' => '',
найти
Код:
if (!empty($_POST['edit']) || !empty($_POST['new']))
{
if (!empty($_POST['edit']))
{
if (!$row = get_group_data($group_id))
{
bb_die($lang['Group_not_exist']);
}
$group_info = array(
'group_name' => $row['group_name'],
'group_description' => $row['group_description'],
'group_moderator' => $row['group_moderator'],
'group_mod_name' => $row['moderator_name'],
вставить после
Код:
'group_rank' => $row['group_rank'],
найти
Код:
$template->assign_vars(array(
'TPL_EDIT_GROUP' => true,
вставить выше
Код:
$sql = "SELECT * FROM " . RANKS_TABLE . "
WHERE rank_special = 1
ORDER BY rank_title";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain ranks data', '', __LINE__, __FILE__, $sql);
}
$rank_select_box = '<option value="0">' . $lang['No'] . '</option>';
while( $row = $db->sql_fetchrow($result) )
{
$rank = $row['rank_title'];
$rank_id = $row['rank_id'];
$selected = ( $group_info['group_rank'] == $rank_id ) ? ' selected="selected"' : '';
$rank_select_box .= '<option value="' . $rank_id . '"' . $selected . '>' . $rank . '</option>';
}
открыть admin_groups.tpl
найти
Код:
<tr>
<td>{L_GROUP_MODERATOR}:</td>
<td><input class="post" type="text" class="post" name="username" maxlength="50" size="20" value="{GROUP_MODERATOR}" /> <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>
</tr>
вставить после
Код:
<tr>
<td class="row1"><span class="gen">{L_SELECT_RANK}</span></td>
<td class="row2"><select name="group_rank">{RANK_SELECT_BOX}</select></td>
</tr>
открыть functions_group.php
найт
Код:
function delete_user_group ($group_id, $user_id)
{
$GLOBALS['db']->query("
DELETE FROM ". USER_GROUP_TABLE ."
WHERE user_id = ". (int) $user_id ."
AND group_id = ". (int) $group_id ."
");
вставить после
Код:
$GLOBALS['db']->query("
UPDATE bb_users u LEFT JOIN bb_groups g ON(g.group_id = ". (int) $group_id .")
SET u.user_rank = 0
WHERE u.user_id = ". (int) $user_id ." AND g.group_rank = u.user_rank
");
открыть groupcp.php
найти
Код:
else if (!empty($_POST['deny']) || !empty($_POST['remove']))
{
$db->query("
DELETE FROM ". USER_GROUP_TABLE ."
WHERE user_id IN($sql_in)
AND group_id = $group_id
");
if (!empty($_POST['remove']))
{
update_user_level($sql_in);
добавить после
Код:
$db->query("
UPDATE bb_users u LEFT JOIN bb_groups g ON(g.group_id = ". $group_id .")
SET u.user_rank = 0
WHERE u.user_id IN(". $sql_in .") AND g.group_rank = u.user_rank
");
За помощь в отладке огромное спасибо Demag и FXPELIVE
|