I am trying to modify a plugin, I added a field that is called user_name, The plguin consists of counting the number of visitors to the page and who visited it through the ip .. what I want is for me to record the username in the table but I can not get it. this is the code
if ( ! $this->result ) {
//aqui agarro el nombre de usuario logueado
$user = wp_get_current_user();
$usuario = $user->user_login;
$wpdb->insert(
$wpdb->prefix . "statistics_visitor",
array(
'last_counter' => $this->Current_date( 'Y-m-d' ),
'referred' => $this->get_Referred(),
'agent' => $this->agent['browser'],
'platform' => $this->agent['platform'],
'version' => $this->agent['version'],
'ip' => $this->get_IP(),
'location' => '000',
//aqui es donde lo trato de insertar
'user_name' => $usuario,
)
);
}
Any help I'm doing wrong? .. the plugin is called Wp-Statistic