PDA

View Full Version : Since Your Last Visit!


MrLister
10-31-2001, 10:00 PM
Somebody here request it so I made it quickly.... Basically this hack here tells your users how many new posts and threads there have been since hteir last visit on the main page.

An example is https://vborg.vbsupport.ru and right under your username.

INSTRUCTIONS:
Inside index.php (not admin) find:
// if user is know, then welcome
right under it add:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");


In the template forumhome_welcometext find:
Welcome back, <b>$bbuserinfo[username]</b>
right under it add:
<br>There have been <b>$getnewthread[threads]</b> threads and <b>$getnewpost[posts]</b> posts since your last visit!


That's it! If you installed the hack please click the install button!

atrl
11-01-2001, 12:52 AM
Thanks Very Much!

Neo
11-01-2001, 01:00 AM
thank you for another great hack

|DarkManX|
11-01-2001, 03:12 AM
getting this error with 2.2

Database error in vBulletin 2.2.0:

Invalid SQL: SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '1004590373
mysql error: You have an error in your SQL syntax near ''1004590373' at line 1

mysql error number: 1064

Date: Thursday 01st of November 2001 12:10:23 AM
Script: http://www.partylounge.net/tof/tof/index.php?
Referer:



don't get what i did wrong....

MrLister
11-01-2001, 03:49 AM
yikes sorry.... add a ' after $bbuserinfo[lastvisit] or look above. i fixed it.

FWC
11-01-2001, 04:00 AM
Add a ' right before the last " in each query. You also need to add posts to the forumhome_welcometext.

MrLister
11-01-2001, 04:13 AM
yup.. it's fully fixed now.. thx
Originally posted by FWC
Add a ' right before the last " in each query. You also need to add posts to the forumhome_welcometext.

FWC
11-01-2001, 04:29 AM
Hey, I'm the first guy to click "Installed". Thanks! :)

JJR512
11-01-2001, 07:15 AM
2nd! :)

Admin
11-01-2001, 10:22 AM
Clicked it as well since I'm already using this here. :) Nice job.

eva2000
11-01-2001, 12:10 PM
cool gonna install it :D

MrLister
11-01-2001, 01:41 PM
:) hehe..... idea successfully ripped
Originally posted by FireFly
Clicked it as well since I'm already using this here. :) Nice job.

MrLister
11-01-2001, 01:42 PM
tell me how it goes on a popular board.... that's 2 extra queries on the main page.. but the queries aren't big so shouldn't be a problem
Originally posted by eva2000
cool gonna install it :D

eva2000
11-01-2001, 01:44 PM
Originally posted by MrLister
tell me how it goes on a popular board.... that's 2 extra queries on the main page.. but the queries aren't big so shouldn't be a problem
LOL i already added 16+ extra queries on teh front page from various hacks anyway before this :D

FWC
11-01-2001, 04:51 PM
Originally posted by eva2000
LOL i already added 16+ extra queries on teh front page from various hacks anyway before this :D Yeah, I have you page view counter, total thread views and a Firefly posts today query going in addition to this one. :)

JJR512
11-03-2001, 07:15 AM
This hack as it is used on this board has a grammatical error. On the front page of vbulletin.org, it says "There has been xx threads..." It should be have, as described in the instructions above. :)

Admin
11-03-2001, 07:21 AM
LOL, thanks Justin. :)

|DarkManX|
11-04-2001, 02:09 PM
thanks for this hack....:)

eva2000
11-04-2001, 03:39 PM
Originally posted by JJR512
This hack as it is used on this board has a grammatical error. On the front page of vbulletin.org, it says "There has been xx threads..." It should be have, as described in the instructions above. :) :rolleyes:

JJR512
11-04-2001, 03:48 PM
Are you rolling your eyes at the fact that this mistake was made, or that I pointed it out? ;)

(If the latter...hey, I'm just trying to help make this site the best it can be, and poor grammar contributes greatly to an unprofessional image. :D)

Ifrani
11-04-2001, 06:25 PM
Is it possible, that it only count posts ? The number of posts an threads is always the same... ?!?

Lesane
11-04-2001, 06:32 PM
Thanks for the hack

Ifrani
11-05-2001, 08:50 AM
I doublecheck all changes for this hack, but it still displays only posts and it is not counting the new threads (display the same number as posts)...
Is that only my problem ???

Ifrani
11-05-2001, 05:31 PM
Ok, I find the error:

The code to insert is:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE dateline > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT COUNT(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");

Don't use the "lastpost" in the query, "dateline" works better for me :)...

Alien
11-06-2001, 01:51 PM
Installed and working, thanks a bunch! :D

Mr. X
11-09-2001, 01:57 AM
Just installed it. Thanks :)

over
11-09-2001, 08:03 PM
thnx will be adding to my board :) very useful hack

snyx
11-10-2001, 05:01 PM
whoa, works great man
JUST what the doctor ordered :D

philliplewisuk
11-11-2001, 07:29 PM
I had to remove it.

I have 300 members on my forum at most times and adding it just made it error and error!

LuBi
11-16-2001, 05:57 PM
FireFly what do I edit just to make it like yours.

>>Welcome back, user
Avatar Time Now
last vist
There have been XX posts
Click Here to view posts

Which do I edit? forumhome template itself?

Admin
11-16-2001, 06:07 PM
Basically yeah.

LuBi
11-16-2001, 07:02 PM
What does you code look like :( sorry I'm juts not having luck with this picking the right templates :confused: or anything plus I can't find the avatar code. Really I just want that on top of the forum below the normal stuff added to the table of the forum much like you have it.

LuBi
11-17-2001, 05:55 AM
After playing with it a bit I now know I have no clue what I am doing, if you get a chance go to my page and look at what I've done :( anyhow. I need to know the code for the users avatar, I'll need to find that guest avatar hack and I need to connect the fourmhome with the actual table... problem is I have no clue. If oyu could maybe walk me through it.. or post yours or something, I dunno... any help would be great as usual firefly (this begger aint choosey) ;)

Admin
11-17-2001, 03:02 PM
What is it you're trying to do, exactly?
I don't understand a word from your post LuBi.

LuBi
11-17-2001, 03:05 PM
I want to mkae a box like yours. Where the admin is, I need to understand what goes into it and the code behind it. If all that's not to much trouble.

In short, I need the code, and the templates to edit.

Lesane
11-17-2001, 03:08 PM
Firefly, is it possible that you can give a link to the new threads.

like it says:
There here have been 10 threads....

and then a link on "10" and that link shows the new 10 threads.

Cool if thats possible.

Admin
11-17-2001, 03:15 PM
Lesane, there's no link on my numbers. :confused:

LuBi, it invloves a lot of new code and templates, I can just "post it all".

Lesane
11-17-2001, 03:31 PM
hehe, i know that there is no link on your numbers :)

but i wonder if there is an way to give a link to that new threads.

It says: There here have been 10 threads....

now is it possible to add a lil hack that gives the number 10 a link and that link shows the 10 new threads.

over
11-17-2001, 05:06 PM
Originally posted by Lesane
hehe, i know that there is no link on your numbers :)

but i wonder if there is an way to give a link to that new threads.

It says: There here have been 10 threads....

now is it possible to add a lil hack that gives the number 10 a link and that link shows the 10 new threads.

vbb's own view new posts code you could edit slightly to do the job u want :)

LuBi
11-17-2001, 07:26 PM
Ok then I have an idea, tell me which things you edit and why, tell me which things you create and why. Also I just need the code for the avatar, The code for the users current avatar. Much like the one in edit options.

Thanks

Aracnakat
11-19-2001, 05:22 AM
Terrific hack .. thank you very much for making this for everyone to use!


~Kat :)

dr1
11-21-2001, 03:49 PM
Does anyone have the code to do this?

I have members that are only interested in a particular forum and would love to be able to see the newest posts for that specific forum.

Rob.

CHeeKY
11-24-2001, 01:45 PM
Nice and simple and it works thanks

trilOByte
11-26-2001, 10:12 AM
Originally posted by FireFly
Lesane, there's no link on my numbers. :confused:

LuBi, it invloves a lot of new code and templates, I can just "post it all".

Hey Firefly/MrLister thanks for the cool hacks. I've been playing around with this myself, I think I got a decent version working and I wrote it up for an admin friend as a walkthrough. I hope you don't mind, but I used your hack (fully credited of course ;)) and posted a template/hack thing. I think it's cool, and I think it's what LuBi is looking for....

here....
https://vborg.vbsupport.ru/showthread.php?s=&postid=202984#post202984

...example in sig ;)

Me2Be
11-26-2001, 08:34 PM
Hey there! Just wanted to let you know that on my small board (average 100+ users) it worked great, however, when I got it on my big board (400+ users) it dragged it down quite a bit! Those two extra queries made a big difference when index.php gets hit a ton of times :)

eva2000
11-27-2001, 12:40 PM
Originally posted by Me2Be
Hey there! Just wanted to let you know that on my small board (average 100+ users) it worked great, however, when I got it on my big board (400+ users) it dragged it down quite a bit! Those two extra queries made a big difference when index.php gets hit a ton of times :) ouch :(

seems to run nicely on my vB :)

Bimma Boy
12-26-2001, 05:05 PM
I installed this hack last night and it was working fine, I then did this..

Went into the forumhome_welcometext template and took out the user name code from it and place it in my forumhome display template (I did becuase I want it to display 'wELCOME BACK USER NAME on top line, then dispaly x new threads x new posts few lines under this)

After I did this - I refreshed and instead of saying Welcome back Admin.. it said Welcome back anothermembersname ???????

I then quickly took out the user name code from the index template and put it back in the forum home_welcometext template - things were all sound again!!

Now today.. other people are saying to me that it says Welcome back differentusername instead of their own name.. The name its displaying is from the online users lists.. Whats going on??

Thanks

mister
12-27-2001, 12:44 PM
The way it works now, this hack counts threads & posts in EVERY forum, private forums included.

Is there an easy way to not count those forums the user doesn't have access to?

Some of my users are confused, because it says 12 threads, but they're only getting 10 back (2 are in private forums).

LaNder
03-02-2002, 08:58 AM
hmm, i have the same problem :(

i had to remove this hack from my welcome-panel.

is there a chance to get a fix for it??


greets LaNder

trilOByte
03-02-2002, 01:37 PM
Originally posted by Bimma Boy
I installed this hack last night and it was working fine, I then did this..

Went into the forumhome_welcometext template and took out the user name code from it and place it in my forumhome display template (I did becuase I want it to display 'wELCOME BACK USER NAME on top line, then dispaly x new threads x new posts few lines under this)

After I did this - I refreshed and instead of saying Welcome back Admin.. it said Welcome back anothermembersname ???????

I then quickly took out the user name code from the index template and put it back in the forum home_welcometext template - things were all sound again!!

Now today.. other people are saying to me that it says Welcome back differentusername instead of their own name.. The name its displaying is from the online users lists.. Whats going on??

Thanks

Instead of using...


Welcome back, <b>$username</b>


try...


Welcome back, <b>$bbuserinfo[username]</b>

David Bott
03-19-2002, 07:40 PM
Yes...sorry to say for some reason this nice feature totally trashed my DB server. Actually pegs out my CPU's on the DB server only for it seems to have to count of something way too much. Currently 732 users on line. Upload index.php...crash! Ver 2.2.4

LamBras
03-21-2002, 03:54 PM
The load of a COUNT-Statement is far too high on busy servers.
It will delay your forumshome by several seconds (!) and put an enormous load on the poor database.
If your fora are quite busy (>100 ppl online), I would disencourage you of using this hack.

Unfortunately I am no sql Guru. There is for sure a way to form a statement less ressource intensive but I am afraid I can only critizise not help :(
Maybe anyone can jump in here?

BTW: Allthough I may sound a bit harsh here (which I am not, I hope), I really appreciate everyone releasing hacks and I know it's sometimes really a mess to deal with, so please don't feel offended :)

RCK
04-01-2002, 02:19 PM
Originally posted by mister
The way it works now, this hack counts threads & posts in EVERY forum, private forums included.

Is there an easy way to not count those forums the user doesn't have access to?

Some of my users are confused, because it says 12 threads, but they're only getting 10 back (2 are in private forums).

Easy fix, here is your solution :)
into your SQL request, use this instead of original code:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]' and forumid <> 'id of your private forum'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post,thread WHERE post.dateline > '$bbuserinfo[lastvisit]' and thread.threadid=post.threadid and thread.forumid <> 'id of your private forum'");


Of course, this is only a temp solution, and it should have to be improved for the vb3 environement.
(auto don't count for all private forum by adding a checkbox, etc...)

Okiewan
04-01-2002, 03:54 PM
Agreed.. I have at time 130-160 online at a time, it put a LARGE load on the CPU's and slowed the forums considerably. Nice hack for smaller boards though!

Frenck
04-13-2002, 10:24 PM
Just run this query once on your DB,

ALTER TABLE `post` ADD INDEX(`dateline`) ;

problem solved.

It brings back my page generation time back from 2.5 seconds to 0.5 seconds.

robcg
04-19-2002, 09:19 PM
hghghghghghgh

LamBras
06-10-2002, 08:35 AM
Hi there,
I have come back to this hack after applying tril0Byte's welcome panel hack.

And indeed, adding an index for dateline increases speed just back to normal. Great!

Hack installed :)

Austin Dea
06-10-2002, 05:13 PM
Is there a way to exclude forums from being counted?

RCK
06-10-2002, 05:19 PM
one post done by me, 5 messages upper :eek:

Austin Dea
06-11-2002, 01:11 AM
Ahh ;).

proton242
06-12-2002, 08:03 AM
good hack, thnx!!!

Limpkinw
06-13-2002, 01:45 AM
great hack!

Martin CX
07-13-2002, 07:08 PM
Originally posted by Frenck
Just run this query once on your DB,

ALTER TABLE `post` ADD INDEX(`dateline`) ;

problem solved.

It brings back my page generation time back from 2.5 seconds to 0.5 seconds. Yeah? Does this solve the problems with serverstrain? :hopeful:

santeematt
07-17-2002, 03:38 PM
nice. i installed this one a while ago but upgrading my board killed it.. i just fixed it and 'installed' ;)

Roody
08-29-2002, 01:17 PM
is there a possibility with all the changes that have occured with this hack that someone can post the actual coding that does in fact work correctly again?

Im a bit unsure after reading through these posts what to remove and what not too and having the updated changes in one spot would be nice.

Thx

Roody
09-01-2002, 12:48 AM
bumping this up to get some help on my previous post.

Illuvatar
09-08-2002, 12:35 AM
/me moves his site to new server, upgrades VB to 2.2.7 and re-installs this most excellent hack!

thanks again!

Illu

ExAvIoUr
09-12-2002, 05:53 AM
Roody (and any else who doesn't want to read through) ... in a good mood today, so I compiled the optimizations from the posts here and here it is:

:::Since Your Last Visit:::

*** optimized per the suggestions of the posts here. I also changed the text to display "There are X new thread and X new posts! ... simply b/c the other way made it seemed crowded up top. :) change it to whatever you'd like. :)


Run this query on your DB:

ALTER TABLE `post` ADD INDEX(`dateline`) ;


Edit: "index.php"

Find:

// if user is know, then welcome


Add below it:

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


Edit Template: /Forum Home Page Templates/"forumhome_welcometext"


Find:

Welcome back, <b>$bbuserinfo[username]</b>


Add below it:

<br>There are <b>$getnewthread[threads]</b> new threads and <b>$getnewpost[posts]</b> new posts!

hidjra
09-25-2002, 09:38 PM
Originally posted by ExAvIoUr
Roody (and any else who doesn't want to read through) ... in a good mood today, so I compiled the optimizations from the posts here and here it is:

:::Since Your Last Visit:::

*** optimized per the suggestions of the posts here. I also changed the text to display "There are X new thread and X new posts! ... simply b/c the other way made it seemed crowded up top. :) change it to whatever you'd like. :)


Run this query on your DB:

ALTER TABLE `post` ADD INDEX(`dateline`) ;


Edit: "index.php"

Find:

// if user is know, then welcome


Add below it:

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


Edit Template: /Forum Home Page Templates/"forumhome_welcometext"


Find:

Welcome back, <b>$bbuserinfo[username]</b>


Add below it:

<br>There are <b>$getnewthread[threads]</b> new threads and <b>$getnewpost[posts]</b> new posts!



hi, this does speed things up, but when i mark all forums read or when i log out, and log back in, it still displays new threads.

hidjra

Roody
09-28-2002, 05:16 AM
thanks for the help man. sorry if you think i wasnt reading this thread through. in fact i read it thoroughly, but after all the posts i found it a little confusing. thanks for the update though.

Roody
12-04-2002, 02:22 PM
hey everyone. i actually just created a post regarding this hack in another forum. I need help trying to get this hack to work at a member level. Basically we have members on my board who can't see all the forums yet this hack leads them to think there is posts that are viewable to them. Is there a way to make this set on a member level.

here is my other post.

Member level (https://vborg.vbsupport.ru/showthread.php?s=&postid=327938#post327938)

sebastien69
01-06-2003, 04:16 AM
yeah work great on 2.2.8

but how must i do for put the number of new thread as link under each forum descriptions

i've tried all the night but no succes for me

can you help me please????

Is it the good way for do that i explain ??

sabret00the
03-26-2003, 06:49 PM
quick question, if i wanted this to also say

there has been XX new journal entries
and XX new journal entry comments
and XX new quizzes
would you be able to tell me how?

Thomas P
02-16-2004, 05:30 PM
I'd need what Roody wants.

$getnewthread=$DB_site->(...)and forumid <> 'id of your private forum'");
$getnewpost=$DB_site->(....)and thread.forumid <> 'id of your private forum'");

Can I use several forums here?

<> '4' | '6' | '8' ?

Members see the counter rising although there are only posts in private forums, that's the point.

Thanks,
-Tom

Thomas P
03-03-2004, 01:19 PM
Can I use several forums here?

<> '4' | '6' | '8' ?

Members see the counter rising although there are only posts in private forums, that's the point.

^^^moderate bump :)