![]() |
Most popular smilies
To get the number of occurences of each smilie in user's posts on all over the forum, run the sql query:
[SQL] select smilietext , count(*) as count from post, smilie where pagetext like concat("%",smilie.smilietext,"%") group by smilietext order by count desc;[/sql] You will get an output like: +------------+-------+ | smilietext | count | +------------+-------+ | :D | 14063 | | :) | 4596 | | :lol: | 2381 | | :( | 1526 | | ;) | 1518 | ... This is useful to determine the popular smilies and to put them in the smiliebox in the message posting interface. |
Great idea, maybe you could implent it into the vB3 Admin CP and release it as a hack?:)
|
Gosh that query would kill a large board ;) Thanks for sharing the tip nevertheless! :D
|
You're right Dean C. It took 5.57 in my board (with ~35000 posts) to execute the query.
It will take roughly 1 minute for vbulletin.org, and more for larger boards, which may exceed their php timeout. I will try to write the hack for the admincp when I have some time (maybe this weekend?) |
Go for it :)! I look forward to seeing your first release ;)
|
actually, that query isn't correct.
for example if you have used :) 3 times in a post, it will just be counted one time, because you er doing the count on ammounts of posts, not ammounts of smilies used in a particular post. |
Quote:
|
hmm, that's a bit more complicate and i fear even much more intese.
I didn't find a way to do substring counts in mysql, maybe i'm just blind or there isn't such a function. so the only way i can see now is to query the pagetext of each post, and to the php string count on it, but that's not fast of course ;) |
Quote:
|
as i said, i don't find a way to do it in a query.
i don't think there is the needed function in mysql, or if it is, then i can't figure out the nae, so the only way i see right now to get the correct value would be a php/mysql combination |
Quote:
|
aww, comeone, someone else please ;)
ok, here you are, just snipets, not tested, nor implemented: PHP Code:
(at least if i didn't mess something up) |
I recall we discussed the very same thing before and I guess I offered a solution to add a new column to smilie table and populate it everytime a smilie is used while posting so that heavy load can be avoided.
Is it dejavu or am I dreaming? :) |
definitelly a d?j?-vu pal ;)
and iirc i said, that you ahve to populate the table as initialisation to get the real ammounts ;) |
Then there is no real way to get the correct amount now?
Stefan, I tried your code and got a non-object error. :( |
What error exactly?
|
erm, i said code snipet Bob, not a full file ;)
you have to require global.php before of course :) |
Doh! on me. Sorry about that. ;)
|
This is what I am using and I get a Query is empty error:
PHP Code:
|
try that one:
PHP Code:
|
|
Quote:
The only strange thing is that in your query: :p -> 218 and in the first query: :p -> 228 That was the only one that was lower with your query. Also, how would we order the listing from the highest count to the lowest? |
hmm, interesting...
ah well, just don't care ^^ |
Quote:
I added something to my last post about how we would list them according to count. How can we do that, sir? |
you mean sorting?
well asort() is your friend then ;) btw, those whoe are intersted in vb.org stats: Code:
:p -> 9666 |
I would have thought the wink smilie would have been used more than that ;)
|
I tried this but it wouldn't work. :(
asort($output, SORT_STRING); |
hmm no one likes :hurt: or :beard: what a shame :(
|
@Dean: me, too ;)
@coli: let's start the initiative to use differnt smilies ^^ @Bob: hmm, try just asort($smilie_counts); before the foreach loop :p |
Quote:
arsort($smilie_counts); so the highest number would show first. ;) |
xenon im with you :beard: hopefully my sig shall help the fight to give Unpopular Smilies More Credit lol , or the USMC lol..
anyway i added some to tmy sig |
hmm, sigs are not countet in the query unfortunatelly.
maybe i should add them ^^ :rambo: |
Quote:
|
Quote:
|
erm, that wasn't meant serious bob :p
|
All times are GMT. The time now is 06:11 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:
|