Count unread replies on index

Started by Rudolf, May 18, 2007, 08:36:50 PM

Previous topic - Next topic

Rudolf

There's one very small change in the index.template.php file.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Mick.

Quote from: Rudolf on August 30, 2007, 04:44:46 AM
There's one very small change in the index.template.php file.

Could you be more specific?    How is this done? What lines? etc.

bassbass

let me help you BlueDevil, here is a clear explanation.

1. you go over there, then
2. change the php file

what!!! i am not clear enough?

I really appreciate the mod people but for God's sake be more specific , not all of us now code terminologies but we can follow instructions.  Again i really appreciate you guys but please remember, you are not talking to developers, only users.

With best intensions,
Bass

MinasC

i run smf 1.1.3 and the mod shows me 10 unread but when i click on the link it shows me that there is none unread (in the recent posts block though i can see there are 10 unread) ! why does it only tells me but not show me when clicked ?

thnx a lot !

AndreasT

Quote from: MinasC on October 31, 2007, 09:47:40 AM
i run smf 1.1.3 and the mod shows me 10 unread but when i click on the link it shows me that there is none unread (in the recent posts block though i can see there are 10 unread) ! why does it only tells me but not show me when clicked ?


I have this issue too with SMF 1.1.4. Any help would be appreciated.

Using Black-n-black theme.

Cheers,

Andreas

MinasC

i hope there is still support in this mod cause i see that Rudolf hasn't posted here since august !

fals

Thanks for this MOD..... great !
Havent found an impact on performance yet, and theres about 300 new post on my forum daily.... will keep on eye on it ;-)






500fan.dk - SMF 2.0 ~ custom theme
ls-forum.dk - SMF 2.0.2 ~ custom theme and custom iPhone theme

modera

Please tell version 1,1 for today last? If is not present, share changes which have collected. Mod simply super.

Alpay

Hi Rudolf   ;
  do you thinkin adaptation for modification on smf version 2.0 beta 3 ?

bassbass

great mod, but i had to un-install it because it was slowing down my forum like the author stated!

FireFreezer

german translation:

<!-- German -->
<file name="$themedir/languages/Modifications.german.php">
<operation>
<search position="end" />
<add><![CDATA[
// Count unread replies on index MOD - Start
$txt['unread_since_visit1'] = '%s ungelesene Beiträge seit Deinem letzten Besuch.';
$txt['show_unread_replies1'] = '%s ungelesene Antworten auf Deine Beiträge.';
// Count unread replies on index MOD - End
]]></add>
</operation>
</file>

<!-- German utf8-->
<file name="$themedir/languages/Modifications.german-utf8.php">
<operation>
<search position="end" />
<add><![CDATA[
// Count unread replies on index MOD - Start
$txt['unread_since_visit1'] = '%s ungelesene Beitr&auml;ge seit Deinem letzten Besuch.';
$txt['show_unread_replies1'] = '%s ungelesene Antworten auf Deine Beitr&auml;ge.';
// Count unread replies on index MOD - End
]]></add>
</operation>
</file>


greetz & thx for your mod :-)

Max22

Someone has tried this mod with a great difference of performance?

my evil twin

did anyone get this to work with 2.0 (rc1)?

jossanaijr

Hi Rudolf,
are you going to update this mod?

aw06

:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

shadow82x

It should work fine on SMF1.1.10, yes.
Colin B
Former Spammer, Customize, & Support Team Member

WilK

#36
If anyone needs, with a little bit help from Arantor I managed to convert mod to work with SMF 2.0

It's not fully tested, so if you run across some bugs and errors please PM me, I will try to fix them.

//Count unread replies on index MOD- Start
    $user_info['unread_topics'] = 0;
    $user_info['unread_replies'] = 0;
    //Only count for members, and those who can see at least one board
    if (!$user_info['is_guest'] && !empty($user_info['query_wanna_see_board']))
    {
            $request = $smcFunc['db_query']('', '
                SELECT MIN(lmr.id_msg), member_groups
                FROM {db_prefix}boards AS b
                    LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:id_member})
                WHERE {query_wanna_see_board}',
                array(
                    'id_member' => $id_member,
                )
            );
        list ($earliest_msg) = $smcFunc['db_fetch_row']($request);
        $smcFunc['db_free_result']($request);

        // This is needed in case of topics marked unread.
        if (empty($earliest_msg))
          $earliest_msg = 0;
        else
        {
            // This query is pretty slow, but it's needed to ensure nothing crucial is ignored.
            $request = $smcFunc['db_query']('', '
                SELECT MIN(id_msg)
                FROM {db_prefix}log_topics
                WHERE id_member = {int:id_member}',
array(
'id_member' => $id_member,
)
);
            list ($earliest_msg2) = $smcFunc['db_fetch_row']($request);
            $smcFunc['db_free_result']($request);

            if ($earliest_msg2 == 0)
                $earliest_msg2 = -1;
            $earliest_msg = min($earliest_msg2, $earliest_msg);
        }


        //Select the boards to choose from... all
        $request = $smcFunc['db_query']('', '
            SELECT b.id_board
            FROM {db_prefix}boards AS b
            WHERE {query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
                AND b.id_board != ' . (int) $modSettings['recycle_board'] : ''));
        $boards = array();
        while ($row = $smcFunc['db_fetch_assoc']($request))
            $boards[] = $row['id_board'];
        $smcFunc['db_free_result']($request);

        if (empty($boards))
          fatal_lang_error('error_no_boards_selected');

        $query_this_board = 'id_board IN (' . implode(', ', $boards) . ')';

        //Count unread topics
        $request = $smcFunc['db_query']('', '
            SELECT COUNT(*)
           FROM {db_prefix}boards AS b
                LEFT JOIN {db_prefix}topics AS t ON (b.id_board = t.id_board)
                LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:id_member})
                LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = {int:id_member})
            WHERE {query_see_board}
                AND t.id_last_msg > {int:earliest_msg}
                AND IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) < t.id_last_msg',
            array(
'earliest_msg' => $earliest_msg,
                'id_member' => $id_member,
                'query_see_board' => $query_this_board,
                )
             );
        list ($user_info['unread_topics']) = $smcFunc['db_fetch_row']($request);
        $smcFunc['db_free_result']($request);

//Count unread replies
        $request = $smcFunc['db_query']('', '
            SELECT COUNT(DISTINCT t.id_topic)
            FROM ({db_prefix}boards AS b, {db_prefix}messages AS m)
                LEFT JOIN {db_prefix}topics AS t ON (b.id_board = t.id_board)
                LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:id_member})
                LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = {int:id_member})
            WHERE {query_see_board}
                AND m.id_topic = t.id_topic
                AND m.id_member = {int:id_member}
                AND IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) < t.id_last_msg',
            array(
                'id_member' => $id_member,
                'query_see_board' => $query_this_board,
                )
            );
        list ($user_info['unread_replies']) = $smcFunc['db_fetch_row']($request);
        $smcFunc['db_free_result']($request);
    }
//Count unread replies on index MOD- End
Per aspera ad astra

cruizzer

Coud it be that your code for 2.0 does count the all unread posts and not the "unread posts since last visit"?

WilK

Per aspera ad astra

Boxer2

This mod doesnt work with 2.0 RC2 ??? When i install it manually into default theme  it makes blank screen and forum doesnt work at all... :(
SMF je zakon a zakon se mora poštivati.

www.alfisti.hr

Advertisement: