Leaderboard Customizations

Author: Noor 242 views

Leaderboard Customizations

By default, the leaderboard will be rendered as a table which consists of three columns: The position, The member and the Points. In this guide I will show you how we can add in our own custom column along with replacing existing columns contents with our own.

Column Headers

The columns you see in the leaderboard table is controlled by the mycred_bp_leaderboard_columns filter. So we can use this filter to remove, rename or add columns.

 

Example 1: Add a custom column called “Avatar“ to the leaderboards.

Column Content

Next we need to render our columns content, or alternatively if you prefer, change the content the built-in columns generate. To render a custom columns content, we need to use the mycred_bp_leaderboard_{$column_id}_column filter.

 

Example 1: Render the content of our custom column

Example 2: Insert a users avatar into the members column in leaderboards instead of adding a new column.