WPPizza – A Restaurant Plugin for WordPress › Support › General Support › wppizza_on_order_execute
- AuthorPosts
- 22 August, 2017 at 10:08 pm #30175
Hello,
atm I’ve this snippet in my class.wppizza.order_execute.php:
do_action(‘wppizza_on_order_execute’, ‘sendFAX’);
function sendFAX($order_id) {
fopen(“https://xxx.de/gateway.php?oid=” . $order_id, “r”);
}Problem: This hook doesn’t call my function ‘sendFAX’. What’s wrong here?
The “fopen” part does work. (tested in a other project)22 August, 2017 at 10:16 pm #30176I don’t know, why my code is so bad formatted – right one:
do_action('wppizza_on_order_execute', 'sendFAX'); function sendFAX($order_id) { fopen("https://xxx.de/gateway.php?oid=" . $order_id, "r"); }
23 August, 2017 at 3:19 am #30186>I don’t know, why my code is so bad formatted
because you did not put it into code tags>This hook doesn’t call my function
because it’s wrong
you need toadd_action
, notdo_action
https://developer.wordpress.org/reference/functions/add_action/
23 August, 2017 at 7:54 pm #30219/************************************************************** wppizza_on_order_execute - action hook action hook - add order formatted and templates output(if set) **************************************************************/ $order_for_templates = WPPIZZA()->order->results_formatted('order_templates', $order_for_templates); /* filter , depending on parameters set, returns array(with order id, order deails , order formatted , selected print template output) */ $template_ids = apply_filters('wppizza_on_order_execute_get_print_templates_by_id', array()); /** get print templates array to add to on order execute if set above */ $print_templates = $this->get_print_templates($template_ids, $order_id, $order_details['localization'], $order_for_templates); /** do action */ add_action('wppizza_on_order_execute', 'sendFAX'); function sendFAX($order_id) { fopen("https://xxx.de/gateway.php?oid=" . $order_id, "r"); }
The same result … :/
23 August, 2017 at 7:59 pm #30220are you editing the core files ?????
23 August, 2017 at 8:04 pm #30221erm… i don’t know, i just found “wppizza_on_order_execute” in this f ile so i thought, that i have to add my snippet there.
filename: /plugins/wppizza/classes/class.wppizza.order_execute.php23 August, 2017 at 8:05 pm #30222i did not even take this in:
>atm I’ve this snippet in my class.wppizza.order_execute.php:……please, please, please, learn how to use action and filter hooks
do not EVER edit core/plugin/wp files . thats PRECISLEY why filters and action hooks existmay i suggest: https://pippinsplugins.com/quick-introduction-to-action-hooks/
or indeed
https://www.google.co.uk/search?q=introduction+to+wordpress+hooksyou MUST learn about how WP actions and filters work if you want to do *any* kind of customisation of WP
- AuthorPosts
- The topic ‘wppizza_on_order_execute’ is closed to new replies.