dashed-slug.net › Forums › General discussion › No trigger from action hooks
Tagged: action, callback, notification, notify, transaction wallets_transaction, wallets_deposit, wallets_move_receive
- This topic has 3 replies, 2 voices, and was last updated 6 years, 5 months ago by
alexg.
-
AuthorPosts
-
January 6, 2019 at 12:54 pm #5491
Anonymous
InactiveCustom 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');
January 6, 2019 at 7:30 pm #5495Anonymous
InactiveSolved, 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.January 7, 2019 at 10:11 am #5496alexg
KeymasterHello,
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 acurl
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
-
AuthorPosts
- You must be logged in to reply to this topic.