I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

No trigger from action hooks

dashed-slug.net Forums General discussion No trigger from action hooks

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5491
    Anonymous
    Inactive

    Custom plugin code (headers removed):

    function my_action_wallets_move_receive( $data ) {

    error_log( print_r( $data, true ) ); // prints out a stdClass object

    $file="/var/www/html/txs/logs/wallets_move_receive-tx-". date('Y-m-d') .".logfile";

    if (!file_exists($file))
    {
    // create file
    file_put_contents($file, " ", FILE_APPEND);
    chmod($file,0660);
    }

    file_put_contents( $file,print_r( $data, true ),FILE_APPEND );
    }

    //add_action( 'wallets_move_receive', 'my_action_wallets_move_receive' ,1,1);
    add_action( 'wallets_move_receive', 'my_action_wallets_move_receive');

    #5495
    Anonymous
    Inactive

    Solved, my bad: I was directing the cron script to another development node with same application. In order to trigger transactions as I was planning, I *must* use only one node for completing transactions via curl /?__wallets_action=do_cron&__wallets_apiversion=3&__wallets_cron_nonce=XXXX
    I hope this thread can help somebody else with same issue.

    #5496
    alexg
    Keymaster

    Hello,

    I’m glad you resolved the issue. Some comments:

    You only need to trigger cron yourself if the WordPress cron job does not execute automatically via WordPress, or alternatively you can do this to improve performance, but it is not strictly necessary otherwise.

    You should not rely on the plugins to load in any particular ordering. In fact, this is why we use hooks in the first place, to avoid race conditions on the interfaces between different plugins/themes and WordPress itself. I see from your commented out code that you already know about priorities. As long as you bind your hooks correctly they should execute in the correct precedence.

    If you are running two WordPress instances connecting to the same wallet instance, you need to be careful to maintain enough hot wallet balance for both instances. Personally I don’t think it’s a good idea in terms of security. But if you want to do this, you would need to modify the walletnotify command to do a curl on both your WordPress instances. This will allow both sites to be notified of any new deposit transactions. The plugin will know to record each transaction on the correct site only.

    with regards

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.