Title: User ranking display position
Last modified: August 21, 2016

---

# User ranking display position

 *  Resolved [cioka99](https://wordpress.org/support/users/cioka99/)
 * (@cioka99)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/user-ranking-display-position/)
 * Is there a way to display the user position on User Ranking page??
 * Now :
    user1 user2 user3
 * User Position display.
    **1**.User1 **2**.User3 **3**.User4
 * Thank you.
 * [https://wordpress.org/plugins/world-cup-predictor/](https://wordpress.org/plugins/world-cup-predictor/)

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [landoweb](https://wordpress.org/support/users/landoweb/)
 * (@landoweb)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5004806)
 * Since there is no paging in free version, I’ll try to check it in the update 
   tonight.
 *  Plugin Author [landoweb](https://wordpress.org/support/users/landoweb/)
 * (@landoweb)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5004933)
 * You can do this changing 3 lines of file wcp-reports.class.php:
 * 1) Search for function user_ranking() and inside it locate the command `foreach(
   $result as $row) {`
 * 2) Before this command, create a variable `$pos = 1;`
 * 3) Inside the foreach, look for the line:
 * `$output .= "<tr $style><td class='wcup-user'>".($avatar ? get_avatar( $row->
   ID, '16', '', $row->display_name ) : '').' '.$row->display_name."</td><td class
   ='wcup-points'>$row->total</td><td class='wcup-review'>";`
 * Change it to:
 * `$output .= "<tr $style><td class='wcup-user'>".($avatar ? get_avatar( $row->
   ID, '16', '', $row->display_name ) : '').' '.$pos . '. ' . $row->display_name."
   </td><td class='wcup-points'>$row->total</td><td class='wcup-review'>";`
 * 4) Finally, before closing the foreach block, add `$pos++;`.
 * Your code will look like this:
 *     ```
       $pos = 1;
       		foreach ($result as $row) {
       			if ($row->ID == $curr_user_id) {
       				$style = "style=\"$highlight\"";
       			} else {
       				$style = 'class="wcup-row"';
       			}
       			$output .= "<tr $style><td class='wcup-user'>".($avatar ? get_avatar( $row->ID, '16', '', $row->display_name ) : '').' '.$pos . '. ' . $row->display_name."</td><td class='wcup-points'>$row->total</td><td class='wcup-review'>";
   
       			if (get_option($this->prefix.'player_predictions')) {
       				$output .= "<a class='review-link' title='".__('Predictions', WCP_TD)."' href=\"".get_option($this->prefix.'player_predictions')."&wcp=predictions&user=".$row->ID."\"><img src='". WP_PLUGIN_URL."/".WCP_TD ."/images/predictions.png' /></a>";
       			}			
   
       			$output .= "</td></tr>" . PHP_EOL;
       			$pos++;
       		}
       ```
   
 * This can be seen in [http://www.wcp.net.br/ranking-of-players/](http://www.wcp.net.br/ranking-of-players/)
 *  [farhaz1907](https://wordpress.org/support/users/farhaz1907/)
 * (@farhaz1907)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5004973)
 * Hi landoweb,
 * Thank you very much for this solution.
 * I’d just add something to the above code to cater for members having equals points.
   Example:
 * 1. member1 60pts
    2. member2 58pts 2. member3 58pts 3. member4 55pts
 *     ```
       $pos = 1;
       $oldTotal = -1;
       foreach ($result as $row) {
   
       	if($oldTotal > $row->total){
       		$pos++;
       	}
   
       	if ($row->ID == $curr_user_id) {
       		$style = "style=\"$highlight\"";
       	} else {
       		$style = 'class="wcup-row"';
       	}
       	$output .= "<tr $style><td class='wcup-user'>".($avatar ? get_avatar( $row->ID, '16', '', $row->display_name ) : '').' '.$pos . '. ' . $row->display_name."</td><td class='wcup-points'>$row->total</td><td class='wcup-review'>";
   
       	$oldTotal = $row->total;
   
       	if (get_option($this->prefix.'player_predictions')) {
       		$output .= "<a class='review-link' title='".__('Predictions', WCP_TD)."' href=\"".get_option($this->prefix.'player_predictions')."&wcp=predictions&user=".$row->ID."\"><img src='". WP_PLUGIN_URL."/".WCP_TD ."/images/predictions.png' /></a>";
       	}
       	$output .= "</td></tr>" . PHP_EOL;
       }
       ```
   
 *  Plugin Author [landoweb](https://wordpress.org/support/users/landoweb/)
 * (@landoweb)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5004987)
 * [@cioka99](https://wordpress.org/support/users/cioka99/) and [@farhaz1907](https://wordpress.org/support/users/farhaz1907/)
 * Do you could inform link their websites to I see if this issue is resolved?
 *  Thread Starter [cioka99](https://wordpress.org/support/users/cioka99/)
 * (@cioka99)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5004989)
 * it’s working for me.
 * [http://www.zumbet.com/](http://www.zumbet.com/)
 * rankings page :
 * [http://zumbet.com/clasament-useri/](http://zumbet.com/clasament-useri/)
 *  [chuntah](https://wordpress.org/support/users/chuntah/)
 * (@chuntah)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5004994)
 * I have added a small improvement onto farhaz1907’s solution.
    Example:
 * 1. member1 60pts
    2. member2 58pts 2. member3 58pts 4. member4 55pts
 * As you can see the member4 is ranked 4th and not 3rd as in farhaz1907’s solution.
 *     ```
       $pos = 1;
       $count = 1;
       $oldTotal = -1;
       foreach ($result as $row) {
   
       	if($oldTotal > $row->total){
       		$pos = &count;
       	}
   
       	if ($row->ID == $curr_user_id) {
       		$style = "style=\"$highlight\"";
       	} else {
       		$style = 'class="wcup-row"';
       	}
       	$output .= "<tr $style><td class='wcup-user'>".($avatar ? get_avatar( $row->ID, '16', '', $row->display_name ) : '').' '.$pos . '. ' . $row->display_name."</td><td class='wcup-points'>$row->total</td><td class='wcup-review'>";
   
       	$oldTotal = $row->total;
   
       	if (get_option($this->prefix.'player_predictions')) {
       		$output .= "<a class='review-link' title='".__('Predictions', WCP_TD)."' href=\"".get_option($this->prefix.'player_predictions')."&wcp=predictions&user=".$row->ID."\"><img src='". WP_PLUGIN_URL."/".WCP_TD ."/images/predictions.png' /></a>";
       	}
       	$output .= "</td></tr>" . PHP_EOL;
               $count++;
       }
       ```
   
 *  [ba1udze](https://wordpress.org/support/users/ba1udze/)
 * (@ba1udze)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5004998)
 * [@cioka99](https://wordpress.org/support/users/cioka99/)
 * hello!
    can you help make the same system, in page with result of match, you 
   have group of ho much points have users, and how many users make predict for 
   1 team, egal and other team.
 * how you do it?
 *  [ba1udze](https://wordpress.org/support/users/ba1udze/)
 * (@ba1udze)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5004999)
 * User ranking display position
    it would be done in next plugin versions?
 *  Thread Starter [cioka99](https://wordpress.org/support/users/cioka99/)
 * (@cioka99)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5005001)
 * yes , i will post the code tonight. I am now editing a little bit the user profile
   ranking.
    I want to display in user ranking also : Avatar, Position in ranking
   table , How many victories user has predicted , how many draws, how many correct
   scores , etc.
 *  Plugin Author [landoweb](https://wordpress.org/support/users/landoweb/)
 * (@landoweb)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5005002)
 * [@ba1udze](https://wordpress.org/support/users/ba1udze/)
 * The ranking position will be present in version 1.9.2.
 * Regarding the customizations made ​​by cioka99, will not be present because they
   are a bit more complex.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘User ranking display position’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/world-cup-predictor.svg)
 * [World Cup Predictor](https://wordpress.org/plugins/world-cup-predictor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/world-cup-predictor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/world-cup-predictor/)
 * [Active Topics](https://wordpress.org/support/plugin/world-cup-predictor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/world-cup-predictor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/world-cup-predictor/reviews/)

 * 10 replies
 * 5 participants
 * Last reply from: [landoweb](https://wordpress.org/support/users/landoweb/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/user-ranking-display-position/#post-5005002)
 * Status: resolved