vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   How many threads and posts since your last visit! (https://vborg.vbsupport.ru/showthread.php?t=59583)

Gary King 01-02-2004 10:00 PM

How many threads and posts since your last visit!
 
PLEASE CLICK ON THE INSTALL BUTTON IF YOU INSTALLED THIS! THANKS!

What does this hack do?

This hack basically shows the number of new threads and posts since your last visit, in the navbar (under your nick.) Check out the attached screenshot for more information :)

Installation
This is a pretty simple hack to install.
Instructions are as follows:

FILE MODIFICATIONS
global.php

TEMPLATE MODIFICATIONS
navbar

PHRASES
navbar_sincelastvisit

OPEN global.php AND FIND
PHP Code:

    echo "End call of global.php:  $aftertime\n"
    echo 
"\n<hr />\n\n"


(NOTE: If you want old threads with new posts to count as a new thread, then skip this next step)
UNDER IT, ADD
PHP Code:

# SINCE YOUR LAST VISIT 
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM ".TABLE_PREFIX."thread WHERE lastpost > '".$bbuserinfo['lastvisit']."'"); 
$getnewpost=$DB_site->query_first("SELECT COUNT(*) AS posts FROM ".TABLE_PREFIX."post WHERE dateline > '".$bbuserinfo['lastvisit']."'"); 

(NOTE: If you did the step above, then skip this next step)

UNDER IT, ADD
PHP Code:

# SINCE YOUR LAST VISIT 
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM ".TABLE_PREFIX."thread WHERE dateline > '".$bbuserinfo['lastvisit']."'"); 
$getnewpost=$DB_site->query_first("SELECT COUNT(*) AS posts FROM ".TABLE_PREFIX."post WHERE dateline > '".$bbuserinfo['lastvisit']."'"); 

OPEN UP THE navbar TEMPLATE AND FIND
HTML Code:

<if condition="$show['pmstats']"><br /><phrase 1="$vbphrase[unread_x_nav_compiled]" 2="$vbphrase[total_x_nav_compiled]" 3="$session[sessionurl]">$vbphrase[private_messages_nav]</phrase></if>
UNDER IT, ADD
HTML Code:

<br /><phrase 1="$getnewthread[threads]" 2="$getnewpost[posts]" />$vbphrase[navbar_sincelastvisit]</phrase>
CREATE NEW PHRASE CALLED navbar_sincelastvisit
WITH THE FOLLOWING CONTENT:
Code:

There have been {1} threads and {2} posts since your last visit!
THE HACK IS NOW INSTALLED, ENJOY!

Screenshots

Attached :)

Gio Takahashi 01-03-2004 05:24 PM

Hmmm might actually do this one.

MGM 01-03-2004 05:36 PM

good job man, thanks for the hack!

*clicks install*

MGM out

Gio Takahashi 01-03-2004 05:40 PM

Installed, works smoothly.

Dan 01-03-2004 05:42 PM

nice one this will help with making a custom Welcome panel :D

assassingod 01-03-2004 06:09 PM

Shame I didn't get to release my version that I did ages ago:(

The Keeper 01-03-2004 06:26 PM

Does it actually show new threads, or will a thread show as new if there is a new post in it?

Gary King 01-03-2004 06:34 PM

Both.

DCX 01-03-2004 07:44 PM

i'm new to vb and i wanna try to add hacks and stuff to my board. i found the global.php file on the server but i couldn't find the navbar template file. to make things easier for me, is there a site or list somewhere showing where all the files are installed into which folder or whatever? oh yeah, will this work for vb3 gamma?

SnowBot 01-03-2004 08:03 PM

Quote:

Originally Posted by DCX
i'm new to vb and i wanna try to add hacks and stuff to my board. i found the global.php file on the server but i couldn't find the navbar template file. to make things easier for me, is there a site or list somewhere showing where all the files are installed into which folder or whatever? oh yeah, will this work for vb3 gamma?

the templates are located in your admin control panel under

Style Manager

in the dropdown menu click edit templates and you will see them all

good luck :)

Link14716 01-03-2004 08:48 PM

Installed to phpinclude_start.

Thanks. :)

The Keeper 01-03-2004 09:06 PM

Quote:

Originally Posted by Gary W
Both.

Wouldn't it be better to have it so that new threads only showed up when there actually were new threads? You could do that by selecting the id from thread table where createdate is newer than last visit.

SELECT threadid FROM thread WHERE dateline > $pmlastvisit

Or something like that.

macshrine 01-03-2004 11:13 PM

really easy to install!! great mod, i installed it at www.macshrine.com/forums/index.php

thanks alot :)

Gary King 01-04-2004 03:17 AM

Quote:

Originally Posted by DCX
i'm new to vb and i wanna try to add hacks and stuff to my board. i found the global.php file on the server but i couldn't find the navbar template file. to make things easier for me, is there a site or list somewhere showing where all the files are installed into which folder or whatever? oh yeah, will this work for vb3 gamma?

Yep it should work with vB 3 Gamma, you can try anyways, it's a very quick install and uninstall if required :)

Littlebit 01-04-2004 02:52 PM

installed :) thanks for the mod Gary

Bernd Glasstett 01-04-2004 05:11 PM

I added something to it, phrases to be exact.

Enter the following phrases on GLOBAL:

home_sincelastvisit = since your last visit
home_newthreadssincelastvisit = new threads
home_newpostsssincelastvisit = new posts

and then use this code in the navbar-template:

Code:

<br /><b>$getnewthread[threads]</b> $vbphrase[home_newthreadssincelastvisit], <b>$getnewpost[posts]</b> $vbphrase[home_newpostsssincelastvisit] $vbphrase[home_sincelastvisit]
For the ones who would like to translate it ;)

Link14716 01-04-2004 05:16 PM

All you need is one phrase.

Just call it "home_sincelastvisit"
"There have been {1} threads and {2} posts since your last visit!"

Then use this in navbar:
Code:

<phrase 1="$getnewthread[threads]" 2="$getnewpost[posts]" />$vbphrase[home_sincelastvisit]</phrase>

Bernd Glasstett 01-04-2004 05:19 PM

true... I still have to get used to some things on the new system. Thanks Link :)

ogden2k 01-04-2004 09:23 PM

Which one do I use if I don't want the thread count to go up if someone posts into a thread?

SmEdD 01-05-2004 12:23 AM

This is also possible to be done in one query instead of two.

And you should also give credit to the orignal author for the vb2 one as the query has barley changed.

squawell 01-05-2004 12:40 AM

Quote:

Originally Posted by Link14716
All you need is one phrase.

Just call it "home_sincelastvisit"
"There have been {1} threads and {2} posts since your last visit!"

Then use this in navbar:
Code:

<phrase 1="$getnewthread[threads]" 2="$getnewpost[posts]" />$vbphrase[home_sincelastvisit]</phrase>

thats a good infomation to me

Thankz Link:D

Gary King 01-05-2004 07:34 PM

Okay I'll be integrating all this new information into the next version of this hack, so stay tooned! :D

Gary King 01-05-2004 07:59 PM

Quote:

Originally Posted by SmEdD
This is also possible to be done in one query instead of two.

And you should also give credit to the orignal author for the vb2 one as the query has barley changed.

How will I make it into one query, why don't you just post the one query so I can use that instead :)

Gary King 01-05-2004 08:08 PM

Okay the instructions have been updated slightly to be able to incorporate the phrases feature of vB 3. This update is strictly optional, so you do not have to install it, but if you want to have this hack in a different language, then you can install the hack with the updated instructions :)

Thanks to Bernd Glasstett for the idea of using phrases and Link14716 because I'm actually using the phrases that he suggested :p

NTLDR 01-05-2004 08:41 PM

Quote:

Originally Posted by Gary W
How will I make it into one query, why don't you just post the one query so I can use that instead :)

It can easily be done with one query. My version in vBindex 3 which uses origional code only uses one query for new threads, posts and updated subscribed threads.

DCX 01-06-2004 08:09 AM

ok, i'm really stupid.... i just managed to upgrade to rc2 myself with no prior experience and it worked out good. i didn't install this hack into it yet cause i was probably going to upgrade first. now i did look for the global.php file and found it in the admincp folder but i couldn't find this text:

******************************

OPEN global.php AND FIND

******************************

echo "End call of global.php: $aftertime\n";

echo "\n<hr />\n\n";

and i looked in the same directory and i looked in the templates folder and i couldn't find this text either:

<if condition="$show['pmstats']"><br /><a

href="private.php?$session[sessionurl]">$vbphrase[private_messages]</a>: $vbphrase[unread] <if

condition="$bbuserinfo['pmunread']"><strong>$bbuserinfo[pmunread]</strong><else

/>$bbuserinfo[pmunread]</if>, $vbphrase[total] $bbuserinfo[pmtotal].</if>

can someone give me step by step where everything is and how it's done. thanks a lot.

corsacrazy 01-06-2004 08:51 AM

i put it here so its easier for users to understand :)

ogden2k 01-06-2004 03:03 PM

Quote:

Originally Posted by corsacrazy
i put it here so its easier for users to understand :)

Good idea.

Which one do I use if I don't want the thread count to go up if someone posts into a thread?

corsacrazy 01-06-2004 07:06 PM

just use the second query

Gary King 01-06-2004 07:36 PM

Quote:

Originally Posted by NTLDR
It can easily be done with one query. My version in vBindex 3 which uses origional code only uses one query for new threads, posts and updated subscribed threads.

Okay I never meant said that it's impossible, and I never had something like "if you're good enough then show me the query" :)

I just asked for the query, instead of just saying it's possible to do in one query :)

Also, I can't seem to find the COUNT() function in your code?

NTLDR 01-06-2004 09:17 PM

There is no COUNT() because that wouldn't do the job ;) I use a totally different method in order to get the three sets of data I need from just the one query, which with testing on a usual new post/thread count seems equally as fast as two queries.

Remember also thats more queries can sometimes be better and quicker.

Gary King 01-06-2004 11:14 PM

Quote:

Originally Posted by NTLDR
There is no COUNT() because that wouldn't do the job ;) I use a totally different method in order to get the three sets of data I need from just the one query, which with testing on a usual new post/thread count seems equally as fast as two queries.

Remember also thats more queries can sometimes be better and quicker.

I know, that's why I've left it at 2 queries (for now anyways, until I find time to test the different queries I could use and their speeds :D)

gmarik 01-08-2004 05:42 PM

Yours hacks are used rather often!

Linear Helix 01-08-2004 11:41 PM

Is it just me, or will this let people who have no access to a certain forum realize that a new post has been made even if they can't check it?

I make a post in my Central Command, some registered user sees that the posts since last visit went up by 1, even though he has no permission to view the post.

Anybody know a way to fix this? Check for permission somehow in or after the query?

DanGarion 01-09-2004 09:09 PM

Am I the only person that has no idea where to find the hack installer listed in the txt? installer.php?

:/

NTLDR 01-09-2004 09:14 PM

I think Gary W made an error, I don't think you need to run an installer with this hack, just make the changes listed :)

corsacrazy 01-09-2004 09:27 PM

LOL its just one file edit, like a mini mod

DanGarion 01-09-2004 09:39 PM

Yeah I figured it was just a accident. I got it working, now I'm working on trying out vbIndex and eventually replacing vbportal when I switch to 3.0. I got to post on the vbindex topic about an error I'm getting there now :)

DCX 01-10-2004 01:35 AM

i really want this hack on my forum but when i try to look in the global.php file, i cannot find those commands listed anywhere on that file. i did a search on the global.php file and i can't find anywhere it says echo or anything. and i'm not sure if the navbar template file is the same as the template file in the admincp directory or not.... can someone please help? thanks.

PranK 01-10-2004 11:39 AM

/me clicks install

Thanks mate!

Christian


All times are GMT. The time now is 04:45 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01481 seconds
  • Memory Usage 1,838KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_html_printable
  • (3)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete