Plugin activation/deactivation hook
-
Hello, i try to develop and understanding wp plugins. I started from 0, and trying to add a hook with a notification about activation/deactivation.My start file,look like this:
function activate_vreceiver() { require_once plugin_dir_path( __FILE__ ) . 'config/activare.php'; activare::activareV(); } function deactivate_vreceiver() { require_once plugin_dir_path( __FILE__ ) . 'config/dezactivare.php'; activare::dezactivareV(); } register_activation_hook( __FILE__, 'activate_vreceiver' ); register_deactivation_hook( __FILE__, 'dezactivare_vreceiver' );Page activare/dezactivare here:
class activare { public function activareV() { echo 'Am activat plugin-ul cu success !!'; add_action( 'admin_notices', array( 'notificare' ) ); } public function notificare() { $mesaj = '<div class="notice notice-info is-dismissible"></div>'; return $mesaj; } }I commented # echo line, i setup a new function, i added here
array( ‘notificare’ )
to
array( $this, ‘notificare’ )
But $this is not recognizedm, and frequently i got “The plugin generated 34 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.”
The page I need help with: [log in to see the link]
The topic ‘Plugin activation/deactivation hook’ is closed to new replies.