[MOD] view new posts number since last visit [1.0.0]

Recent topics, announcement display, RSS / ATOM Feed Syndication MOD Downloads
- Content delivery outside of viewtopic/viewforum.

How would you rate this mod?

Excellent!
10
67%
Very good
3
20%
Good
1
7%
Fair
1
7%
Poor
0
No votes
 
Total votes : 15

[MOD] view new posts number since last visit [1.0.0]

Postby angelside » 04 Jan 2007, 21:50

view new posts number since last visit

This is very simple modification for phpbb3.b4


Classification: Add-on
phpBB Part: header

MOD Name: view new posts number since last visit
MOD Version: 1.0.0
Author: Alexis Canver
MOD Description: This mod show "view new posts number" since last visit

Works with:
  • phpBB 3.0 BETA 4

Features:
  • show "view new posts number" since last visit

Language: English

Licence: GNU General Public License v2

Installation Level: Easy
Installation Time: 1 Minute
Format: Spoilers
Download File: (Spoilers below)

view new posts number since last visit
Spoiler:
Code: Select all
#
#-----[ OPEN ]------------------------------------------------
#

includes/functions.php

#
#-----[ FIND ]------------------------------------------------
#

   // Which timezone?
   $tz = ($user->data['user_id'] != ANONYMOUS) ? strval(doubleval($user->data['user_timezone'])) : strval(doubleval($config['board_timezone']));

#
#-----[ AFTER ADD ]-------------------------------------------
#

if( $user->data['user_id'] != ANONYMOUS )
{
   $sql = "SELECT COUNT(post_id) as total
         FROM " . POSTS_TABLE . "
         WHERE post_time >= " . $user->data['session_last_visit'];
   $result = $db->sql_query($sql);
   if( $result )
   {
      $row = $db->sql_fetchrow($result);
      $user->lang['SEARCH_NEW'] = $user->lang['SEARCH_NEW'] . " (" . $row['total'] . ")";
      
   }
}

#
#-----[ FIND ]------------------------------------------------
#

      'PRIVATE_MESSAGE_INFO_UNREAD'   => $l_privmsgs_text_unread,

#
#-----[ AFTER ADD ]-------------------------------------------
#

      'L_SEARCH_NEW'   => $user->lang['SEARCH_NEW'],

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Last edited by angelside on 06 Jan 2007, 01:56, edited 1 time in total.
phpBB3 Portal | simple portal for phpBB3 Olympus
phpBB Türkiye | Turkish phpBB community
User avatar
angelside
MOD Author
MOD Author
 
Posts: 129
Joined: 20 Jun 2006, 03:17


Re: [MOD] view new posts number since last visit [1.0.0]

Postby Handyman » 04 Jan 2007, 23:50

Hey Alexis... nice work!
Add a poll to this topic... it should be as follows:

How would you rate this mod?
  • Excellent!
  • Very good
  • Good
  • Fair
  • Poor

Thanks... and nice mod Thumbsup

~Handyman
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7454
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

Re: [MOD] view new posts number since last visit [1.0.0]

Postby angelside » 06 Jan 2007, 01:59

Thanks, I added.
phpBB3 Portal | simple portal for phpBB3 Olympus
phpBB Türkiye | Turkish phpBB community
User avatar
angelside
MOD Author
MOD Author
 
Posts: 129
Joined: 20 Jun 2006, 03:17

Re: [MOD] view new posts number since last visit [1.0.0]

Postby kuld33p » 06 Jan 2007, 12:21

good
The Revolutioners

If US government has no knowledge of aliens, then why does Title 14, Section 1211 of the Code of Federal Regulations, implemented on July 16, 1969, make it illegal for U.S. citizens to have any contact with extraterrestrials or their vehicles?
-
User avatar
kuld33p
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 118
Joined: 02 Dec 2006, 10:19
Gender: Male

Re: [MOD] view new posts number since last visit [1.0.0]

Postby LEW21 » 06 Jan 2007, 12:22

Next SQL query for so small improvement... Sorry, I will not use it.
phpBB3.PL - User-friendly Polish phpBB 3.0 support
LEW21    
Translator
Translator
 
Posts: 901
Joined: 01 Jun 2006, 03:51
Location: Warsaw, Poland
Gender: Male
phpBB Knowledge: 10

Re: [MOD] view new posts number since last visit [1.0.0]

Postby Zain » 06 Jan 2007, 12:25

it's true that it adds yet another query, but from a lot of forums I visit people see that function as 'required'. since they use it all the time. and, especially if one uses forums, i becomes highly usefull IMO, because you don't need to look through forums in order to find it Smile

and AFAIK there isn't any way to join a COUNT query, or is there? I never heard of it neway
Zain
Cadet II
Cadet II
 
Posts: 24
Joined: 06 Jan 2007, 10:55
Favorite Team: Band of the Hawks
Gender: Male

Re: [MOD] view new posts number since last visit [1.0.0]

Postby Highway of Life » 06 Jan 2007, 12:33

Use this instead...
Code: Select all
if ($user->data['is_registered'])
{
    
$sql = 'SELECT COUNT(post_id) as total
        FROM '
. POSTS_TABLE . '
        WHERE post_time >= '
. $user->data['session_last_visit'];
    
$result = $db->sql_query($sql);
    
$new_posts_count = $db->sql_fetchfield('total');
    
$db->sql_freeresult($result);
}


Then in the template assign vars:
Code: Select all
'NEW_POSTS_COUNT' => $new_posts_count,


Make sure the template has: <!-- IF S_USER_LOGGED_IN --> before using {NEW_POSTS_COUNT}

Edit: @Zain, yes, there is... I've done it joining 4 tables... what did you need it for?
Watch out! I might do a code wheelie!

User avatar
Highway of Life    
STG Jedi Master
STG Jedi Master
 
Posts: 10458
Joined: 08 May 2006, 05:23
Location: Beware of Programmers carrying screwdrivers
Gender: Male
phpBB Knowledge: 10

Re: [MOD] view new posts number since last visit [1.0.0]

Postby Zain » 06 Jan 2007, 13:16

well, Handyman said it was another query ( extra load ) but I didn't know if there is a way to inner join a COUNT query, since if it is, you can ( IMO ) easily combine it with another query
Zain
Cadet II
Cadet II
 
Posts: 24
Joined: 06 Jan 2007, 10:55
Favorite Team: Band of the Hawks
Gender: Male

Re: [MOD] view new posts number since last visit [1.0.0]

Postby Highway of Life » 06 Jan 2007, 14:26

There is no other global query calling anything that it could be combined with...

However, it's a VERY light query, and if someone is really concerned about the extra query, they could send it to the cache. (or just not use the MOD Wink )
BTW, it was Lew, not Handyman. Tongue
Watch out! I might do a code wheelie!

User avatar
Highway of Life    
STG Jedi Master
STG Jedi Master
 
Posts: 10458
Joined: 08 May 2006, 05:23
Location: Beware of Programmers carrying screwdrivers
Gender: Male
phpBB Knowledge: 10

Re: [MOD] view new posts number since last visit [1.0.0]

Postby Zain » 06 Jan 2007, 14:48

my bad my bad. quick query? maybe, maybe not. if one hasn't come in a long while.. :mrgreen:

oeh, I'm in your sig Tongue
/me should put some attention in GD
Zain
Cadet II
Cadet II
 
Posts: 24
Joined: 06 Jan 2007, 10:55
Favorite Team: Band of the Hawks
Gender: Male

Next

Return to Recent Topics, RSS / ATOM Syndication MODs

Who is online

Users browsing this forum: No registered users and 0 guests