Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Owdy - helmikuu 18, 2006, 12:27:12 IP

Otsikko: Post count when hovering username
Kirjoitti: Owdy - helmikuu 18, 2006, 12:27:12 IP
Is it possible do it like that? I mean when you hover mouse over username in posts, it would show that users post count. Now it says title="View profile of ...", but instead of that, it would show "user has made 10 posts" or similar. Dont ask why i need this, i just do :D
Otsikko: Re: Post count when hovering username
Kirjoitti: kegobeer - helmikuu 18, 2006, 01:02:02 IP
I'm sure it's possible, it would just mean a bunch of extra queries to calculate each poster's post count.  I'll look around today and see what I can whip up.
Otsikko: Re: Post count when hovering username
Kirjoitti: Thantos - helmikuu 18, 2006, 01:12:29 IP
Where do you want to display it Owdy?  I mean doing it on the MessageIndex would be near trivial as the information is already there.  Doing on a user search page would take more changes.

kegobeer there is nothing to calculate, its stored in the members table.  Just have to include that in the query and put it in the array.

Edit:  Doh just re-read.  Ok in the MessageIndex... give me a minute

Edit #2:  My mistake, Display not MessageIndex
Otsikko: Re: Post count when hovering username
Kirjoitti: Thantos - helmikuu 18, 2006, 01:21:32 IP
Ok the title is in Load.php.

Find: (around line 1017)
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>'

'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="User has spammed the board'. $profile['posts'] . ' times">' . $profile['realName'] . '</a>'
Otsikko: Re: Post count when hovering username
Kirjoitti: Owdy - helmikuu 18, 2006, 04:37:54 IP
Thanks. Works perfectly! :D
Otsikko: Re: Post count when hovering username
Kirjoitti: Owdy - helmikuu 19, 2006, 04:32:54 AP
Okay, now i have this.

'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $profile['realName'] . ' has sended '. $profile['posts'] . ' messages.">' . $profile['realName'] . '</a>',
and it prints 'username has sended 345 messages'. How to ad register date or even better total days logged in to that?

I mean ' username has sended 6576 messages and his been around 465 days now' or similar?  :D
Otsikko: Re: Post count when hovering username
Kirjoitti: Thantos - helmikuu 19, 2006, 05:21:07 AP
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $profile['realName'] . ' has sent '. $profile['posts'] . ' messages and has been around ' . sprintf('%0.1f', (time()-$profile['dateRegistered'])/86400) . '.">' . $profile['realName'] . '</a>',
Otsikko: Re: Post count when hovering username
Kirjoitti: Owdy - helmikuu 19, 2006, 05:31:44 AP
Perfect!! Thanks!  8)
Otsikko: Re: Post count when hovering username
Kirjoitti: Thantos - helmikuu 19, 2006, 05:32:33 AP
Oh wait you might want to change '.">' to ' days.">'
Otsikko: Re: Post count when hovering username
Kirjoitti: Owdy - helmikuu 19, 2006, 05:51:50 AP
Yeah, i use finnish so i have to modify it anyways. Thanks again!
Otsikko: Re: Post count when hovering username
Kirjoitti: Owdy - helmikuu 19, 2006, 07:28:58 AP
Hmmm, can we remove that one desimal after days? Now it is 123,1 days ago.
Otsikko: Re: Post count when hovering username
Kirjoitti: Thantos - helmikuu 19, 2006, 10:21:22 AP
Sure, change
sprintf('%0.1f', (time()-$profile['dateRegistered'])/86400) to (int)((time()-$profile['dateRegistered'])/86400)  Though of course that means you can get some zero day people :P
Otsikko: Re: Post count when hovering username
Kirjoitti: Owdy - helmikuu 19, 2006, 01:21:41 IP
Lainaus käyttäjältä: Thantos - helmikuu 19, 2006, 10:21:22 AP
Though of course that means you can get some zero day people :P
You mean those who are just registered?
Otsikko: Re: Post count when hovering username
Kirjoitti: Thantos - helmikuu 19, 2006, 02:43:06 IP
Yeah