SunJordan / ezstats

Automatically exported from code.google.com/p/ezstats
0 stars 0 forks source link

Top-5-Player widget for wordpress #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please describe yout idea for a new feature in ezStats:

A wordpress (and likely other CMS's as well) widget pulling 'top 5' or 'top 10' 
or even 'current online players' would be incredible. Sadly I don't posses the 
skills to actualize it, but if the data is available there must be a way.

Original issue reported on code.google.com by DCS905De...@gmail.com on 16 Mar 2012 at 8:45

GoogleCodeExporter commented 9 years ago
Hi!

I will try to add the "online state" of the players in one of the next versions.

To mod ezStats for a Top-5-list is very easy: Open the file "index.php", go to 
line 75 (it contains this code: "ORDER BY s.score DESC") and append following 
code: " LIMIT 5". Thats all!

Regards, ezzemm

Original comment by ezzem...@googlemail.com on 18 Mar 2012 at 10:49

GoogleCodeExporter commented 9 years ago
Thank you for the response. I hope the online state function comes together!

re: top5, I would like to display this information (and probably the online 
state as well, but thats another issue) in the sidebar of my site, ideally 
linking to the full roster page, where I've got more than 60 entries across all 
3 platforms... thoughts?

Original comment by DCS905De...@gmail.com on 19 Mar 2012 at 3:29

GoogleCodeExporter commented 9 years ago
Do you have a PHP sidebar widget in your wordpress installation?

Original comment by ezzem...@googlemail.com on 20 Mar 2012 at 2:52

GoogleCodeExporter commented 9 years ago
yes, if required I can execute PHP in the sidebar of the site

Original comment by DCS905De...@gmail.com on 20 Mar 2012 at 2:55

GoogleCodeExporter commented 9 years ago
Ok, then do following:

Download the complete folder of ezStats2, and upload it again, using a 
different foldername, f.e. "ezStats2top5". The original folder is [1], the 
duplicated folder is [2]

Goto the adminpanel of [1], open the "plugin" menu and follow the instructions 
to create the full roster page.

Then download the file "index.php" from [2], open it, goto line 75 (it contains 
this code: "ORDER BY s.score DESC") and append following code: " LIMIT 5".

Then goto line 136 and replace the code in it with this code (replace PATH with 
the path to the full roster page:
$td['name'] = phpQuery::newDocumentHTML('<td class="tleft" sort="'.$name.'"><a 
href="PATH">'.$clantag.$name.'</a></td>');

The create your PHP widget and copy this code in it (change the URL first; 
don't forget the closing slash):
<?php
    $ch = curl_init("http://www.url.com/ezStats2top5/");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    $output = curl_exec($ch);
    curl_close($ch);

    /* ezStats Start */
    echo $output;
    /* ezStats End */
?>

Thats all ;)

Original comment by ezzem...@googlemail.com on 20 Mar 2012 at 3:26

GoogleCodeExporter commented 9 years ago

Original comment by ezzem...@googlemail.com on 20 Mar 2012 at 3:26

GoogleCodeExporter commented 9 years ago
awesome! i really appreciate you taking the time to sort for me... you can see 
it in action @ http://www.deadcartel.dcs905.ca/

I have a few questions tho;

1. Adding/Removing players.. Will I need to add/remove in tandem from both 
rosters now?

2. Modifying the output for [2], I only need a few of the categories 
displaying, though currently it expands off the page... How/Where do I mod [2] 
output, without changing the output from [1]? 

3. How will this affect updates? I'm not planning on updating ezstats until 
v.51 or whenever the platoon support is enabled, and or the online status... 
but will the copied folder need a separate update?

Original comment by DCS905De...@gmail.com on 20 Mar 2012 at 4:11

GoogleCodeExporter commented 9 years ago
Both leaderboards using the same database, so you just add the players once 
using [1].
When updating, just update [1], [2] dont need to be updated, and so your 
changes are not overwritten.

To select the columns showing in [2] do following:
Open the "index.php" of [2] again, jump to line 85. You'll se there: 
  if ($ov['rank']) {

Change it to 
  if (true) {
if you want to show the column, or change it to
  if (false) {
if you want to hide it. Repeat this with all possible columns.

Then jump to line 339 and change
  if (true) {
to 
  if (false ) {

At last, jump to line 615 and change 
  if (!$settings->get('ov_brand'))   pq('#ezBrand')->remove(); // Werbung entfernen
  if (!$settings->get('ov_infobox')) pq('#ezAside')->remove(); // Infobox entfernen
into 

  if (true)   pq('#ezBrand')->remove(); // Werbung entfernen
  if (true) pq('#ezAside')->remove(); // Infobox entfernen

Original comment by ezzem...@googlemail.com on 21 Mar 2012 at 6:13

GoogleCodeExporter commented 9 years ago
I can't thank you enough for your help with this! 

I've made the changes you mentioned, and its clooooose! 

http://deadcartel.dcs905.ca/ near the bottom on the right sidebar you can see 
the output... 

It's still displaying the table titles (overflowing off page), and not 
displaying rank icons (tho i marked that as true) ... have I missed something?

Respect, 

Original comment by DCS905De...@gmail.com on 21 Mar 2012 at 5:14

GoogleCodeExporter commented 9 years ago
Oh, those table headers I forgot ;) Goto line 46 and turn "true" into "false". 
Then the header is hidden.

The Rank-Icons are in line 85 or 101 (turn it into "true").

You're welcome :)

Original comment by ezzem...@googlemail.com on 22 Mar 2012 at 10:51

GoogleCodeExporter commented 9 years ago
EPIC WIN. 

You're my hero.

Original comment by DCS905De...@gmail.com on 22 Mar 2012 at 2:10

GoogleCodeExporter commented 9 years ago

Original comment by ezzem...@googlemail.com on 17 Apr 2012 at 1:27