Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • I think is more logic if the users A B and C are #1

    That is easy to do.

    Let me know if that works for you.

    Thread Starter casidos

    (@casidos)

    I have a problem with the Apache2 Mod Rewrite.

    I make a change in virtualhost file and all the links work correctly.

    Thanks for your concern.

    Hello,

    I just figure out how to sort the Ranking with the following code.

    Just Copy and Paste from the Comment Line from the original code.

    // final chance to change the ranking before printing it
    		$ranking = apply_filters( 'footballpool_print_ranking_ranking', $ranking );
    		
    		$ranking_count = count( $ranking );
    		
    		$prevPoints = 0;
    		$rankingAccount = 0;
    		$userAbove = 0;
    		
    		foreach ( $ranking as $row ) {
    			$class = ( $i % 2 != 0 ? 'odd' : 'even' );
    			if ( $all_user_view ) $class .= ' league-' . $row['league_id'];
    			if ( $row['user_id'] == $user ) $class .= ' currentuser';
    			
    			$currentPoints = $row['points'];
    			
    			$toCalc = false;
    			
    			
    			if($currentPoints <> $prevPoints)
    			{				
    				$rankingAccount++;
    				$prevPoints = $currentPoints;
    				$currentRanking = $rankingAccount + $userAbove;
    				$toCalc = true;
    			}
    			
    			if (!$toCalc)
    			{
    				$userAbove++;
    			}
    			
    			// define the template param values
    			$ranking_template_params = array(
    				'rank' => $currentRanking,
    				'user_id' => $row['user_id'],
    				'user_name' => Football_Pool_Utils::xssafe( $this->user_name( $row['user_id'] ) ),
    				'user_link' => esc_url( add_query_arg( array( 'user' => $row['user_id'] ), $userpage ) ),
    				'user_avatar' => $this->get_avatar( $row['user_id'], 'medium' ),
    				'num_predictions' => array_key_exists( $row['user_id'], $predictions ) ? $predictions[$row['user_id']] : 0,
    				'points' => $row['points'],
    				'league_image' => ( isset( $row['league_id'] ) ? $this->league_image( $row['league_id'] ) : '' ),
    				'league_name' => ( isset( $row['league_id'] ) ? $this->league_name( $row['league_id'] ) : '' ),
    				'css_class' => $class,
    				'last_score' => ( isset( $row['last_score'] ) ? $row['last_score'] : '' ),
    				'ranking_row_number' => $i++,
    				'ranking_count' => $ranking_count,
    			);
    			$ranking_template_params = apply_filters( 'footballpool_ranking_ranking_row_params'
    													, $ranking_template_params, $league, $user, $ranking_id, $all_user_view, $type, $row );
    			
    			$output .= Football_Pool_Utils::placeholder_replace( $ranking_template, $ranking_template_params );
    		}
    		$output .= Football_Pool_Utils::placeholder_replace( $template_end, $template_params );
    		
    		return $output;
    	}

    Hello,

    I just figure out how to sort the Ranking with the following code.

    // final chance to change the ranking before printing it
    		$ranking = apply_filters( 'footballpool_print_ranking_ranking', $ranking );
    		
    		$ranking_count = count( $ranking );
    		
    		$prevPoints = 0;
    		$userRanking = 0;
    		
    		foreach ( $ranking as $row ) {
    			$class = ( $i % 2 != 0 ? 'odd' : 'even' );
    			if ( $all_user_view ) $class .= ' league-' . $row['league_id'];
    			if ( $row['user_id'] == $user ) $class .= ' currentuser';
    			
    			$currentPoints = $row['points'];
    			
    			if($currentPoints <> $prevPoints)
    			{
    				$userRanking++;
    				$prevPoints = $currentPoints;
    			}

    where do you that?

    Thread Starter casidos

    (@casidos)

    No Luck.

    I have the correct page for the “See a user’s predictions page” and it render correctly the info for the loged user.

    But if the user click the User Link for a different user it throws a 404.

    This will be useful for Pools with a large user base (100+).

    Do you have an idea how can we change the position ?

    Or maybe doing it from the data base itself?

    I will try to code a solution for the Print page and see how it goes.

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