News:

Wondering if this will always be free?  See why free is better.

Main Menu

Statsbar next to each post.

Started by fiver, April 19, 2010, 08:01:46 AM

Previous topic - Next topic

fiver

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.

fiver

#1
I've put the following codes from memberlist into Display.template but still nothing happens


   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.

fiver

Bump after 2 weeks. :)


Really eager to get this working in the forum.

Kays

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

fiver

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.

Arantor

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.

fiver

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.

Arantor

And which statsbar is that, exactly? The one relative to the highest post count?

Yay for encouraging spam (it worked on me, here)

fiver


Arantor

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

fiver

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'.









Arantor

You could always try asking the author, the mod's page seems to suggest it would actually do what you want.

fiver

http://www.simplemachines.org/community/index.php?topic=321247.msg2598910#msg2598910

[/size]
Quote from: Nas on April 24, 2010, 01:33:09 PM
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.

fiver

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?

fiver


fiver

I transferred the SMF2.0.2 codes from memberlist into display.template. Still got no effect. Got an undefined error for "member" instead.

Advertisement: