PDA

View Full Version : [Mini-RELEASE v2] User has started X threads



tubedogg
Fri 23rd Mar '01, 1:35am
This one is a request from JJR512. It shows, in the user's publicly-accesible profile (member.php?action=getinfo), how many threads that user has started.



Hack version: 0.0.2

For version: 2.0.0 Final

Files needed: memberadd.txt, getinfoadd.txt

Files to edit: member.php

Templates to edit: getinfo

Instructions
1] Open memberadd.txt from the zip file in a text editor.

2] In member.php, find (around line 1193)

eval("\$birthday = \"".gettemplate("getinfo_birthday")."\";");
}
Directly below this, add the contents of memberadd.txt

3] Upload member.php to your web server.

4] Open getinfoadd.txt from the zip file in a text editor.

4] In the template getinfo, find


<tr bgcolor="#F1F1F1"><td>
<normalfont><B>Total Posts:</B></normalfont></td>
<td><normalfont>$userinfo[posts] ($postsperday posts per day)</normalfont>
</td></tr>

Directly below this, add the contents of the getinfoadd.txt file.

5] Save the template.

6]To test it out, go to http://path/to/your/forums/member.php?action=getinfo&userid=5

Instructions are also included in the zip file (threadsstarted.txt).

FEEDBACK WANTED! :) Likes/dislikes/modification requests all accepted. :D

Please DO NOT conact me via AIM, ICQ, PM, or email about this hack. Post your question/problem here and I will try to help you.

bira
Fri 23rd Mar '01, 1:59am
very nice :)

And it works great, heh.

By the way, one problem to anticipate with this, though, is that unlike post count, your check relies on the EXISITING threads. I.e., if someone prunes old threads and such, then the count for how many threads were started by users will be inaccurate and will only reflect how many threads of those available were started by the user :)

tubedogg
Fri 23rd Mar '01, 2:03am
Thank you, bira. :)
And you're right. However, I can't see any way around this without adding a "thread" column to the user table, similar to post, except counting threads. And that would take a more detailed hack. If anyone really wants to see this, I'll see what I can do. (I don't think it would be too hard, just more detailed.)

Thanks again. :D

JJR512
Fri 23rd Mar '01, 2:31am
Thanks! This is great. Works fine.

I only have one suggestion. In the part you add to the getinfo template, change the part that says "threads started" to "Threads Started:" (capitalize both words and add a colon). This is to match it to the style of the rest of the profile display.

Thanks for doing this for me! :)

tubedogg
Fri 23rd Mar '01, 2:32am
Dang, I thought I changed that before I uploaded it. It was that way because I was testing on my forums, and my forums are all lowercase with no :. Sorry. :)

bira
Fri 23rd Mar '01, 2:38am
tubedogg:

I don't expect you to worry about the threads issue at all, heh. I was just remarking in case someone asks.

In any case, I just made it clear in the profile that it's "threads started of the currently available threads".

See my profile for example: http://www.atlasf1.com/bb/member.php?action=getinfo&userid=1199

JJR512
Fri 23rd Mar '01, 2:39am
Ack! I posted the above message when the first, original message was all I saw (I opened this thread just after it was posted, it just took me a long time to reply...guess I should have refreshed first!).

As a comment to bira's comments...what you say is true, but consider this. After a prune or anytime messages or entire threads are deleted, a user's post count goes down. The post count only counts how many posts are in the database for that user. Now by the same token as what you said, this would seem to be unfair, because a person may have posted 1000 times but only have a count of 950 due to thread deletions or whatever. Now in UBB, the count never goes down. When I upgraded to vB, someone wrote for me a little script to actually change everyone's post count to how many posts the user actually had in the database. Because, in UBB, we had a huge thread (1000+ replies) get corrupted, and deleted, many members, including myself, saw our counts go down by quite a bit...for some users, by a few hundred posts. (Not just due to the one big thread, but also the odd small one here and there over time, you know.) Now is this fair to us? My post count is ~6000, but I've probably posted about 6400 messages.

But on the other hand, is it fair for a user's post count to not reflect their actual current count? Or for their thread started count to not reflect how many threads there are, right now, that have been started by the person? People could begin silly games like "accidentally" double-posting, or try posting and deleting, whatever, just to increase their post count. Maybe this is a philosophical debate, I don't know. But I think I prefer these counts to reflect what is actually current.

JJR512
Fri 23rd Mar '01, 2:42am
bira, by the same token, you should make it say, after the post count, that those are currently available posts.

Now a question for you: I notice after your post count, there is a link to search for all posts by the user. My profile doesn't have that. Is that a feature to turn on, and if so where, or is it a hack, and if so where do I find it?

JJR512
Fri 23rd Mar '01, 2:44am
Nevermind, I just noticed it was in the table head, across from "Profile for [membername]". I guess you moved it in yours.

tubedogg
Fri 23rd Mar '01, 2:44am
Just edit getinfo. It's up at the top-right by default, bira just moved it. :)

bira
Fri 23rd Mar '01, 2:47am
Originally posted by JJR512
bira, by the same token, you should make it say, after the post count, that those are currently available posts.


No, the post count for user is not dependent on pruning.

If you prune all threads/posts prior to 90 days ago, for example, the total posts for each user will not change because the "user" table has a "posts" field. Like tubedogg said, if you wanted a number of threads started independent of which threads still exist, you would have to do the same as posts, and add a "threads" column to the "user" table.

JJR512
Fri 23rd Mar '01, 2:57am
OK, I don't know much about the prune option. I never use it.

But I do know, by direct observation, that if you delete a post by a user, the user's post count goes down by one. I have seen this with my own two eyes. Last time was a few days ago...a user had double-posted. His post count was 4360. I deleted one of the two messages, and after that, the post count in the remaining thread said 4359. This is indisputable.

So regardless of pruning, a user's post count does indeed go down if any of the user's posts are deleted directly, and presumably also is an entire thread is deleted, too. So, it is clear the the post count does not reflect how many times the person has ever submitted a message.

bira
Fri 23rd Mar '01, 3:23am
just forget it. I think tubedogg understood what I was talking about, and that was the point to begin really.

JJR512
Fri 23rd Mar '01, 3:41am
Hey look, there's no need to get hostile about it. I admit maybe I was wrong about the pruning part, because I have no experience with it. But I did get your point, which was that this hack will only count how many current threads were started by a person. Now how many threads the person has ever started. Now my point, which is that the post count also does not display how many posts a person has posted, is a valid point, and one that says your premise may have another dimension to it that you maybe didn't consider. And I'd appreciate it if you wouldn't just dismiss me like that, just because what I said might invalidate your point.

bira
Fri 23rd Mar '01, 4:00am
JJR I wasn't dismissing you, I was dismissing the subject, because it's of no importance, that's all.

snyx
Fri 23rd Mar '01, 7:56am
tubedogg on a hacking roll

Me2Be
Fri 23rd Mar '01, 12:09pm
hmmmm tubedog, I may just have to try this out! ;)

tubedogg
Fri 23rd Mar '01, 1:16pm
Now that is a compliment, if someone with a board the size of Me2Be's wants to try my hack out. :)

Me2Be
Fri 23rd Mar '01, 1:17pm
Originally posted by tubedogg
Now that is a compliment, if someone with a board the size of Me2Be's wants to try my hack out. :) **blush** Awwww, shucks :)

I'll let you know when I get it online (I'm waiting for Kier's PM hack and Chris to finish our new chat room then I'll add yours too!).

Da_Gem
Sat 24th Mar '01, 11:45pm
great hack, thanks

but if you can make the thread started first letters capitalized that would be better so it's Thred Started instead of thread started

tubedogg
Sat 24th Mar '01, 11:48pm
Um, no offense, but you can do that just as well as me. :D Just change it in the template. Simple as that. ;)

CJ
Sun 25th Mar '01, 5:18am
nice hack...works perfectly

bira
Sat 7th Apr '01, 7:28am
tubedogg,

You need to add AND open!='10' to the select, because otherwise it counts moved threads (the redirect bit of it) as 2 threads :)

tubedogg
Sat 7th Apr '01, 9:10am
Done and updated (see the first post in this thread).

thanks, bira.

Kabresh
Mon 16th Apr '01, 12:03pm
thx for this nice hack, works great :)



However, I can't see any way around this without adding a "thread" column to the user table, similar to post, except counting threads. And that would take a more detailed hack. If anyone really wants to see this, I'll see what I can do. (I don't think it would be too hard, just more detailed.)


If you get bored, and you don't know what to do, you might consider this feature :D

At least I would love it..but hey who am I

JJR512
Wed 18th Apr '01, 3:41pm
This hack hasn't worked for me since I've upgraded to RC1. I have, of course, re-installed it. Now a number does show up, but it is real small. For me it is 0, and for others I have seen so far it is in the single-digit range as well.

bira
Mon 23rd Apr '01, 11:13am
hasn't worked for me since rc1 upgrade either.

JJR512
Mon 23rd Apr '01, 12:43pm
Tubedogg? Any ideas?

tubedogg
Mon 23rd Apr '01, 3:32pm
The eval("\$birthday line has moved down to line 1164-65, so it would go below there. Assuming you've done that (you're both smart, I can't imagine that's the problem), I cannot figure out why it's acting like that.

I justed tested the query on my vGI database, which is the only one I have that's running RC1. It appears to be working correctly. So why that doesn't translate into working on a running board is beyond me...

JJR512
Mon 23rd Apr '01, 3:40pm
If you mean, did I put the code in the right place because the line number changed, I'd have to say yes. I don't have anything to tell me what line numbers are, so I just search for the code that something is supposed to go after.

JJR512
Mon 23rd Apr '01, 4:26pm
I just checked my installation of this hack by reinstalling it. It still doesn't work. In fact, before I reinstalled it, my threads started count was 23 (which is, of course, very very wrong), and now, after reinstalling it, it is 0. Before I reinstalled it, though, I updated forum info and updated thread info. So either updating the counters, or reinstalling it, made my thread started count go back to 0.

I'm telling you all this because I hope it will help you figure out what's wrong.

tubedogg
Mon 23rd Apr '01, 4:38pm
wtf???????

I am so confused. There is *no* reason that any of that should affect it. It counts the number of threads you are listed as having started in the database. I really don't understand...

OK I just did a test install on my vGI board. It appears to be working, although the number of threads are small anyway because there hasn't been much activity on that board yet.
I then updated counters, and the numbers remained the same.

There's got to be some other reason.

One thing to try - remove

if ($starts == ""):
$starts = "0";
endif;
from the code you added to member.php.

:confused: :confused: :confused: :confused: :confused:

JJR512
Mon 23rd Apr '01, 4:50pm
I did that, and it still said 0 for everyone I checked, including myself. But since I reinstalled it, there were no new threads, only replies. So I started a test thread and checked again. This time it said I had started 1 thread.

tubedogg
Mon 23rd Apr '01, 4:55pm
Something's wrong here. It doesn't count based a date, it just does a scan of the thread table, meaning it should count from the day you installed your board, no matter when you installed the hack.

Try replacing the query with this

$startcount = $DB_site->query_first("SELECT COUNT(postuserid) AS starts FROM thread WHERE postuserid='$userinfo[userid]' AND open!='10'");

JJR512
Mon 23rd Apr '01, 5:02pm
Still says 1 for me.

tubedogg
Mon 23rd Apr '01, 5:10pm
Can you run that query via telnet on your DB please?

I really do not understand what's going on here.

JJR512
Mon 23rd Apr '01, 5:18pm
Telnet is such a pain in the ass for me to do, I have to tell it what IP I'm using right now (dialup), because it's really SSH, and wait 10 minutes, etc. But I can do it if I have to.

I'd prefer to do it by phpMyAdmin, if possible.

Either way, could you tell me what exactly to type in?

JJR512
Mon 23rd Apr '01, 5:29pm
Nevermind, I just ran this query by phpMyAdmin...


SELECT COUNT(postuserid) AS starts FROM thread WHERE postuserid='$userinfo[userid]' AND open!='10'

The number it came back with was 7208. According to my main vB page, I have 7231 total threads.

tubedogg
Mon 23rd Apr '01, 5:33pm
Sorry - I couldn't get to the vB site just now. Weird..

Anyway try this query (and phpMyAdmin is fine)

SELECT COUNT(postuserid) AS starts FROM thread WHERE postuserid='YOURUSERIDHERE' AND open!='10'
and put in your user id where it says YOURUSERIDHERE :D

JJR512
Mon 23rd Apr '01, 5:35pm
I tried removing the AND open!='10' from the hack code in member.php, and this time, my thread start count was 2. Just to make sure, I put it back in, and it went back to 1.

JJR512
Mon 23rd Apr '01, 5:39pm
I ran the query as above, and it said 1. I tried it withouth the final AND open!='10' as I tried in the member.php as I said above, and it said 2.

BTW, I've requested an authorization from your ICQ number, but it looks like you're not connected. If you think that would be easier and faster, we could work on this by ICQ. My # is 52675695

JJR512
Mon 23rd Apr '01, 7:05pm
bira...check your database. Check the thread table, and look specifically at the postuserid fields. Most of mine were set to 0. (The postusername fields are fine, which is why I think I didn't notice any problems where it is supposed to say who started the thread.)

I think the problem seems to come from updating counters, specifically update forums info. I did this while I was looking at the table, and afterwards, most of the postuserid that wasn't already 0 now was.

tubedogg, I'm back on ICQ.

JJR512
Mon 23rd Apr '01, 7:28pm
tubedogg, I finally got my db backed up, so I tried that script you sent. I got this error message:

Warning: Supplied argument is not a valid MySQL result resource in /home/jjr512/jjr512-www/forums/admin/updatepostuserid.php on line 3
Done updating users

bira
Tue 24th Apr '01, 1:52am
Originally posted by JJR512
bira...check your database. Check the thread table, and look specifically at the postuserid fields. Most of mine were set to 0. (The postusername fields are fine, which is why I think I didn't notice any problems where it is supposed to say who started the thread.)

I think the problem seems to come from updating counters, specifically update forums info. I did this while I was looking at the table, and afterwards, most of the postuserid that wasn't already 0 now was.

tubedogg, I'm back on ICQ.

Yep, you're right.

OK, so I changed the query in members.php to



SELECT COUNT(title) AS starts FROM thread WHERE postusername='$userinfo[username]' AND open!='10'


And it works fine.

I'm curious to know why the update counters change the postuserid column to 0 though... :confused:

tubedogg
Tue 24th Apr '01, 2:12am
I'm looking at the update thread thing. I can see where it would edit the postuserid, but why it changes them all to 0 is another story. I have posted a note in the bug reports forum.

For all you that can't get this to work, change the query to what bira has posted. I also posted the correct code in the first post in this thread.

Zarkov
Sun 20th May '01, 3:18am
Cool script Tubedog Thanks :)

By the way ive just installed it in RC2 and works great.

Those of you who use this may be interested in a script i just wrote using the info i learned from installing this hack.
Its similar but shows when the user was last online.

see thread
http://www.vbulletin.com/forum/showthread.php?s=&postid=109053#post109053

tubedogg
Sat 2nd Jun '01, 10:57pm
I've updated the files to reflect the fact that it works in v2.0.0 and made a cosmetic change so the words "Threads Started" are capitalized and have a colon after them to match the other fields in getinfo. No need to change or upgrade if you have this successfully working.

DEMOLiTiON
Mon 4th Jun '01, 6:31pm
Heya! I installed this hack, but can I request an modification? It would be cool if the threads started are placed below the "posts:" in the postbit template.
Thnx

kdog316
Fri 8th Jun '01, 7:49pm
how do i fix the line thats between threads posted and threads started its to thick heres a link to an example http://tmbps.photographiclee.com/member.php?s=&action=getinfo&userid=1

kdog316
Sat 9th Jun '01, 1:43am
ok on the user has started x threads. where it says
x of the currently available threads where x=the number of threads started. i want to make it say
x of the currently "and then i want to add the varable $totalthreads" available threads but i cant get that varible to show up even when i enter it in. how do i go about makeing it show up.:confused:

kdog316
Tue 19th Jun '01, 5:27pm
I got it to work its pretty cool heres the link to it http://tmbps.allaroundsite.com/member.php?action=getinfo&find=lastposter&forumid=28 this shows you how many threads they have started and then it tells you the toatal threads there are in on the board.:)

TripleH
Sun 29th Jul '01, 6:15am
tubedogg,
can you please help me witht something?
I am trying to get this to show in the postbit template so it shows undernaeath the eprsonal views, and total post,
but i cna't get it to work,,. can you instruct me how to do this>?

thanks

HHH

almighty one
Sat 4th Aug '01, 9:54am
hey i ahd this installed before and it worked fine but now on 2.03 it shows the threads started in profile but doesnt sahow a # it is just bl;ak i did an update counters etc can soemone tell me the prob here

JJR512
Sat 4th Aug '01, 12:37pm
You need to put the code for this hack into the new member.php file. Part of this hack is some code that you insert into that file. When you upgraded to 2.0.3, that file was overwritten with a clean, unhacked version. You still see the "Threads started" in a person's profile because that bit of the hack is in a template, which does not get overwritten in an upgrade. But as you noticed, it says "Threads started", but there is no number, because the code that generates the number is gone.

TripleH
Sat 4th Aug '01, 3:22pm
Anbyone know a solution to my problem???


HHH

almighty one
Sat 4th Aug '01, 5:55pm
Originally posted by JJR512
You need to put the code for this hack into the new member.php file. Part of this hack is some code that you insert into that file. When you upgraded to 2.0.3, that file was overwritten with a clean, unhacked version. You still see the "Threads started" in a person's profile because that bit of the hack is in a template, which does not get overwritten in an upgrade. But as you noticed, it says "Threads started", but there is no number, because the code that generates the number is gone.
man i know hacks get overwriten im not stupid but it still wont work if i use the 2.03 memebrphp but if i run the old memebr php from 2.02 it works fine i insstalled the hack 3 times in memebr php for 2.03 but c not get it to work

JJR512
Sun 5th Aug '01, 1:53am
I never said you were stupid. So please don't expect an apology. I've seen enough instances where people didn't realize that hacks get overwritten that it comes to be my first thought in this type of situation. You know, similar to the old cliche of "My computer doesn't work!"..."Well, is it plugged in?" OK?

So I will say I'm sorry I can't help you. It works fine for me on 2.0.3.

jasmith
Tue 7th Aug '01, 12:12pm
im using 2.0.1 and I have the same problem... where it should tell howmany posts... its just blank.

Generics
Tue 4th Sep '01, 6:00am
hi i am new in vbb and tried to add the hack ... i have done like the txt said but i only see in teh profil thread started but no number how many threads that are someone knowing where the error is ?? i use vbb 2.0.3

Gutspiller
Wed 5th Sep '01, 1:57pm
This hack has a problem with users names that have a ' in the name. Take a look at the help FireFly gave to fix the problem in this thread: http://www.vbulletin.com/forum/showthread.php?s=&postid=167266&t=7072#post167266

Generics
Thu 6th Sep '01, 4:15am
thx for the help

[VbbFr]Elie
Fri 5th Oct '01, 11:29pm
Hy want to used this in specifie forum ...

I Try this :



// Find out how many threads this user has started
$startcount = $DB_site->query_first("Select COUNT(postuserid) AS starts from thread where forumid='3' AND postusername='$userinfo[username]' AND open!='10'");
$startcount = $DB_site->query_first("Select COUNT(postuserid) AS starts2 from thread where forumid='16' AND postusername='$userinfo[username]' AND open!='10'");
$startcount = $DB_site->query_first("Select COUNT(postuserid) AS starts3 from thread where forumid='14' AND postusername='$userinfo[username]' AND open!='10'");
$starts=$startcount[starts]+$startcount[starts2]+$startcount[starts3];
// end Find threads


It's writting 1 everytime :(

Some one can show me ?

Justice
Sat 6th Oct '01, 5:59pm
wow, I just installed this in less than two minutes and it works perfectly.

what's the catch??

MApI
Sun 7th Oct '01, 11:02am
Hi, great hack, but there's a way to put this info into the left column (where the name, avatar, date of registration) instead the user CP ?

thx. in adv. bye.

afterlab
Mon 8th Oct '01, 8:29pm
Hey tube.. Anyway you can make this appear in the postbit template as well?

Nice hack, worked without a problem.

MApI
Tue 9th Oct '01, 3:45am
instead the user CP ? or in add obv. thx again, MAp|

MApI
Sun 21st Oct '01, 6:20am
Ehm ... no answers= no ways to do it ? :p :p :p

cya

DarkManX_19
Tue 23rd Oct '01, 10:33pm
Originally posted by afterlab
Hey tube.. Anyway you can make this appear in the postbit template as well?

Nice hack, worked without a problem.



i agree, i installed it flawlessly, but would like to know how to get it to show up in the postbit template too :D

Narkan
Wed 24th Oct '01, 1:51pm
Here I am, thanx for this little/great hack, but I would like to see the Started Threads: entry in the postbits template under the Posts: one too...
I tried to do it by myself but got no success :(
Can someone explain me how to do that?

(P.S. I just can't code PhP/MySQL but I tried to add an entry in the postbits template saying "Threads Started: $starts" and "Threads Started: $startcount[starts]" but it didn't work either way :()

Cruz
Thu 25th Oct '01, 1:15pm
// Find out how many threads this user has started
$startcount1 = $DB_site->query_first("Select COUNT(postuserid) AS starts from thread where forumid='3' AND postusername='$userinfo[username]' AND open!='10'");
$startcount2 = $DB_site->query_first("Select COUNT(postuserid) AS starts2 from thread where forumid='16' AND postusername='$userinfo[username]' AND open!='10'");
$startcount3 = $DB_site->query_first("Select COUNT(postuserid) AS starts3 from thread where forumid='14' AND postusername='$userinfo[username]' AND open!='10'");
$starts=$startcount1[starts]+$startcount2[starts2]+$startcount3[starts3];
// end Find threads

that will work :)
you were resetting the variable $startcount with every different select query.

neogeniseva
Thu 25th Oct '01, 3:14pm
how would you exculde surton forums?

DarkManX_19
Thu 25th Oct '01, 7:04pm
Originally posted by Cruz


// Find out how many threads this user has started
$startcount1 = $DB_site->query_first("Select COUNT(postuserid) AS starts from thread where forumid='3' AND postusername='$userinfo[username]' AND open!='10'");
$startcount2 = $DB_site->query_first("Select COUNT(postuserid) AS starts2 from thread where forumid='16' AND postusername='$userinfo[username]' AND open!='10'");
$startcount3 = $DB_site->query_first("Select COUNT(postuserid) AS starts3 from thread where forumid='14' AND postusername='$userinfo[username]' AND open!='10'");
$starts=$startcount1[starts]+$startcount2[starts2]+$startcount3[starts3];
// end Find threads

that will work :)
you were resetting the variable $startcount with every different select query.



Do i put this code in the postbit template then???

thanks

Cruz
Thu 25th Oct '01, 8:55pm
no...the way I did it was to place it in the members.php -> because i had it add a few fields to the display stuff...
then you can put the $startcount1 wherever.
here is code i am using:

// Find out how many game reviews this user has made
$gstartcount = $DB_site->query_first("SELECT COUNT(title) AS starts FROM thread WHERE postusername='$userinfo[username]' AND forumid='16'");
$gamestarts = $gstartcount[starts];
// end Find threads
// Find out how many media clips this user has posted
$mstartcount = $DB_site->query_first("SELECT COUNT(title) AS starts FROM thread WHERE postusername='$userinfo[username]' AND forumid='25'");
$mediastarts = $mstartcount[starts];
// end Find threads

// Find out how many missions this user has made
$mistartcount = $DB_site->query_first("SELECT COUNT(title) AS starts FROM thread WHERE postusername='$userinfo[username]' AND forumid='26'");
$mixedstarts = $mistartcount[starts];
// end Find threads

DarkManX_19
Thu 25th Oct '01, 10:09pm
thanks :D

yuppie
Sun 28th Oct '01, 10:55am
Nice work

But how can i display the threads in Members?

Chen
Sun 28th Oct '01, 10:57am
First you need to enter your username here (http://www.vbulletin.com/members/forums.php), yuppie.