VidYen / VidYen-WordPress-Plugins

VidYen Plugins for WordPress
GNU General Public License v2.0
9 stars 2 forks source link

Public balance leaderboard positions #118

Open mcdeimon opened 6 years ago

mcdeimon commented 6 years ago

Hi Felty!

I have used this shortcode [vyps-pb pid=2] and the numbering of the users in the list is not correct.

The first user starts with the number 7, the next 8, 9, and we jump to 18

It would also be nice to be able to limit the number of users in the list. For example 25 or 50.

VidYen commented 6 years ago

rows=50 is default. Are you seeing more than that? Unless you added rows=1000 then it should not be doing this.

VidYen commented 6 years ago

Oh if you are using some weird theme with bootstrap... Then try bootstrap=yes

mcdeimon commented 6 years ago

Hi! I'm talking about [vyps-pb pid = 2] not [vyps-pl]

VidYen commented 6 years ago

[vyps-pb pid=3] has a default of 50 rows. It's called pb for public balance but it sorts so its functional as a leaderboard.

mcdeimon commented 6 years ago

Does not work "rows = 25" or "bootstrap = yes" and the rank numbers are not right.

VidYen commented 6 years ago

Hrm... Let me investigate

VidYen commented 6 years ago

BTW... If you copy your site... and just remove your theme and use something generic, does it have same issue?

VidYen commented 6 years ago

image

mcdeimon commented 6 years ago

I have a clone of my web and in the web of tests I do not have this failure ... I am going to try and disable some new plugins.

VidYen commented 6 years ago

Ok... I was posting image to see if you see this or its out of order?

VidYen commented 6 years ago

I forgot I don't think you have to log on to see leaderboards so feel free to post screenshot or link to it.

VidYen commented 6 years ago

So I can see if plug in issue doesn't work.

mcdeimon commented 6 years ago

list

VidYen commented 6 years ago

Hrm... Have you ever edited your points_log table manually with php_admin before?

VidYen commented 6 years ago

The order is right as far as in order... But has gaps from users that had amounts but no longer do.

VidYen commented 6 years ago

Ah. I have an idea. When you ban a user, do you ban but keep the account or do you ban and delete the account? It's possible the table still sees the points but it knows the user is not there so it skips them.

VidYen commented 6 years ago

I realize is that on my test site... No one who ever earned points was banned as only the spam accounts were the ones I deleted and they never earned points.

mcdeimon commented 6 years ago

I think it's that. How can it be solved?

VidYen commented 6 years ago

Ok. I think its on me then, I just need to check if the user id exists in the WP user table and if it doesn't then skip that one when doing rankings.

VidYen commented 6 years ago

Which looking at this... I just need to do an SQL join between the point_log and wp_users

VidYen commented 6 years ago

But give me a few hours or so... As have to step out and SQL problems never seems to be as simple as I think it will be.

mcdeimon commented 6 years ago

Ok!!! Thanks!!!

VidYen commented 6 years ago

Ok. It might be a bit longer. I am running into a issue with the select between two tables that are not the same makeup, but I can solve soon.

VidYen commented 6 years ago

@mcdeimon Ok... I realized I was doing the wrong thing. I didn't need a UNION just an EXISTS on the other table... I did a quick test on my test clone and deleted a user without deleting points and it seems to work. Please test the 1.7.3 on the Github and let me know if it works as you have more users than I do in my test server.

mcdeimon commented 6 years ago

Now the numbers of the rank are shown well!!!

The rows and the bootstrap still do not work. All users with points appear on the same page.

And with [vyps-pl rows = 25] it works perfectly. The problem is only with pb

VidYen commented 6 years ago

Ok. Good to hear it fixed the rank numbers.

Actually, I see why its not limiting. I commented out the pagenation part for some reason. I'll have to figure out why I did that and see if I can get it working again. Or at least show the top 25 etc.

VidYen commented 6 years ago

I've messing around with rows=3 and it does not work at all. Investigating why.

VidYen commented 6 years ago

I think I know the issue. We are looking at $rank_order_array_count rather than $table_row_limit

VidYen commented 6 years ago

For some reason I had commented out the following:

//for ($x_for_count = $table_range_start; $x_for_count >= $table_range_stop; $x_for_count = $x_for_count - 1 ) { //I'm counting backwards. Also look what I did. Also also, there should never be a 0 id or less than 1
VidYen commented 6 years ago

I got this work (somewhat). At least the rows=something works now. By default its 50 but its better than 5,000 on a leaderboard. I feel this is worth a push to the WP SVN repo rather than just GitHub