Clanbite Ranks Since 1.2.3

clanbite_ranks_progress_metrics_for_level( int $points, array $levels, string $label ): array{current_level: string, next_level: string, next_min_points: int, points_to_next: int, progress_percent: int, is_max_level: bool}

Progress toward the next tier for a rank that is pinned to a level (assigned by an admin) rather than earned.

The current level is the pinned one and the next level is the one after it, so the bar and the "points to go" line follow the rank the member actually holds. Progress is measured from the pinned level's minimum to the next level's minimum and clamped to 0-100 (a balance below the pinned level's minimum shows 0, one already past the next minimum shows 100). Falls back to clanbite_ranks_progress_metrics_for_balance() when the label is not on the ladder.

Namespace: Kernowdev\ClanbiteRanks

Parameters

$points (int) Required

Points balance.

$levels (list<array{label: string, min_points: int, icon_url: string}>) Required

Levels sorted ascending by min_points.

$label (string) Required

Pinned level label.

Returns

array{current_level: string, next_level: string, next_min_points: int, points_to_next: int, progress_percent: int, is_max_level: bool}

Defined in inc/functions.php

Changelog

VersionDescription
1.2.3Introduced.