The MU forums have moved to

add_action register_form (4 posts)

  1. easysleeper
    Posted 15 years ago #

    Ok why does this not work?

    I created a plugin, it's in the mu-plugins folder, and I've simplified it for trouble shooting to this:

    if (!class_exists('my_test_class')) {
    class my_test_class {
    function my_test_class() {
    add_action('register_form', array(&$this, 'register_form'));
    function register_form() {
    echo '<p>TEST</p>';
    } //end class
    } //end if

    Shouldn't this put make TEST appear at the end of the new user registration form?

    Obviously I am trying to do more but when it continuously failed I made it very simple, and still it fails.

    Thanks guys.

  2. sbrajesh
    Posted 15 years ago #

    Hi,your code snippet indicates,you have only declared the class,but not made any object of it.that's why ,the action is not getting attached,try creating the object and it will work.


  3. SteveAtty
    Posted 15 years ago #

    You've put the add_action inside the class definition? It looks a lot more complicated that it needs to be.

  4. easysleeper
    Posted 15 years ago #

    OH I fixed this a few days ago, sorry I should have said so I suppose.

About this Topic

  • Started 15 years ago by easysleeper
  • Latest reply from easysleeper