![]() |
I want to give members the satisfaction of seeing how many views all their posts have received.
i.e. Total views of all your posts: 34500 Anyone one know if this hack has been done? |
So, to sum all the views of the threads started by the person viewing the page? Not hard at all.
Tell me if this is what you want. :) |
I was going to put this information in their control panel, for each members own private reference.
|
I have just realized that this is a more important requirement for my message boards then I thought.
If no one knows how to do it, can anyone point me to a hack that is similar? I must say, that this would be a great hack. - It could double for a points program. - The person must be the thread starter however to count the impressions towards their total... thanks. |
Something like this:
PHP Code:
|
Code:
$yourviews=$DB_site->query_first("SELECT SUM(views) AS totalviews FROM thread WHERE postuserid='$bbuserinfo[userid]'"); |
OK, how about a short, quick explanation of "query_first".
|
$DB_site->query() is just like mysql_query().
$DB_site->query_first() is the same as the above, only it returns the first row in the result. For example if you want to find out someone's username, you can do this: Code:
$userinfo=$DB_site->query_first("SELECT username FROM user WHERE userid='$userid'"); But if you do it this way (the wrong way): Code:
$userinfo=$DB_site->query("SELECT username FROM user WHERE userid='$userid'"); You must do $DB_site->fetch_array(), because the result in this case it a 2D array. Am I making sense here? :) |
Thanks Firefly, learned something 2day :)
Why not making a new forum where the php guys can add their little tutorials like this one above? ;) |
Quote:
One more question, which file is this object defined in? Thank You :D |
Like all $DB_site, db_mysql.php.
|
Duh! I should have known, my brain is enjoying the holiday.
Thanks again |
Quote:
Hey Firefly, Where exactly does this code go? I put it in one of the cp templates and that didn't work. Thanks! |
In index.php, add this:
Code:
$countviews=$DB_site->query_first("SELECT SUM(views) AS views FROM thread WHERE postuserid='$bbuserinfo[userid]'"); Code:
// get newest member |
FireFly~~
can it show up in postbit~~ i want to do that u know how to do that?? |
Yeah I do, but it takes too much resource.
|
i know~~but i still want to know~
can u tell me how to do that??plz~~ |
In functions.php, find this:
Code:
eval("\$post[profile] = \"".gettemplate("postbit_profile")."\";"); Code:
$countviews=$DB_site->query_first("SELECT SUM(views) AS views FROM thread WHERE postuserid='$post[userid]'"); This hack is bad for your server! I don't advice using it! |
thankz FireFly ur advice~~~
u let me know more about vbb hack's code~~ and i just want to know if i want to do what should i do?? that's all~~:D |
Thanks for your advice on this matter firefly.
I would like to insert the total views into the control panel for the member as well as in the "forumhome_pmloggedin" template. It doesn't seem to work when I insert this code into that template. Can you tell me what I need to do to get this to work? thanks. |
Is there any way to get the number of threads that you have visited ?
e.g: this member has read: 45152 threads(or posts). |
All times are GMT. The time now is 03:05 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|