[wp-hackers] do_action() inside the callback for the register_activation_hook()... doesn't work?

Davit Barbakadze jayarjo at gmail.com
Wed Sep 8 06:14:43 UTC 2010


Thanks Austin,

Probably I will still need to read that part to understand it fully.

I'm calling the dummy function directly now, after messing with
activation hook for hours.

On Tue, Sep 7, 2010 at 9:59 PM, Austin Matzko <austin at ilfilosofo.com> wrote:
> On Tue, Sep 7, 2010 at 12:38 PM, Davit Barbakadze <jayarjo at gmail.com> wrote:
>> Basically I've got plugin class extending framework class which does
>> some dirty staff for it, like creating/updating tables and options
>> upon activation, etc. What I wanted was to trigger an action at the
>> end of  register_activation_hook callback, after all the dirty work
>> has been done, leaving a space for plugin specific extension. But a
>> callback hooked onto the corresponding action, never gets called.
>> Hence the assumption that it isn't possible to trigger an action from
>> within the register_activation_hook() callback. Is it so? Why?
>
> Probably what's happening is that you haven't attached the callbacks
> to that action hook you're trying call, at least within the same page
> load as when your activation hook gets called.
>
> When you activate a plugin, function activate_plugin() includes the
> plugin file as part of a test to make sure that the plugin doesn't
> throw any fatal errors.  However, it does so after many common action
> events have already occurred: "plugins_loaded," "init," etc.  That
> means that any callbacks attached to those action hook events won't
> happen when activate_plugin() does its next step--triggering the
> activation hook.
>
> Instead of attaching a callback to an action hook and then triggering
> the action hook, why don't you just call the callback function
> directly?
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Davit Barbakadze


More information about the wp-hackers mailing list