Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: NanoSector on May 19, 2012, 02:46:19 PM

Title: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Post by: NanoSector on May 19, 2012, 02:46:19 PM
This removes the Read counter from topic view and removes the Read columns from various lists and headers.
This package was made with the Curve theme in mind. It may not work correctly in other themes, nor will be updated to do so.

E.g. it replaces:
QuoteTopic: xxx (Read # times)

With just:
QuoteTopic: xxx
In the topic view.

Changelog
v0.2
+ Remove the count from the message index, thanks to CreativeITWorld.com :)

v0.3
+ Remove the Views column from the message index.

v0.4
+ Remove the Views column from the Unread Posts and Updated Topics pages, thanks to NewMoon :)

Package attached for easy install. Compatible with SMF 2.0.x.
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: NanoSector on July 09, 2012, 07:35:00 AM
Also works in 2.1 Alpha as of now, for anyone interested.

Does anybody need to remove the counts from the topic index, too?
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: Mstcool on July 14, 2012, 11:28:52 PM
You should submit this to the mod site
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: Antechinus on July 15, 2012, 12:08:46 AM
Quote from: Yoshi2889 on July 09, 2012, 07:35:00 AM
Also works in 2.1 Alpha as of now, for anyone interested.

Does anybody need to remove the counts from the topic index, too?

If you have the participation column enabled:

.topic_table .table_grid thead tr td:nth-child(3), .topic_table .table_grid tbody tr td:nth-child(4)
{
    display: none;
}


If you have the participation column disabled:

.topic_table .table_grid thead tr td:nth-child(3), .topic_table .table_grid tbody tr td:nth-child(3)
{
    display: none;
}


:D
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: bigredinsider on July 15, 2012, 01:29:22 AM
Got an error message when installing:

"Error in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF."



ok to continue?
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: Mstcool on July 15, 2012, 02:19:54 AM
You can continue but make sure you back up your database and forum before clicking continue :P
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: NanoSector on July 15, 2012, 05:20:19 AM
Quote from: Mstcool on July 14, 2012, 11:28:52 PM
You should put this in the mod site
if not can i post it and give all credits to u? i never made one and i just want to post one without making it

Ill give all credits to u :)
Thank you for the offer Mstcool, but I think this is just a little too small for being in the mod site (my Lock Recycled Topics mod already was too small methinks, lol)
I will submit it though, if people want me to do that, heh.
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: Mstcool on July 15, 2012, 07:58:43 PM
Oh ok :)
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: ocmdiaz714 on September 03, 2012, 03:36:24 AM
Any idea on how can I change "Read 1 times" to "Read 1 time"? And have it change to "times" once there's at least 2 views? Thanks.
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: NanoSector on September 05, 2012, 01:39:29 AM
Quote from: ocmdiaz714 on September 03, 2012, 03:36:24 AM
Any idea on how can I change "Read 1 times" to "Read 1 time"? And have it change to "times" once there's at least 2 views? Thanks.
Sorry, I have no idea how to perform that. :(
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: Tony Reid on September 05, 2012, 03:48:13 AM
not looked at the mod and dont need it - but for Yoshi - an example on doing something like that would be to use a conditional, something like....


echo 'total $hit '   . ($hit== 1 ? 'hit' : 'hits');




Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: NanoSector on September 05, 2012, 09:34:19 AM
Quote from: Tony Reid on September 05, 2012, 03:48:13 AM
not looked at the mod and dont need it - but for Yoshi - an example on doing something like that would be to use a conditional, something like....


echo 'total $hit '   . ($hit== 1 ? 'hit' : 'hits');





I know how to do it, but I have no idea where it is set. (language files 'course but where in the sources)
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: Tony Reid on September 05, 2012, 09:36:59 AM
Hmmm.. maybe just use substr to trim the S off the existing language string and then add an 's' in the conditional.

Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: tommoty on September 09, 2012, 07:42:57 AM
 :D :D
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: CreativeITWorld.com on October 24, 2012, 10:23:20 PM
A handy little hack and just what I was looking for, except that I wanted a little more ... but thanks to your efforts, I started looking around for myself and added this little portion to your coding.

        <file name="$themedir/MessageIndex.template.php">
                <operation>
                        <search position="replace"><![CDATA[<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>]]></search>
                        <add><![CDATA[<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
</td>]]></add>
</operation>
        </file>


I hope it's of use to you and you can add this mod along with the rest of the mods.
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view
Post by: NanoSector on December 20, 2012, 03:19:18 AM
Quote from: CreativeITWorld.com on October 24, 2012, 10:23:20 PM
A handy little hack and just what I was looking for, except that I wanted a little more ... but thanks to your efforts, I started looking around for myself and added this little portion to your coding.

        <file name="$themedir/MessageIndex.template.php">
                <operation>
                        <search position="replace"><![CDATA[<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>]]></search>
                        <add><![CDATA[<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
</td>]]></add>
</operation>
        </file>


I hope it's of use to you and you can add this mod along with the rest of the mods.
Thanks CreativeITWorld, and sorry for my late reply.
I will add this in the mod today. First got school however so it's gonna take some time :)
Thanks!
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view *UPDATED*
Post by: NanoSector on December 21, 2012, 09:34:20 AM
Updated the mod, thanks again CreativeITWorld.com :)
Title: Re: [Hack/SMF 2.0.2] Remove "Read xx times" from topic view *UPDATED*
Post by: NanoSector on December 25, 2012, 05:06:26 PM
Updated again, now is compiled with my Mod Creator and also removes the Views header and sorting method.
Title: Re: [Hack/SMF 2.0.3] Remove "Read xx times" from topic view *UPDATED*
Post by: NewMoon on December 31, 2014, 08:28:18 PM
Thanks so much for this mod!  Worked like a charm!

I discovered that one of the template (Recent.template.php) that shows unread posts since last visit, wasn't included.  I modified your file and installed it on my forum.  Works great!

Feel free to add it to your official install file for others to use as well.  Happy New Year! :)

    <file name="$themedir/Recent.template.php">
        <operation>
            <search position="replace"><![CDATA[<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>]]></search>
            <add><![CDATA[<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' ', $txt['replies'], '
</td>]]></add>
        </operation>
    </file>
Title: Re: [Hack/SMF 2.0.3] Remove "Read xx times" from topic view *UPDATED*
Post by: NanoSector on January 01, 2015, 05:21:10 PM
Thanks NewMoon, happy new year to you too! :)

I'll add it to the package in a minute. I've also wrapped your code in [code][/code] tags in your post, so it's more easily readable.

Thanks again!
Title: Re: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Post by: NewMoon on January 02, 2015, 04:58:03 PM
Quote from: NanoSector on January 01, 2015, 05:21:10 PM
Thanks NewMoon, happy new year to you too! :)

I'll add it to the package in a minute. I've also wrapped your code in [code][/code] tags in your post, so it's more easily readable.

Thanks again!

Thanks for fixing formatting in my post! :)

Also, I noticed another place where the View count is displayed but can't figure out the template.  It's the "Show new replies to your posts" page.  Any idea?
Title: Re: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Post by: NanoSector on January 02, 2015, 05:18:46 PM
That's the same Recent.template.php file. It s hould be in another function in that same file.
Title: Re: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Post by: NewMoon on January 02, 2015, 06:46:34 PM
The code is in two places in the template, but the search/replace should have taken care of it, I think, since it's identical.  I'm not familiar with SMF code or MODs so this is just me guessing.
Title: Re: [Hack/SMF 2.0.x] Remove "Read xx times" from topic view *UPDATED*
Post by: NanoSector on January 02, 2015, 06:47:22 PM
The package manager only runs each operation once, then moves on to the next operation. I think it should be defined twice.
Will take care of  this later.