src/Codeception/Module/WPDb.php
public function grabUserMetaFromDatabase($userId, $meta_key)
    {
        $table = $this->grabPrefixedTableNameFor('usermeta');
        $meta = $this->grabAllFromDatabase($table, 'meta_value', ['user_id' => $userId, 'meta_key' => $meta_key]);
        if (empty($meta)) {
            return [];
        }

        return array_column($meta, 'meta_value');
    }
public function grabUserMetaFromDatabase($userId, $meta_key)
    {
        $table = $this->grabPrefixedTableNameFor('usermeta');
        $meta = $this->grabAllFromDatabase($table, 'meta_value', ['user_id' => $userId, 'meta_key' => $meta_key]);
        if (empty($meta)) {
            return [];
        }

        return array_column($meta, 'meta_value');
    }
public function grabUserMetaFromDatabase ( $ userId , $ meta_key ) { $ table = $ this -> grabPrefixedTableNameFor ( 'usermeta' ) ; $ meta = $ this -> grabAllFromDatabase ( $ table , 'meta_value' , [ 'user_id' => $ userId , 'meta_key' => $ meta_key ] ) ; if ( empty ( $ meta ) ) { return [ ] ; } return array_column ( $ meta , 'meta_value' ) ; }
Gets a user meta from the database.

@example
```php
// Returns a user 'karma' value.
$I->grabUserMetaFromDatabase($userId, 'karma');
// Returns an array, the unserialized version of the value stored in the database.
$I->grabUserMetaFromDatabase($userId, 'api_data');
```

@param int    $userId The ID of th user to get the meta for.
@param string $meta_key The meta key to fetch the value for.

@return array An associative array of meta key/values.

@throws \Exception If the search criteria is incoherent.
Gets a user meta from the database .