Display user’s position in a list

15 years 6 months ago #77115 by flyingwombats
Display user’s position in a list was created by flyingwombats
I was wondering if this was possible but I cannot find a way to do it within the functionality of CB lists.

I have built a site where people can save trees by searching Google. For every search they do, they earn tree credits which they can use to plant trees. I have set up a list which orders all of the users by the number of trees they have saved. This effectively ranks them but I cannot find a way of displaying their rank. You can see what I mean here:

www.gearch.com/users

All I need is for the first column to display the user’s position or rank according to the configuration of that list. This is quite important as people are competitive creatures and so achieving a higher rank will be a great incentive.

I am coming to the conclusion that the only way to do this would be to write a field plugin that calculates a user’s rank based on the values of another (numeric) field. I have even started to write the code to do it for my specific example:

[code:1]$db->setQuery('SELECT COUNT(id) FROM #__comprofiler WHERE cb_trees > '.$usertrees);
$rank = $db->loadResult()+1;[/code:1]

If a CB plugin is the way forwards, it could easily be expanded to display the user’s position within any sorted alpha-numeric fields.

Does anyone know if this can be setup with just lists or whether a plugin is the only way forwards? I feel it would be easier to implement this as a core option within lists then it would be to write a field plugin as it is effectively doing the same thing.

Many thanks.

Please Log in to join the conversation.

15 years 6 months ago #77529 by flyingwombats
Replied by flyingwombats on topic Re:Display user’s position in a list
Anyone?... :blink:

Please Log in to join the conversation.

15 years 6 months ago #77836 by flyingwombats
Replied by flyingwombats on topic Re:Display user’s position in a list
Maybe I got over involved with my question, let me try and simplify it.

Is there any way of displaying a user's rank or position within a list created in Community Builder?

Many thanks :)

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.336 seconds

Facebook Twitter LinkedIn