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 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5489
    Anonymous
    Inactive

    I created a simple plugin to receive information from action hooks wallets_move_receive and wallets_transaction as per your instructions, so I could check transaction information for testing and debugging purposes. But, for some reason, after one or all of the following four operations, my pluggin stopped saving tx info as before:

    1. Updated wallet to 3.93
    2. Installed new theme
    3. Installed BuddyPress
    4. Installed Woocommerce

    Nothing in the error logs, no php errors.

    What I tried, but no luck:

    • Deactivating and reactivating wallet core plugin;
    • Deactivating and reactivating my plugin;
    • Changed name of my plugin to z-something (trying to load last);
    • Gave priority 1 to my custom action to wallet hook wallets_move_receive

    Aside from the fact that BudyPress is not receiving any notifications for transactions, everything else regarding the wallet seems to work fine. My perception is that my plugin is loading before the wallet plugin, that would be the reason for not triggering the actions. Any ideas on what’s going on? Thanks for your help.

    #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 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.