WP Database Backup: Quick Fix

Please be advised that this plugin is now deprecated and is no longer actively supported. Recent updates to the WordPress Database Backup plugin have addressed the issue that this temporary fix was originally intended to resolve. However, for users who prefer not to upgrade or require specific functionalities offered by this version, the plugin will remain available for download.

The WordPress Database Backup plugin, developed by Austin Matzko, has long been recognized as one of the most user-friendly backup solutions for WordPress websites. Despite its user-friendly interface and absence of intimidating warnings, an issue arose for users operating WordPress versions 1.9.1 to 2.8, particularly with WordPress Database Backup version 2.2.2. In these versions, the plugin's navigation menu mysteriously disappeared, rendering it difficult for users to access essential management features or initiate manual backups. Recognizing the immediate need for a solution, we developed a quick fix and made it available for download until the author addressed the issue in subsequent updates.

While the primary issue revolved around the lack of management capabilities, this tutorial will cover two key modifications. Firstly, it will demonstrate how to rediscover and relocate the missing menu to a more accessible location under the Settings dropdown. Additionally, it will provide guidance on granting permissions to users other than the administrator, ensuring comprehensive access to essential backup functionalities across the WordPress platform.

Download Plugin

Instructions for Updating

In order to access the plugin's settings page, we will relocate the menu by altering the current page_hook from "add_management_page" to one of the many other options available ( see Adding Administration Menus codex ) provided by WordPress for more information.

Rediscover and Relocate

For our purposes, we will be moving it to the Settings dropdown by using "add_options_page". Begin by locating the "wp-db-backup.php" file and look for the following line of code at 593:

function admin_menu() {
  $_page_hook = add_management_page(__('Backup','wp-db-backup'), __('Backup','wp-db-backup'), 'import', $this->basename, array(&$this, 'backup_menu'));
    add_action('load-' . $_page_hook, array(&$this, 'admin_load'));
    if ( function_exists('add_contextual_help') ) {
    $text = $this->help_menu();
    add_contextual_help($_page_hook, $text);
   }
  }

and alter it from "add_management_page" to "add_options_page" which will move it from the Edit drop-down to the Settings drop-down helping to keep the menu structure clean and organized.

function admin_menu() {
  $_page_hook = add_options_page(__('Backup','wp-db-backup'), __('Backup','wp-db-backup'), '1', $this->basename, array(&$this, 'backup_menu'));
    add_action('load-' . $_page_hook, array(&$this, 'admin_load'));
    if ( function_exists('add_contextual_help') ) {
    $text = $this->help_menu();
    add_contextual_help($_page_hook, $text);
   }
  }

To complete the move locate this next line of code starting at 601:

function fragment_menu() {
  $page_hook = add_management_page(__('Backup','wp-db-backup'), __('Backup','wp-db-backup'), 'import', $this->basename, array(&$this, 'build_backup_script'));
    add_action('load-' . $page_hook, array(&$this, 'admin_load'));
   }

and again alter it from "add_management_page" to "add_options_page".

function fragment_menu() {
  $page_hook = add_options_page(__('Backup','wp-db-backup'), __('Backup','wp-db-backup'), 'import', $this->basename, array(&$this, 'build_backup_script'));
    add_action('load-' . $page_hook, array(&$this, 'admin_load'));
   }

This completes the Rediscovery and Relocation and at this point, it is not necessary to move forward with the next step for Administrative access only. Because we needed to grant permissions to the Backup option for all users, we will demonstrate this as well.

Grant Permissions

In order to grant usage permissions, WordPress provides a very intuitive and useful sliding scale ranging from 1 to 10 as well as a myriad of other capabilities specific to a user level to determine the access a particular user may have. For further information on this subject please see the Roles and Capabilities codex provided by WordPress.

Currently WordPress Database Backup utilizes the "import" role granting access by the site administrator only. We will be making a minor alteration to grant all but subscribers access by using "level_1". Locate the following function starting at 592:

function admin_menu() {
  $_page_hook = add_management_page(__('Backup','wp-db-backup'), __('Backup','wp-db-backup'), 'import',

and alter "import" to "level_1".

function admin_menu() {
  $_page_hook = add_options_page(__('Backup','wp-db-backup'), __('Backup','wp-db-backup'), 'level_1',

Next, locate the following function starting on line 601:

function fragment_menu() {
  $page_hook = add_management_page(__('Backup','wp-db-backup'), __('Backup','wp-db-backup'), 'import',

and again alter "import" to "level_1".

function fragment_menu() {
  $page_hook = add_management_page(__('Backup','wp-db-backup'), __('Backup','wp-db-backup'), 'level_1',

To complete the user access permissions locate the following on line 1389:

if ( ( $this->wp_secure('fatal', $loc) ) && current_user_can('import') )
  $can = $this->verify_nonce($_REQUEST['_wpnonce'], $this->referer_check_key, $loc);

and alter "import" to "level_1".

if ( ( $this->wp_secure('fatal', $loc) ) && current_user_can('level_1') )
  $can = $this->verify_nonce($_REQUEST['_wpnonce'], $this->referer_check_key, $loc);

Please note that any role or capability access can be used, we simply needed this particular role.

Release
  • 04 Sep 2009
Version
  • 2.3.1
WP Version
  • 2.8-
Install details
    1. Download the plugin and expand it.
    2. Copy the wp-db-backup folder into your plugins folder (wp-content/plugins).
    3. Log in to the WordPress administration panel and visit the Plugins page.
    4. Locate the wp-db-backup plugin and click on the activate link.
    5. The plugin will attempt to create a directory titled /wp-content/backup-*/ within your WordPress directory.
    6. It may be necessary to make the "wp-content" folder writable to create this directory.
    7. Follow the instructions on this page for compatibility with WordPress 2.8 - 1.9.1
Release
  • Sept. 4, 2009
Version
  • 2.3.1
WP Version
  • 2.8-
Install details
    1. Download the plugin and expand it.
    2. Copy the wp-db-backup folder into your plugins folder (wp-content/plugins).
    3. Log in to the WordPress administration panel and visit the Plugins page.
    4. Locate the wp-db-backup plugin and click on the activate link.
    5. The plugin will attempt to create a directory titled /wp-content/backup-*/ within your WordPress directory.
    6. It may be necessary to make the "wp-content" folder writable to create this directory.
    7. Follow the instructions on this page for compatibility with WordPress 2.8 - 1.9.1