It looks like it is possible to reuse the same logic that we did for the tablepress
plugin with password-protected
. I've just done so in https://github.com/cuny-academic-commons/cac/commit/ac63d2dc03b48e95d8db4ade2c45e716242889b1 .
Boone, there are still a bunch of upsell items left over in the interface though. Here's some code I've written that will remove it:
// Dummy Password Protected Pro class.
add_action(
'init',
function() {
if ( ! class_exists( 'Password_Protected_Pro' ) ) {
class Password_Protected_Pro {}
}
},
9
);
// Dummy Login Designer class.
add_action(
'admin_init',
function() {
if ( ! class_exists( 'Login_designer' ) ) {
class Login_designer {}
}
}
);
// Remove some admin tabs.
add_filter(
'password_protected_setting_tabs',
function( $retval ) {
// Remove Multiple Passwords and Content Protection as they're Pro-only.
unset( $retval['manage_passwords'], $retval['content-protection'] );
// Set free-only sub-tabs.
$retval['advanced']['sub-tabs'] = [
'password-protected-page-description' => [
'title' => __( 'Protected Page Content', 'password-protected' ),
'slug' => 'password-protected-page-description',
],
];
$retval['security']['sub-tabs'] = [
'google-recaptcha' => [
'title' => __( 'Google ReCaptcha', 'password-protected' ),
'slug' => 'google-recaptcha',
],
];
$retval['logs']['sub-tabs'] = [
'activity-report' => [
'title' => __( 'Activity Report', 'password-protected' ),
'slug' => 'activity-report',
],
];
return $retval;
}
);
The iffy parts are the dummy Password_Protected_Pro
and Login_designer
classes. We can remove these snippets if we don't want to do this. It will just leave a bit of upsell cruft in the admin area. Let me know what you think once you've had a chance to test.