• Guys, what am I missing?

    I am writing a plugin, that includes something like: class.php

    In class:
    class random_class {

    function unique_activate_function() {
    error_log(“this worked”)
    }

    }

    my main file:

    $object = new random_class;

    $object->unique_activate_function(); //works perfect!

    register_activation_hook(__FILE__, ‘activate_random_plugin’);

    function activate_random_plugin() {
    global $object
    $object->unique_activate_function(); //FAILS
    }

Viewing 1 replies (of 1 total)
  • Thread Starter chemdream

    (@chemdream)

    If I declare the new object within the function, it works perfect.

    But referencing it in the functions parms, or accessing it via “global” does not work…

Viewing 1 replies (of 1 total)
  • The topic ‘Classes not working in Functions!’ is closed to new replies.