Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{LEVEL} shortcode - ranks issue for first level #4670

Closed
Jimmi08 opened this issue Jan 20, 2022 · 0 comments · Fixed by #4735
Closed

{LEVEL} shortcode - ranks issue for first level #4670

Jimmi08 opened this issue Jan 20, 2022 · 0 comments · Fixed by #4735
Assignees
Labels
type: bug A problem that should not be happening
Milestone

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented Jan 20, 2022

Bug Description

For testing purposes using both versions:
{LEVEL=pic}
{LEVEL=glyph}

First user is always correct: (one star both)
image

Next user shows 11 stars (because there is no image for 11 star it looks like without rank)
image

Only default ranks are used.
After trying to find a reason, ranks for next users (except first one) are:

    [10] => Array
        (
            [name] => Level 10
            [thresh] => 1500
            [lan_pfx] => 0
            [image] => lev10.png
            [id] => 1326
        )

    [0] => Array
        (
            [thresh] => 
        )

for third one:

    [0] => Array
        (
            [thresh] => 
        )

    [11] => Array
        (
            [name_parsed] => 
        )

etc...
so this is not correct:
$lastRank = count($this->ranks['data'])
and stars count for default rank is wrong.

After checking the code I noticed:

  • ranks keys for data subarray should be 1 ... 10 - it is correct

  • but foreach for it is going from 0 - 9
    for($i=0; $i < $lastRank; $i++)

  • check of default level is
    - if($level <= varset($this->ranks['data'][0]['thresh']))
    but there shouldn't be this value with key 0

I couldn't find a reason why the ranks array was changed, so maybe there is other reason

How to Reproduce

  • check some user with first level without any posts etc.. rank 1

Expected Behavior

displaying default level - one star for both shortcodes

@Jimmi08 Jimmi08 added the type: bug A problem that should not be happening label Jan 20, 2022
@CaMer0n CaMer0n added this to the e107 2.3.2 milestone Apr 1, 2022
CaMer0n added a commit that referenced this issue Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A problem that should not be happening
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants