Skip to content

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

@Jimmi08

Description

@Jimmi08

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

Metadata

Metadata

Assignees

Labels

type: bugA problem that should not be happening

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions