ผู้เขียน หัวข้อ: แสดง"จำนวนหัวข้อที่ตั้ง"  (อ่าน 10728 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ smf

  • [color=green][i]"ถ้าคุณไม่สามารถอธิบายอย่างง่ายๆ ให้คนอื่นเข้าใจได้แล้วล่ะก็ แสดงว่าคุณยังเข้าใจมันไม่ดีพอ"[/i][/color]
  • Administrator
  • Hero Member
  • *****
  • กระทู้: 1,368
  • พอยท์: 5
    • ดูรายละเอียด
    • pordoo.com
    • อีเมล์
แสดง"จำนวนหัวข้อที่ตั้ง"
« เมื่อ: 23 ตุลาคม 2015, 01:32:10 »
Mod Name:Topic Count On Display
http://custom.simplemachines.org/mods/index.php?mod=1003











File Edits

./Sources/Load.php

Find:
โค๊ด: [Select]
'posts' => empty($user_settings['posts']) ? 0 : $user_settings['posts'],Replace With:
โค๊ด: [Select]
'posts' => empty($user_settings['posts']) ? 0 : $user_settings['posts'],
'topics' => empty($user_settings['topics']) ? 0 : $user_settings['topics'],

Find:
โค๊ด: [Select]
mem.birthdate, mem.member_ip, mem.member_ip2, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.last_login,Replace With:
โค๊ด: [Select]
mem.birthdate, mem.member_ip, mem.member_ip2, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.topics, mem.last_login,
Find:
โค๊ด: [Select]
mem.openid_uri, mem.birthdate, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.last_login, mem.karma_good,Replace With:
โค๊ด: [Select]
mem.openid_uri, mem.birthdate, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.topics, mem.last_login, mem.karma_good,
Find: [Select]
โค๊ด: [Select]
mem.posts, mem.last_login, mem.member_ip, mem.member_ip2, mem.lngfile, mem.id_group, mem.is_shareable';Replace With:
โค๊ด: [Select]
mem.posts, mem.topics, mem.last_login, mem.member_ip, mem.member_ip2, mem.lngfile, mem.id_group, mem.is_shareable';
Find:
โค๊ด: [Select]
'posts' => $profile['posts'] > 500000 ? $txt['geek'] : comma_format($profile['posts']),Replace With:
โค๊ด: [Select]
'posts' => $profile['posts'] > 500000 ? $txt['geek'] : comma_format($profile['posts']),
'real_topics' => $profile['topics'],
'topics' => $profile['topics'] > 500000 ? $txt['geek'] : comma_format($profile['topics']),


./Sources/ManageMaintenance.php

Find:
โค๊ด: [Select]
// Update all the basic statistics.Add Before:
โค๊ด: [Select]
$result = $smcFunc['db_query']('', '
SELECT t.id_member_started, COUNT(t.id_topic) AS topics
FROM ({db_prefix}topics AS t, {db_prefix}boards AS b)
WHERE t.id_board = b.id_board
AND b.count_posts = {int:count_posts}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
GROUP BY t.id_member_started',
array(
'count_posts' => 0,
'recycle_board' => $modSettings['recycle_board'],
)
);
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET topics = {int:topics}
WHERE id_member = {int:id_member}
LIMIT 1',
array(
'topics' => $row['topics'],
'id_member' => $row['id_member_started'],
)
);
}
$smcFunc['db_free_result']($result);


./Sources/ManageSettings.php

Find:
โค๊ด: [Select]
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'warning_status');Replace With:
โค๊ด: [Select]
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'topics', 'warning_status');
Find:
โค๊ด: [Select]
$context['fields_no_registration'] = array('posts', 'warning_status');Replace With:
โค๊ด: [Select]
$context['fields_no_registration'] = array('posts', 'topics', 'warning_status');
Find:
โค๊ด: [Select]
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'warning_status');
$fields_no_registration = array('posts', 'warning_status');
Replace With:
โค๊ด: [Select]
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'topics', 'warning_status');
$fields_no_registration = array('posts', 'topics', 'warning_status');


./Sources/Memberlist.php

Find:
โค๊ด: [Select]
'width' => '115',Replace With:
โค๊ด: [Select]
'width' => '57',This operation isn't vital to the installation of this mod.

Find:
โค๊ด: [Select]
'default_sort_rev' => true,
)
Replace With:
โค๊ด: [Select]
),
'topics' => array(
'label' => $txt['topicsmb'],
'width' => '58',
'colspan' => '2',
'default_sort_rev' => true,
)
This operation isn't vital to the installation of this mod.

Find:
โค๊ด: [Select]
'up' => 'mem.posts ASC'
)
);
Replace With:
โค๊ด: [Select]
'up' => 'mem.posts ASC'
),
'topics' => array(
'down' => 'mem.topics DESC',
'up' => 'mem.topics ASC'
)
);

Find:
โค๊ด: [Select]
$members = array();Add Before:
โค๊ด: [Select]
// Get the most topics.
$result = $smcFunc['db_query']('', '
SELECT MAX(topics)
FROM {db_prefix}members',
array(
)
);
list ($MOST_TOPICS) = $smcFunc['db_fetch_row']($result);
$smcFunc['db_free_result']($result);

// Avoid division by zero...
if ($MOST_TOPICS == 0)
$MOST_TOPICS = 1;

Find:
โค๊ด: [Select]
$context['members'][$member]['post_percent'] = round(($context['members'][$member]['real_posts'] * 100) / $MOST_POSTS);Replace With:
โค๊ด: [Select]
$context['members'][$member]['post_percent'] = round(($context['members'][$member]['real_posts'] * 100) / $MOST_POSTS);
$context['members'][$member]['topic_percent'] = round(($context['members'][$member]['real_topics'] * 100) / $MOST_TOPICS);


./Sources/Profile-Modify.php

Find:
โค๊ด: [Select]
),
'real_name' => array(
Replace With:
โค๊ด: [Select]
),
'topics' => array(
'type' => 'int',
'label' => $txt['topicp'],
'log_change' => true,
'size' => 4,
'permission' => 'moderate_forum',
'input_validate' => create_function('&$value', '
$value = $value != \'\' ? strtr($value, array(\',\' => \'\', \'.\' => \'\', \' \' => \'\')) : 0;
return true;
'),
),
'real_name' => array(



Find:
โค๊ด: [Select]
'member_name', 'real_name', 'date_registered', 'posts', 'lngfile', 'hr',Replace With:
โค๊ด: [Select]
'member_name', 'real_name', 'date_registered', 'posts', 'topics', 'lngfile', 'hr',

./Sources/Profile-View.php

Find:
โค๊ด: [Select]
// Set the age...Add Before:
โค๊ด: [Select]
if (empty($user_profile[$memID]['date_registered']) || $days_registered < 1)
$context['member']['topics_per_day'] = $txt['not_applicable'];
else
$context['member']['topics_per_day'] = comma_format($context['member']['real_topics'] / $days_registered, 3);
   
Find:
โค๊ด: [Select]
// Number of topics started.Add Before:
โค๊ด: [Select]
$context['num_topics'] = comma_format($user_profile[$memID]['topics']);

./Sources/RemoveTopic.php

Find:
โค๊ด: [Select]
// Recycle topics that aren't in the recycle board...Add Before:
โค๊ด: [Select]
// Decrease the topic count for member.
if ($decreasePostCount)
{
$requestMembers = $smcFunc['db_query']('', '
SELECT t.id_member_started
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE t.id_topic IN ({array_int:topics})
AND b.id_board = t.id_board
AND b.count_posts = {int:do_count_posts}',
array(
'do_count_posts' => 0,
'topics' => $topics,
)
);
while ($rowMembers = $smcFunc['db_fetch_assoc']($requestMembers))
updateMemberData($rowMembers['id_member_started'], array('topics' => '-'));
$smcFunc['db_free_result']($requestMembers);
}


./Sources/SplitTopics.php

Find:
โค๊ด: [Select]
// Housekeeping.Add Before:
โค๊ด: [Select]
// The first message starter's topic count increased.
$smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET topics = topics + 1
WHERE id_member = {int:split2_firstMem}
LIMIT 1',
array(
'split2_firstMem' => $split2_firstMem,
)
);

Find:
โค๊ด: [Select]
// Delete the remaining topics.Add Before:
โค๊ด: [Select]
$deleted_topics = array_diff($topics, array($id_topic));

// Decrease topic count for user.
$mmbrsndpdt = $smcFunc['db_query']('', '
SELECT id_member_started, COUNT(*) AS topics
FROM {db_prefix}topics
WHERE id_topic IN ({array_int:deleted_topics})
GROUP BY id_member_started',
array(
'deleted_topics' => $deleted_topics,
)
);
while ($rowMembers = $smcFunc['db_fetch_assoc']($mmbrsndpdt))
updateMemberData($rowMembers['id_member_started'], array('topics' => 'topics - ' . $rowMembers['topics']));
$smcFunc['db_free_result']($mmbrsndpdt);


./Sources/Subs.php

Find:
โค๊ด: [Select]
'date_registered', 'posts'Replace With:
โค๊ด: [Select]
'date_registered', 'posts', 'topics'
Find:
โค๊ด: [Select]
if (in_array($var, array('posts', 'instant_messages', 'unread_messages')))Replace With:
โค๊ด: [Select]
if (in_array($var, array('posts', 'topics', 'instant_messages', 'unread_messages')))

./Sources/Subs-Post.php

Find:
โค๊ด: [Select]
// What if we want to export new topics out to a CMS?Add Before:
โค๊ด: [Select]
// Increase the topic counter for the user that created the topic.
if (!empty($posterOptions['update_post_count']) && !empty($posterOptions['id']))
{
// Are you the one that happened to create this topic?
if ($context['user']['id'] == $posterOptions['id'])
$user_info['topics']++;
updateMemberData($posterOptions['id'], array('topics' => '+'));
}


./Themes/default/Memberlist.template.php

Find:
โค๊ด: [Select]
if (!isset($context['disabled_fields']['posts']))
{
echo '
<td class="windowbg2" width="15">', $member['posts'], '</td>
<td class="windowbg statsbar" width="120" align="', $context['right_to_left'] ? 'right' : 'left', '">';

if (!empty($member['post_percent']))
echo '
<div class="bar" style="width: ', $member['post_percent'] + 4, 'px;">
<div style="width: ', $member['post_percent'], 'px;"></div>
</div>';

echo '
</td>';
}
Add After: [Select]
โค๊ด: [Select]
if (!isset($context['disabled_fields']['topics']))
{
echo '
<td class="windowbg2" width="15">', $member['topics'], '</td>
<td class="windowbg statsbar" width="120" align="', $context['right_to_left'] ? 'right' : 'left', '">';

if (!empty($member['topic_percent']))
echo '
<div class="bar" style="width: ', $member['topic_percent'] + 4, 'px;">
<div style="width: ', $member['topic_percent'], 'px;"></div>
</div>';

echo '
</td>';
}
This operation isn't vital to the installation of this mod.

Find: [Select]
โค๊ด: [Select]
', $txt['posts_made'] ,':&nbsp;', $member['posts'], '<br />Add After:
โค๊ด: [Select]
', $txt['topicp'] ,':&nbsp;', $member['topics'], '<br />
This operation isn't vital to the installation of this mod.


./Themes/default/Display.template.php

Find:
โค๊ด: [Select]
// Is karma display enabled?  Total or +/-?Add Before:
โค๊ด: [Select]
// Show how many topics they have started.
if (!isset($context['disabled_fields']['topics']))
echo '
<li class="postcount">', $txt['topiccount'], ': ', $message['member']['topics'], '</li>';


./Themes/default/Profile.template.php

Find:
โค๊ด: [Select]
// Only show the email address fully if it's not hidden - and we reveal the email.
Add Before:
โค๊ด: [Select]
if (!isset($context['disabled_fields']['topics']))
echo '
<dt>', $txt['topicp'], ':</dt>
<dd>', $context['member']['topics'], ' (', $context['member']['topics_per_day'], ' ', $txt['topics_per_day'], ')</dd>';


./Themes/default/languages/Modifications.english.php

Find (at the end of the file):
โค๊ด: [Select]
?>Add Before:
โค๊ด: [Select]
$txt['topics_per_day'] = 'per day';
$txt['topicp'] = 'Topics';
$txt['topicsmb'] = 'Topics';
$txt['topiccount'] = 'Topics';


Code
dbinstall.php
« แก้ไขครั้งสุดท้าย: 23 ตุลาคม 2015, 16:02:06 โดย smf »