Written by on

Registering Third-party Backup Plugins with iThemes Security

One of the benefits of iThemes Security and iThemes Security Pro is the details it gives the user about what has been done to secure their site and what has not been done. As part of this the the plugin checks to see if backups are being utilized (a major part of any security plan) and lets the user know accordingly.

While this is a great way to remind users to create a backup it simply cannot account for the nearly countless ways backups can be accomplished and, out of the box, only looks for either its own backups or those done by BackupBuddy. This means that, by default, if you’re using a different backup solution the plugin simply doesn’t know about and won’t register it in the iThemes Security Dashboard.

For developers of other backup solutions, or just folks who are rolling their own backups, there is a way around this. As of version 4.0 of iThemes Security and 1.0 of iThemes Security Pro we introduced a few hooks that can be used by developers to register their own backup solution in iThemes Security which will then be reflected on the dashboard.

Here’s how it works

  1. Tell iThemes Security that your backup solution is present. For this all you need to do is invoke the custom filter ‘itsec_has_external_backup‘ which will return the value of $has_backup as either true if a backup solution is present or false if not. See the example below to register your solution:
    <!--?php <br ?-->add_filter( 'itsec_has_external_backup', 'itsec_has_external_backup' );
    
    function itsec_has_external_backup() {
        return true;
    }
    

    Once present this will tell the Dashboard that a 3rd party backup solution is present but not whether or not a backup has been scheduled.

  2. Tell iThemes Security if backups have been scheduled. Just because your backup plugin is there doesn’t mean backups have been scheduled. To tell iThemes Security that backups have indeed been scheduled you’ll need another hook. Just like the hook in step 1 it returns either true or false however this time you’ll not just want to return true blindly and actually check to see if the backups are scheduled. See the code below for an example:
    <!--?php <br ?-->add_filter( 'itsec_scheduled_external_backup', 'itsec_scheduled_external_backup' );
    
    function itsec_scheduled_external_backup() {
    
        //remember to check your backups that a schedule has been set and    return accordingly
        return true;
    }
    
  3. Set the link to the backups. Finally, you’ll want to set the iThemes Security “Backup” links to the appropriate location. We’ll use another filter for this to set the link to the appropriate WordPress admin page. See the BackupBuddy example below:
    <!--?php <br ?-->add_filter( 'itsec_external_backup_link', 'itsec_external_backup_link' );
    
    function itsec_external_backup_link() {
        return '?page=pb_backupbuddy_scheduling';
    }
    

While it will take a little bit of work on the part of the backup developers to integrate this code it will make sure that any backup solution (not just BackupBuddy) will play nice with both iThemes Security and iThemes Security Pro by properly displaying the backup condition in the security dashboard.

Comments

Respond

×

Sale Ends Today! Save 35% OFF BackupBuddy with coupon code BACKUPWP35