Below is a trimmed down version of my plugin, to keep it simple. My setup function is being called, but when I go to the login page, it's not dying like it should. I had the plugin working earlier, however I'm trying to re-write it into a class structure to make it more self-contained.
if ( ! function_exists('add_action') ) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
}
add_action('plugins_loaded', array('My_Authentication', 'setup') );
if ( ! class_exists('My_Authentication') ) {
class My_Authentication {
public function setup() {
add_action('wp_login', array(&$this, 'no_auth_allowed') );
add_action('wp_logout', array(&$this, 'no_auth_allowed') );
}
public function no_auth_allowed() {
wp_die('no authentication for you!');
}
}
}
To clarify on what my question is, why isn't the no_auth_allowed()
function being called when I go to the wp-login.php
page?
add_action('wp_logout',
line is corrected does it work?add_action
. You can't call a class method like that.setup()
method fires.