WordPress.org

Ready to get started?Download WordPress

Forums

Participants Database
[resolved] Adding a number column to show ranking of each participant? (3 posts)

  1. Reptar7
    Member
    Posted 1 year ago #

    Is there a way that I can have a column in the table that ranks each participant. So like the top row would be 1, second row 2, third row 3, etc.

    I don't want this to be a field for signup. It is just a ranking that shows up in the table depending on how things are sorted.

    http://wordpress.org/extend/plugins/participants-database/

  2. franc3s
    Member
    Posted 1 year ago #

    Same question here :)
    Any trick?

  3. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    OK, first, create a field titled "Rank" (or whatever). This is only for display purposes, you're going to ignore the value itself. Make this field show up in the list where you want your rank number to appear.

    At the top of your custom list somewhere inside of the PHP tags, but before the line that has $this->have_records() in it, put:

    $rank = 1 + ( $this->pagination->page - 1 ) * $this->page_list_limit;

    In the template, where it has:

    <?php $this->field->print_value() ?>

    Replace it with something like:

    <?php
       if ($this->field->name == 'rank') {
          echo $rank;
          $rank++;
       } else $this->field->print_value();
    ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.