No, just copying the shortcode is not enough.
Changes in classes\class-football-pool-shortcodes.php:
1. Add the line
add_shortcode( 'fp-user-ranking', array( 'Football_Pool_Shortcodes', 'shortcode_user_ranking' ) );
2. Add the shortcode function inside the class:
public function shortcode_user_ranking( $atts ) {
extract( shortcode_atts( array(
'user' => '',
'ranking' => FOOTBALLPOOL_RANKING_DEFAULT,
'date' => 'now',
'text' => '',
), $atts ) );
$output = $text;
if ( $user == '' || ! is_numeric( $user ) ) {
$user = get_current_user_id();
}
if ( ( int ) $user > 0 ) {
$pool = new Football_Pool_Pool;
$rank = $pool->get_user_rank( $user, $ranking, self::date_helper( $date ) );
if ( $rank != null ) $output = $rank;
}
return apply_filters( 'footballpool_shortcode_html_fp-user-ranking', $output );
}
3. Add function get_user_rank() to the file classes\class-football-pool-pool.php:
public function get_user_rank( $user, $ranking_id = FOOTBALLPOOL_RANKING_DEFAULT, $score_date = '' ) {
global $wpdb;
$prefix = FOOTBALLPOOL_DB_PREFIX;
$sql = $wpdb->prepare(
sprintf( "SELECT ranking FROM {$prefix}scorehistory
WHERE user_id = %%d AND ranking_id = %%d
AND ( %s score_date <= %%s )
ORDER BY score_date DESC LIMIT 1"
, ( $score_date == '' ? '1 = 1 OR' : '' )
) , $user, $ranking_id, $score_date );
return $wpdb->get_var( $sql ); // return null if nothing found
}