ExPlayer
Пользователь
Решение проблемы, спасибо Virtuoz
«в viewtopic.php удали все что связано с предыдущем кодом и сделай как ниже»
«в viewtopic.php удали все что связано с предыдущем кодом и сделай как ниже»
Код:
viewtopic.php
найти
//
// Update the topic view counter
//
$sql = "INSERT INTO ". BUF_TOPIC_VIEW ." (topic_id, topic_views) VALUES ($topic_id, 1) ON DUPLICATE KEY UPDATE topic_views = topic_views + 1";
if (!DB()->sql_query($sql))
{
bb_die('Could not update topic views');
}
после добавить
// Medal MOD
$medal = $medals = array();
$poster_ids = 0;
for($i = 0; $i < $total_posts; $i++)
{
$poster_ids .= ','. $postrow[$i]['user_id'];
}
$order = ( $bb_cfg['medal_display_order'] ) ? "RAND()" : "m.medal_name";
$sql = DB()->fetch_rowset("SELECT m.medal_id, m.medal_name, m.medal_image, mu.user_id
FROM " . BB_MEDAL . " m, " . BB_MEDAL_USER . " mu
WHERE mu.user_id IN ($poster_ids)
AND m.medal_id = mu.medal_id
ORDER BY $order");
$medal_width = ( $bb_cfg['medal_display_width'] ) ? 'width="'.$bb_cfg['medal_display_width'].'"' : '';
$medal_height = ( $bb_cfg['medal_display_height'] ) ? 'height="'.$bb_cfg['medal_display_height'].'"' : '';
$j = 1;
foreach($sql as $row)
{
$j++;
if(empty($medals[$row['user_id']]))
{
$medals[$row['user_id']] = 1;
}
else
{
$medals[$row['user_id']]++;
}
if(empty($medal[$row['user_id']])) $medal[$row['user_id']] = '';
$medal[$row['user_id']] .= ' <img src="'. $row['medal_image'] .'" border="0" alt="'. $row['medal_name'] .'" title="'. $row['medal_name'] .'" '. $medal_width .' '. $medal_height .' />';
if($j == 3)
{
$medal[$row['user_id']] .= '<br />';
$i = 1;
}
}
//Medal MOD [END]
найти
'POSTER_AVATAR' => $poster_avatar,
добавить
'POSTER_MEDAL_COUNT' => !empty($medals[$poster_id]) ? $medals[$poster_id] : 0,
'POSTER_MEDALS' => !empty($medal[$poster_id]) ? $medal[$poster_id] : '',
Код:
в viewtopic.tpl
заменить на
<br /><br />{postrow.POSTER_MEDALS}<br />
<hr>
<center>
<!-- BEGIN medal -->
<table border="0" cellspacing="0" cellpadding="5">
<!-- BEGIN medal_row -->
<tr align="left" valign="middle">
<!-- BEGIN medal_col -->
<td><img src="{postrow.medal.medal_row.medal_col.MEDAL_IMAGE}" border="0" alt="{postrow.medal.medal_row.medal_col.MEDAL_NAME} {postrow.medal.medal_row.medal_col.MEDAL_COUNT}" title="{postrow.medal.medal_row.medal_col.MEDAL_NAME} {postrow.medal.medal_row.medal_col.MEDAL_COUNT}" {postrow.medal.medal_row.medal_col.MEDAL_WIDTH} {postrow.medal.medal_row.medal_col.MEDAL_HEIGHT} /></td>
<!-- END medal_col -->
</tr>
<!-- END medal_row -->
</table>
<!-- END medal -->
</center>