¿Podría ayudarme a lidiar con este problema (la línea 12 está marcada en el código):
( ! ) Error fatal detectable: el objeto de la clase wpdb no se pudo convertir en una cadena en C:OSPaneldomainsvedwp-contentpluginsved-currenciesinstaller.php en la línea 12
ved-monedas.php
<?php
function installer(){
include('installer.php');
$installer = new Installer;
$installer -> activate();
}
register_activation_hook( __file__, 'installer' );
function deactivate(){
include('installer.php');
$installer = new Installer;
$installer -> deactivate(); ;
}
register_deactivation_hook( __FILE__, 'deactivate' );
instalador.php
<?php
class Installer {
private $wpdb;
private $table_name;
private $charset_collate;
public function __construct() {
global $wpdb;
$this->wpdb = $wpdb;
$this->table_name = $this->$wpdb->prefix . 'ved_currencies'; // Line 12
$this->charset_collate = $wpdb->get_charset_collate();
}
public function activate(){
$sql = "CREATE TABLE $this->table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT UNIQUE,
date date not null,
char_code varchar(3) NOT NULL,
name varchar(40) NOT NULL,
nominal int(9) NOT NULL,
value DECIMAL(20,20) NOT NULL,
PRIMARY KEY (date, char_code)
) $this->charset_collate;";
if ( ! function_exists( 'maybe_create_table' ) ) {
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
}
maybe_create_table( $this->table_name, $sql);
}
public function deactivate(){
$sql = "drop table if exists $this->table_name";
dbDelta($sql);;
}
}
.