1
votes

I am attempting to use jQuery DataTables AJAX ServerSide script...

I need to join the wp_usermeta table with the wp_users table...

How do I join the wp_usermeta table using the example server-side processing script? The script can be found at https://datatables.net/examples/server_side/simple.html

The relevant code is

$columns = array(
    array( 'db' => 'user_login', 'dt' => 0 ),
    array( 'db' => 'user_email', 'dt' => 1 ),
);
1

1 Answers

2
votes
$this->datatables->select('um.*,u.*')
        ->from('wp_usermeta as um')
        ->join('wp_users as u','um.user_id=u.user_id')
        ->add_column('View','$1','<a href="example.php?id=$1" class="btn btn-warning view">View</button>')

echo $this->datatables->generate();