Demo: diễn đàn này.
Ok, bắt đầu nào:
Mở sources/topics.php
Tìm:
CODE
if ( strstr( $html, '[attachmentid='.$row['attach_id'].']' ) )
{
$html = str_replace( '[attachmentid='.$row['attach_id'].']', $tmp, $html );
}
else
{
$temp_hold['thumb'] .= $tmp . ' ';
}
Thay bằng:
CODE
if ( strstr( $html, '[attachmentid='.$row['attach_id'].']' ) )
{
if ($ibforums->member['id'] == '' || $ibforums->member['id'] == '0')
{
if ($shown == 1)
{
$html = str_replace("[attachmentid=".$row['attach_id']."]", "", $html);
}
else
{
$html = str_replace("[attachmentid=".$row['attach_id']."]", $ibforums->lang['no_guest_attach'], $html);
$shown = 1;
}
}
else
{
$html = str_replace( '[attachmentid='.$row['attach_id'].']', $tmp, $html );
}
}
else
{
$temp_hold['thumb'] .= $tmp . ' ';
}
Tìm:
CODE
if ( strstr( $html, '[attachmentid='.$row['attach_id'].']' ) )
{
$html = str_replace( '[attachmentid='.$row['attach_id'].']', $tmp, $html );
}
else
{
$temp_hold['image'] .= $tmp . ' ';
}
Thay bằng:
CODE
if ( strstr( $html, '[attachmentid='.$row['attach_id'].']' ) )
{
if ($ibforums->member['id'] == '' || $ibforums->member['id'] == '0')
{
if ($shown == 1)
{
$html = str_replace("[attachmentid=".$row['attach_id']."]", "", $html);
}
else
{
$html = str_replace("[attachmentid=".$row['attach_id']."]", $ibforums->lang['no_guest_attach'], $html);
$shown = 1;
}
}
else
{
$html = str_replace( '[attachmentid='.$row['attach_id'].']', $tmp, $html );
}
}
else
{
$temp_hold['image'] .= $tmp . ' ';
}
Tìm:
CODE
if ( strstr( $html, '[attachmentid='.$row['attach_id'].']' ) )
{
$html = str_replace( '[attachmentid='.$row['attach_id'].']', $tmp, $html );
}
else
{
$temp_hold['attach'] .= $tmp;
}
Thay bằng:
CODE
if ( strstr( $html, '[attachmentid='.$row['attach_id'].']' ) )
{
if ($ibforums->member['id'] == '' || $ibforums->member['id'] == '0')
{
if ($shown == 1)
{
$html = str_replace("[attachmentid=".$row['attach_id']."]", "", $html);
}
else
{
$html = str_replace("[attachmentid=".$row['attach_id']."]", $ibforums->lang['no_guest_attach'], $html);
$shown = 1;
}
}
else
{
$html = str_replace( '[attachmentid='.$row['attach_id'].']', $tmp, $html );
}
}
else
{
$temp_hold['attach'] .= $tmp;
}
Tìm:
CODE
if ( $temp_out )
{
$html = str_replace( "<!--IBF.ATTACHMENT_{$row[$type]}-->", $temp_out, $html );
}
Thay bằng:
CODE
if ( $temp_out )
{
if ($ibforums->member['id'] == '' || $ibforums->member['id'] == '0')
{
if ($shown == 1)
{
$html = str_replace( "<!--IBF.ATTACHMENT_{$row[$type]}-->", "", $html );
}
else
{
$html = str_replace( "<!--IBF.ATTACHMENT_{$row[$type]}-->", $ibforums->lang['no_guest_attach'], $html );
$shown = 1;
}
}
else
{
$html = str_replace( "<!--IBF.ATTACHMENT_{$row[$type]}-->", $temp_out, $html );
}
}
Lưu & đóng lại sources/topics.php
Mở sources/misc/attach.php
Tìm:
CODE
//-----------------------------------------
// What to do..
//-----------------------------------------
Thêm phía trên:
CODE
if ($ibforums->member['id'] == '' || $ibforums->member['id'] == 0)
{
$std->error(array('LEVEL' => 1, 'MSG' => 'no_guest_attach'));
}
Lưu & đóng lại sources/misc/attach.php
Mở lang/en/lang_error.php
Tìm:
CODE
// 2.0
Thêm phía dưới:
CODE
'no_guest_attach' => 'Guests Are Not Allowed To View Or Download Attachments.',
Lưu & đóng lại lang/en/lang_error.php
Mở lang/en/lang_topic.php
Tìm:
CODE
// 2.0
Thêm phía dưới:
CODE
'no_guest_attach' => '<small><i>Guests Are Not Allowed To View Or Download Attachments.</i></small>',
Lưu & đóng lại lang/en/lang_topic.php
Phew! That's it!