forked from DevinVinson/WordPress-Plugin-Boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Displaying errors
Moisés Barrachina Planelles edited this page Oct 4, 2023
·
2 revisions
Backend Frontend Template can easily show errors, and it doesn't repeat the same error on the same load. Also: the plugin title will be add to the message
* $this->error_show ($error_message = "") show an error message. If $error_message = "" it shows "Error detected"
* Adding error_message on the GET URL, the error message can be triggered with the functions $this->admin_permission_check() or $this->error_throw()
BFT can throw errors with
$this->error_throw ($error_message = "", $error_throw_what_do_use_this = NULL, $error_throw_file_change_use_this = NULL, $triggered_on_function_load = false, $page_id = NULL)
* $error_message: error to send to $this->error_show(), but first it will display the 'error_message' stored in the URL
* $error_throw_what_do_use_this: for use this data instead of $this->admin_pages_data_get("error_throw_what_do"), options: show_error, show_error_and_die, go_to_parent
* $error_throw_file_change_use_this: default NULL, use this data instead of $this->admin_pages_data_get("error_throw_file_change"), for change the file displayed if error triggered
* $triggered_on_function_load: default false, 'go_to_parent' only works if true == $triggered_on_function_load because it's needed do the redirect before sending the headers (id required data and go to parent are only BFT Pro options)
* $page_id: the key/page name, if null it's the visualized page
This page show an error with:
$error_message = $this->__("This is an error test");
$this->error_show ($error_message);