Mod Name:Topic Count On Display
http://custom.simplemachines.org/mods/index.php?mod=1003File Edits./Sources/Load.phpFind:
'posts' => empty($user_settings['posts']) ? 0 : $user_settings['posts'],
Replace With:
'posts' => empty($user_settings['posts']) ? 0 : $user_settings['posts'],
'topics' => empty($user_settings['topics']) ? 0 : $user_settings['topics'],
Find:
mem.birthdate, mem.member_ip, mem.member_ip2, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.last_login,
Replace With:
mem.birthdate, mem.member_ip, mem.member_ip2, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.topics, mem.last_login,
Find:
mem.openid_uri, mem.birthdate, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.last_login, mem.karma_good,
Replace With:
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]
mem.posts, mem.last_login, mem.member_ip, mem.member_ip2, mem.lngfile, mem.id_group, mem.is_shareable';
Replace With:
mem.posts, mem.topics, mem.last_login, mem.member_ip, mem.member_ip2, mem.lngfile, mem.id_group, mem.is_shareable';
Find:
'posts' => $profile['posts'] > 500000 ? $txt['geek'] : comma_format($profile['posts']),
Replace With:
'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.phpFind:
// Update all the basic statistics.
Add Before:
$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.phpFind:
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'warning_status');
Replace With:
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'topics', 'warning_status');
Find:
$context['fields_no_registration'] = array('posts', 'warning_status');
Replace With:
$context['fields_no_registration'] = array('posts', 'topics', 'warning_status');
Find:
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'warning_status');
$fields_no_registration = array('posts', 'warning_status');
Replace With:
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'topics', 'warning_status');
$fields_no_registration = array('posts', 'topics', 'warning_status');
./Sources/Memberlist.phpFind:
'width' => '115',
Replace With:
'width' => '57',
This operation isn't vital to the installation of this mod.
Find:
'default_sort_rev' => true,
)
Replace With:
),
'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:
'up' => 'mem.posts ASC'
)
);
Replace With:
'up' => 'mem.posts ASC'
),
'topics' => array(
'down' => 'mem.topics DESC',
'up' => 'mem.topics ASC'
)
);
Find:
$members = array();
Add Before:
// 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:
$context['members'][$member]['post_percent'] = round(($context['members'][$member]['real_posts'] * 100) / $MOST_POSTS);
Replace With:
$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.phpFind:
),
'real_name' => array(
Replace With:
),
'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:
'member_name', 'real_name', 'date_registered', 'posts', 'lngfile', 'hr',
Replace With:
'member_name', 'real_name', 'date_registered', 'posts', 'topics', 'lngfile', 'hr',
./Sources/Profile-View.phpFind:
// Set the age...
Add Before:
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:
// Number of topics started.
Add Before:
$context['num_topics'] = comma_format($user_profile[$memID]['topics']);
./Sources/RemoveTopic.phpFind:
// Recycle topics that aren't in the recycle board...
Add Before:
// 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.phpFind:
// Housekeeping.
Add Before:
// 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:
// Delete the remaining topics.
Add Before:
$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.phpFind:
'date_registered', 'posts'
Replace With:
'date_registered', 'posts', 'topics'
Find:
if (in_array($var, array('posts', 'instant_messages', 'unread_messages')))
Replace With:
if (in_array($var, array('posts', 'topics', 'instant_messages', 'unread_messages')))
./Sources/Subs-Post.phpFind:
// What if we want to export new topics out to a CMS?
Add Before:
// 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.phpFind:
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]
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]
', $txt['posts_made'] ,': ', $member['posts'], '<br />
Add After:
', $txt['topicp'] ,': ', $member['topics'], '<br />
This operation isn't vital to the installation of this mod.
./Themes/default/Display.template.phpFind:
// Is karma display enabled? Total or +/-?
Add Before:
// 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.phpFind:
// Only show the email address fully if it's not hidden - and we reveal the email.
Add Before:
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.phpFind (at the end of the file):
?>
Add Before:
$txt['topics_per_day'] = 'per day';
$txt['topicp'] = 'Topics';
$txt['topicsmb'] = 'Topics';
$txt['topiccount'] = 'Topics';
Codedbinstall.php