0

I'm using the Mustache PHP template engine to render a table with details from a wordpress WP_User_Query. My SQL function is this

function getLinkedRunners(){
    $usersByCompanyQuery = new WP_User_Query(
            array(
                    'fields' => 'all',
                    'orderby' => 'bhaa_runner_dateofrenewal',
                    'meta_query' => array(
                            array(
                                    'key' => 'bhaa_runner_company',
                                    'value' => $this->houseid,
                                    'compare' => '=')
                    )
            )
    );
    $users = $usersByCompanyQuery->get_results();
    var_dump($users);
    return $users;
}

which return this data structure

object(Runner)[1021]
  public 'user' => 
    object(WP_User)[3906]
      public 'data' => 
        object(stdClass)[3905]
          public 'ID' => string '6624' (length=4)
          public 'display_name' => string 'zz-zz' (length=11)
      public 'ID' => int 6624
  public 'meta' => 
    array (size=4)
      'first_name' => string 'zzzz' (length=6)
      'last_name' => string 'ccc' (length=4)
      'nickname' => string 'Adzzzzrian cccc' (length=11)
      'description' => string '' (length=0)

which I'm able to render this with a Mustache template

<table class="table-1">
<tr>
<th>Name</th>
<th>nickname</th>
</tr>
{{#users}}

<tr>
<td><b><a href="/runner/?id={{user.data.ID}}">{{user.data.display_name}}</a></b></td>
<td>{{meta['nickname']}}</td>
</tr>

{{/users}}
</table>

The 'user.data.display_name' field renders correctly but i can't seem to reference the details in the 'meta' from the mustache template. Can anybody suggest which syntax might work for this situation?

emeraldjava
  • 10,894
  • 26
  • 97
  • 170

0 Answers0