News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Topic Count On Display

Started by Yağız..., January 20, 2008, 11:03:58 PM

Previous topic - Next topic

Yağız...

Link to Mod

Topic Count On Display
[Created by Blue Dream(a.k.a [SiNaN]) - Maintained and converted to SMF 2.0 by Yağız...]

This modification adds a topic count field to the profiles.
In,
-message display
-profile summary
-profile stats
-memberlist
-stats
it shows the topic count for each member.

Also you can change the number of topics of a members
from their profile, as the post count.

When you install the package, go to:

Admin >> Forum Maintenance >> Recount all forum totals and statistics. (for 1.1.x)
Admin >> Forum Maintenance >> Routine >> Recount all forum totals and statistics (for 2.0 RC1)

By this feature, you can recount the topic counts also.
Once you recount the topic counts, from that time, when;
-Member creates a topic it increase
-Member's topic is erased it decrease
-Members' topic is split it increase each members'
-Members' topics are merged it decrease each members'
topic count(s).

By the addition of topics field, we could get rid of useless db queries.
You can use the field wherever loadMemberContext function is run for member.

If you have enabled Advanced Profile Fields, you can disable showing topic counts in Admin >> Features and Options >> Profile Fields.
[SiNaN]

Yağız...

Finally, it's approved :)
Thank for the mod Bab-i Esrar ;)

[SiNaN]

Me too, had been glad that it's approved. Thanks for team. 2 new modifications coming, soon...
Former SMF Core Developer | My Mods | SimplePortal

Badboy

#3
Thx for the mod nice work ;)

You can made a little modification to show the topics count in members profile summary. (I did it manually in my site).

And topics count can be changed by admin (i mean manually) in profile like posts count(I did it manually in my site)

And i think u have to made another function to calculate the topics count on forum manintance. I mean it can be seperated from the "Admin >> Forum Maintenance >> Recount all forum totals and statistics" function.

Edit: When we use Recount all forum totals and statistics the topics in recycle are not ignored. I think the topics which were in recycle must be ignored.(I fixed it in my site)

Thx
Nothing is true, everything is permitted.

Apllicmz




ne.miguelito

Quote from: Badboy on January 23, 2008, 04:17:37 AM

And topics count can be changed by admin (i mean manually) in profile like posts count(I did it manually in my site)

Edit: When we use Recount all forum totals and statistics the topics in recycle are not ignored. I think the topics which were in recycle must be ignored.(I fixed it in my site)

Thx


You could say how it proceeded?

SgtMic

I just installed this and ran the recount in forum maintenance. Should I see anything different? I'm not seeing anything that stands out different.
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

SgtMic

There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Badboy

Quote from: ne.miguelito on January 23, 2008, 02:50:01 PMYou could say how it proceeded?

Pls install the original mod first. Then

NOTE: Don't forget to backup your files ;)

1) To fix that When we use Recount all forum totals and statistics the topics in recycle are not ignored.

Open Sources/Admin.php
Code (FIND) Select
WHERE t.ID_BOARD = b.ID_BOARD
AND b.countPosts = 0


Code (REPLACE) Select
WHERE t.ID_BOARD = b.ID_BOARD
AND b.countPosts = 0" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
AND t.ID_BOARD != " . (int) $modSettings['recycle_board'] : '') . "





2) To make the topics count can be changed by admin (i mean manually) in profile like posts count.

Open Sources/Profile.php
Code (FIND) Select
// Change the number of posts.
if (isset($_POST['posts']) && allowedTo('moderate_forum'))
$profile_vars['posts'] = $_POST['posts'] != '' ? (int) strtr($_POST['posts'], array(',' => '', '.' => '', ' ' => '')) : '\'\'';


Code (REPLACE) Select
// Change the number of posts.
if (isset($_POST['posts']) && allowedTo('moderate_forum'))
$profile_vars['posts'] = $_POST['posts'] != '' ? (int) strtr($_POST['posts'], array(',' => '', '.' => '', ' ' => '')) : '\'\'';

// Change the number of topics.
if (isset($_POST['topics']) && allowedTo('moderate_forum'))
$profile_vars['topics'] = $_POST['topics'] != '' ? (int) strtr($_POST['topics'], array(',' => '', '.' => '', ' ' => '')) : '\'\'';


Open Themes/default/Profile.template.php
Code (FIND) Select
<tr>
<td><b>', $txt[86], ': </b></td>
<td><input type="text" name="posts" size="4" value="', $context['member']['posts'], '" /></td>
</tr>';


Code (REPLACE) Select
<tr>
<td><b>', $txt[86], ': </b></td>
<td><input type="text" name="posts" size="4" value="', $context['member']['posts'], '" /></td>
</tr>
<tr>
<td><b>', $txt['topiccount'], ': </b></td>
<td><input type="text" name="topics" size="4" value="', $context['member']['topics'], '" /></td>
</tr>';





3) To show the topics count in members profile summary.

Open Themes/default/Profile.template.php
Code (FIND) Select
<tr>
<td><b>', $txt[86], ': </b></td>
<td>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</td>
</tr><tr>


Code (REPLACE) Select
<tr>
<td><b>', $txt[86], ': </b></td>
<td>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</td>
</tr><tr>
<td><b>', $txt['topiccount'], ': </b></td>
<td>', $context['member']['topics'], '</td>
</tr><tr>
Nothing is true, everything is permitted.

SgtMic

^ I'll have to give that a try. Cool.
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

ne.miguelito


[SiNaN]

I was planning to make some additions too. I will fix them also, thanks Badboy. Upgrade will be given soon.
Former SMF Core Developer | My Mods | SimplePortal

SgtMic

On a test site of mine, I installed the Topic_Count_on_display mod. Installed fine. Decided to just wipe the majority of the forum to start from scratch. It's a test site. :)

So now when I go to reinstall this mod via package manager, I get this:

Duplicate column name 'topics'
File: /home/fastsqua/public_html/sgtmic.com/smf/Packages/temp/Topic_Count_On_Display/Topic_Count_On_Display/dbinstall.php
Line: 12
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Badboy

You must uninstall the mod first. Because Topic_Count_on_display mod makes some changes on database. And when you try to reinstall it again without uninstall, the mod will want to change the database again. So it will give this error because there is also a column named "topics" ;)
Nothing is true, everything is permitted.

SgtMic

Since it's too late to uninstall, what can I do to fix this?
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Badboy

Is Topic_Count_on_display mod listed in installed packages list?
Nothing is true, everything is permitted.

SgtMic

There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Badboy

Ok. Now pls install the mod (attached file)(Topic_Count_On_Display_Uninstall_db.zip) which will uninstall the database changes. After that delete this mod from the installed packages list. Then install the original mod.
Nothing is true, everything is permitted.

SgtMic

It definitely deletes the database. I accidently used it on a working forum. *Note to self, don't work on forums when tired* Since I did that, it won't allow me to uninstall the mod. So I had to replace the code in load.php back to default and the forums are working again. I'll have to work on this new problem later.



There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

SgtMic

OK, ran the uninstall on the test site. What it did was automatically installed the original mod. Which is not working correctly. I use sorted package manager mod. The original file was in the not installed section. Now it shows in the installed section.

When I go to uninstall the mod, I get this:
Uninstall Actions "TopicCountOnDispla":
Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    ./Themes/default/languages/index.english.php    Test failed
2.    Execute Modification    ./Themes/default/languages/index.turkish.php    Skipping file
3.    Execute Modification    ./Sources/Load.php    Test failed
4.    Execute Modification    ./Sources/Profile.php    Test failed
5.    Execute Modification    ./Sources/RemoveTopic.php    Test failed
6.    Execute Modification    ./Sources/SplitTopics.php    Test failed
7.    Execute Modification    ./Sources/Subs-Post.php    Test failed
8.    Execute Modification    ./Themes/default/Display.template.php    Test failed
9.    Execute Modification    ./Sources/Admin.php    Test failed
10.    Execute Code    dbuninstall.php    

When I click on uninstall anyways, I get this:
Database Error
Can't DROP 'topics'; check that column/key exists
File: /home/fastsqua/public_html/sgtmic.com/smf/Packages/temp/Topic_Count_On_Display/Topic_Count_On_Display/dbuninstall.php
Line: 11
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Advertisement: