The problem occurs with the fact that I do not know the anatomy of WordPress(it is a first time i’m working with WP), and the task should be solved urgently. I developed a plugin for openID authorization by one of non-popular openID provider. I developed plugin as though it calls main function on ‘init’ hook. So no one non-authorised user can access any page of site. But task is that i must have “authorise” link on my index page and authorisation must be performed just right after clicking to this link. I tryed to solve problem using custom hook.
I added following to my plugins main file (it is a class function)
public function m_authenticate(){
do_action('m_authenticate');
}
Than added an action like that
add_action('m_authenticate', array(&$this, 'mAuthenticate'), 7);
Here mAuthenticate
is a function which redirects to openID provider for auth.
After that i created a php script with this hook
<?php
m_authenticate();
But on calling this script by browser, it occurs an error that script cannot find a function m_authenticate()
. IF i require script in which m_authenticate()
is defined, then it occurs an error with other lines of this script, for e.g. cannot find function
on line
register_activation_hook( __FILE__, array('some_func', 'addNewWordPressAdmin'));
Pls, help with advise how to make seperate page with this openID functionality. Any help will be appreciated.
Here is one way to solve this problem. Here you have the plugin with the class:
<?php
/* Plugin Name: WP Test */
class MyAuthHookClass {
new MyAuthHookClass();
And in theme structure I put the hook in
header.php
:<?php if(class_exists('MyAuthHookClass')) MyAuthHookClass::m_authenticate(); ?>