Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
549 views
in Q2A Core by
I just accidentally hit the button "Reset to defaults" in the Posting tab of my admin panel. Now I lost a lot of custom html and settings. Wouldn't it be better to pop up a confirmation window?
Q2A version: 1.6.3
by
+1 for your good idea.

1 Answer

+3 votes
by
selected by
 
Best answer

I think so too. My almost addons have that feature. This is a issue that Q2A core should improve.

Plugin example:

  1. Add "reset-confirm" folder under qa-plugin
  2. Add php files (qa-plugin.php and qa-reset-confirm.php)

qa-plugin.php:

<?php
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
  header('Location: ../../');
  exit;
}
qa_register_plugin_layer('qa-reset-confirm.php', 'Reset confirm');

qa-reset-confirm.php:

<?php
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
  header('Location: ../../');
  exit;
}
class qa_html_theme_layer extends qa_html_theme_base {
  function form_button_data($button, $key, $style) {
    if($this->template === 'admin' && $key === 'reset') 
      $button['tags'] .= ' onclick="javascript:return confirm(\'Settings reset to default. Are you OK?\');"';
    qa_html_theme_base::form_button_data($button, $key, $style);
  }
}

Update:

if($this->template === 'admin' && $key === 'reset')  // <<< Updated !

...