vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   User has started X threads (https://vborg.vbsupport.ru/showthread.php?t=12104)

tubedogg 03-22-2001 10:00 PM

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.

http://kevin.tubescan.com/i/threadsstarted.jpg

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)
Code:

    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

Code:

<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.ph...tinfo&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.

03-23-2001 03:59 AM

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 :)

03-23-2001 04:03 AM

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

03-23-2001 04:31 AM

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! :)

03-23-2001 04:32 AM

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. :)

03-23-2001 04:38 AM

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...fo&userid=1199

03-23-2001 04:39 AM

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.

03-23-2001 04:42 AM

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?

03-23-2001 04:44 AM

Nevermind, I just noticed it was in the table head, across from "Profile for [membername]". I guess you moved it in yours.

03-23-2001 04:44 AM

Just edit getinfo. It's up at the top-right by default, bira just moved it. :)

03-23-2001 04:47 AM

Quote:

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.

03-23-2001 04:57 AM

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.

03-23-2001 05:23 AM

just forget it. I think tubedogg understood what I was talking about, and that was the point to begin really.

03-23-2001 05:41 AM

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.

03-23-2001 06:00 AM

JJR I wasn't dismissing you, I was dismissing the subject, because it's of no importance, that's all.

03-23-2001 09:56 AM

tubedogg on a hacking roll

03-23-2001 02:09 PM

hmmmm tubedog, I may just have to try this out! ;)

03-23-2001 03:16 PM

Now that is a compliment, if someone with a board the size of Me2Be's wants to try my hack out. :)

03-23-2001 03:17 PM

Quote:

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!).

03-25-2001 01:45 AM

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

03-25-2001 01:48 AM

Um, no offense, but you can do that just as well as me. :D Just change it in the template. Simple as that. ;)

03-25-2001 07:18 AM

nice hack...works perfectly

bira 04-07-2001 09:28 AM

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 04-07-2001 11:10 AM

Done and updated (see the first post in this thread).

thanks, bira.

kabresh 04-16-2001 02:03 PM

thx for this nice hack, works great :)

Quote:

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 04-18-2001 05:41 PM

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 04-23-2001 01:13 PM

hasn't worked for me since rc1 upgrade either.

JJR512 04-23-2001 02:43 PM

Tubedogg? Any ideas?

tubedogg 04-23-2001 05:32 PM

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 04-23-2001 05:40 PM

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 04-23-2001 06:26 PM

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 04-23-2001 06:38 PM

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
Code:

  if ($starts == ""):
          $starts = "0";
  endif;

from the code you added to member.php.

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

JJR512 04-23-2001 06:50 PM

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 04-23-2001 06:55 PM

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
Code:

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

JJR512 04-23-2001 07:02 PM

Still says 1 for me.

tubedogg 04-23-2001 07:10 PM

Can you run that query via telnet on your DB please?

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

JJR512 04-23-2001 07:18 PM

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 04-23-2001 07:29 PM

Nevermind, I just ran this query by phpMyAdmin...

Code:

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 04-23-2001 07:33 PM

Sorry - I couldn't get to the vB site just now. Weird..

Anyway try this query (and phpMyAdmin is fine)
Code:

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 04-23-2001 07:35 PM

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.


All times are GMT. The time now is 04:47 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.02008 seconds
  • Memory Usage 1,818KB
  • 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
  • (6)bbcode_code_printable
  • (3)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