• Resolved dtayl20

    (@dtayl20)


    Hi Antoine

    I have installed the custom ranking template as a plugin. Thankyou!

    I have a custom field at login saved a user meta field.

    Just wondering how I pass that value to the ranking template so that it prints out in new column??

    Adding the column to the ranking template is easy enough. eg <td>%value%</td>

    Just wondering where to edit the query to call and pass the value?

    Thanks again!

    D

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author AntoineH

    (@antoineh)

    hi,

    You will have to add the values to the $params array for each row in the ranking. This can be done via the ‘footballpool_ranking_ranking_row_params’ filter.

    If you want some inspiration, you can have a look at my score breakdown plugin. It also uses this filter to add extra columns per user in the ranking.

    Thread Starter dtayl20

    (@dtayl20)

    Antoine

    Awesome. Thanks. It took me a while… but I got there in the end.

    I had to write a custom function to grab the user meta value from the db. I created a new param and then called the valued using the new function eg

    $params[‘store’]= get_user_store($user_id); (on about line 217 ) of the store breakdown plugin. Added in some error checking for null values and all working nicely.

    function get_user_store($user_id) {
    global $wpdb;
    $sql = "select meta_value from usermeta um where um.meta_key='store_location' and um.user_id = $user_id";
    $row = $wpdb->get_row( $sql, object );
    if ($row==null) {
    $store='';
    } else {
    $store = $row->meta_value;
    }
    return $store;
    }

    Thanks again

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Column on Ranking page’ is closed to new replies.