Advertisement:

Author Topic: Statsbar next to each post.  (Read 2515 times)

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Statsbar next to each post.
« on: April 19, 2010, 08:01:46 AM »
SMF 2.0RC3

Hi,

There are Most Time Online statsbar under index.php?action=stats. I'd like to add that statsbar under the user name next to each post. With zero php knowledge, I tried copying the codes from Stats.php over to MessageIndex.php but nothing happens.

Really appreciate any help with the right codes. Thanks.

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #1 on: April 21, 2010, 02:06:02 AM »
I've put the following codes from memberlist into Display.template but still nothing happens


Code: [Select]
   if (!empty($context['members']))
   {
      foreach ($context['members'] as $member)
      {
                  if (!empty($member['post_percent']))
            echo '
                  <li class="bar" style="width: ', $member['post_percent'] + 4, 'px;">
                     <div style="width: ', $member['post_percent'], 'px;"><>
                  </li>';
      }
   }


Any suggestions from anyone please? Thanks.
« Last Edit: April 27, 2010, 09:31:41 PM by fiver »

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #2 on: May 04, 2010, 09:10:12 AM »
Bump after 2 weeks. :)


Really eager to get this working in the forum.

Offline Kays

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: Statsbar next to each post.
« Reply #3 on: May 04, 2010, 09:33:53 AM »
Hi, it's not going to work the same way in Display.template.php. In Stats, there are queries run to get that info.

A member's time on line is in the profile as total_time_logged_in, But I don't known in what format is used in Display.php. Also if you want to show a % graph, you will need to do a query to find the user with the most time online.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #4 on: May 04, 2010, 10:37:12 AM »
Hi Kays,


Thanks for the reply.


If it works in stats page and memberlist page, I wonder how to make it work in display.template.php so it shows next to each post.


Any suggestion is most welcome.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 62,464
Re: Statsbar next to each post.
« Reply #5 on: May 04, 2010, 10:38:20 AM »
Both Stats.php and Memberlist.php run a query to get the highest poster that's applicable, which will have to be copied into Display.php (not the template) first...

Which stats bar, exactly, did you want?

A variant of http://custom.simplemachines.org/mods/index.php?mod=1929 might be relevant here.
And his eyes have all the seeming of a demon's that is dreaming,
And the lamp-light o'er him streaming throws his shadow on the floor

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #6 on: May 04, 2010, 10:53:09 AM »
Hi Arantor,


Thanks for the recommendation. The mod requires setting a fix number as 100%.


I want the same statsbar in the memberlist to show next to each post please.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 62,464
Re: Statsbar next to each post.
« Reply #7 on: May 04, 2010, 11:23:46 AM »
And which statsbar is that, exactly? The one relative to the highest post count?

Yay for encouraging spam (it worked on me, here)
And his eyes have all the seeming of a demon's that is dreaming,
And the lamp-light o'er him streaming throws his shadow on the floor

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #8 on: May 04, 2010, 12:04:28 PM »
Spam????


OK, it's like the one under Post column:
http://www.simplemachines.org/community/index.php?action=mlist

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 62,464
Re: Statsbar next to each post.
« Reply #9 on: May 04, 2010, 12:07:36 PM »
Spam doesn't have to be just bots trying to get you to their site - any post that is unwanted, duplicative, and generally made just to boost post count is often called spam too, and I think if you encourage users to post, you'll end up getting them just posting for the sake of posting if you're not careful.

You could, you know, try looking at the link I provided above because it might be useful... and likely to work on 2.0 RC3 without significant changes...
And his eyes have all the seeming of a demon's that is dreaming,
And the lamp-light o'er him streaming throws his shadow on the floor

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #10 on: May 04, 2010, 12:29:03 PM »
LOL I had to deal with that since installing hidepost a few years ago, and members know that I don't mind them chit chatting but anyone trying to spam gets a warning or even a ban, and I've tried the warning system in SMF2RC3, it works ;D  . Touch wood, so far post count has encouraged more genuine posts than spam.



I had tried looking at that mod, I don't know how to change it so it will be based on the highest number of post. I thought using what is already there in stats and memberlist page will be consistent - members get confuse very easily when something doesn't 'click'.









Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 62,464
Re: Statsbar next to each post.
« Reply #11 on: May 04, 2010, 12:29:50 PM »
You could always try asking the author, the mod's page seems to suggest it would actually do what you want.
And his eyes have all the seeming of a demon's that is dreaming,
And the lamp-light o'er him streaming throws his shadow on the floor

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #12 on: May 05, 2010, 03:16:40 AM »
http://www.simplemachines.org/community/index.php?topic=321247.msg2598910#msg2598910

[/size]

Sorry for all the delaying, I've been busy.

Since I no longer have the time or interest to keep updating my mods regularly, this and my other creations will have to wait for 2.0 Final before I update them or add any new features. Sorry.

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #13 on: May 05, 2010, 03:20:04 AM »
Hi Arantor,


Are you able to help me with the code changes?


I gather that Nas' mod put the database query into subs.php. Can I copy the one for memberlist and put it in subs.php?


Follow by the bits from memberlist template into display template right?

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #14 on: May 05, 2012, 11:59:46 AM »
SMF 2.0.2


Bump after 2 years.

Offline fiver

  • Jr. Member
  • **
  • Posts: 319
    • Five Arts .Net
Re: Statsbar next to each post.
« Reply #15 on: May 05, 2012, 12:54:51 PM »
I transferred the SMF2.0.2 codes from memberlist into display.template. Still got no effect. Got an undefined error for "member" instead.