• Resolved dragnarok.com

    (@testgeeksco)


    Hi, I have tried the example from readme.txt and also tried some other options but it looks it is not possible to disable auto register via existing hook.

    The filter ‘edd_auto_register_disable’ is applied in ‘hooks’ function which is invoked before it is possible to add any filter. For example: add_action( ‘init’, ‘my_child_theme_disable_auto_register’, 11 ); is not working because it is invoked later than hooks function in the EDD Auto Register plugin.
    Or am I doing something wrong?

    Thanks for support.
    Pawel.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Pippin Williamson

    (@mordauk)

    Could you tell me a bit more about what you’re trying to do?

    Thread Starter dragnarok.com

    (@testgeeksco)

    I’d like to disable auto register for all free downloads.
    I tried to add below filter to functions.php, but it does not work.

    function edd_maybe_do_not_insert_user( $payment_id, $payment_data ) {
    if ( edd_get_cart_subtotal() <= 0 ) {
    add_filter( ‘edd_auto_register_disable’, ‘__return_true’ );
    }
    }
    add_action( ‘edd_insert_payment’, ‘edd_maybe_do_not_insert_user’, 9, 2 );

    Plugin Contributor Pippin Williamson

    (@mordauk)

    Try changing

    
    add_action( 'edd_insert_payment', 'edd_maybe_do_not_insert_user', 9, 2 );
    

    to

    
    add_action( 'plugins_loaded', 'edd_maybe_do_not_insert_user', 9, 2 );
    
    Thread Starter dragnarok.com

    (@testgeeksco)

    Hi, it does’t work.
    I think hooks function in EDD_Auto_Register class will always be invoked before any action, am I wrong?

    Plugin Contributor Pippin Williamson

    (@mordauk)

    Apologies for missing your reply.

    Auto Register is instantiated on plugins_loaded with a priority of 10, so to make it work you just need to add your remove_action call inside of a callback that is hooked to plugins_loaded with a priority of 11 or later.

    Thread Starter dragnarok.com

    (@testgeeksco)

    Hi Pippin,

    ok I will try. Thanks for support.

    Regards,
    Pawel

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘edd_auto_register_disable hook does not work’ is closed to new replies.