cedaro / satispress

Expose installed WordPress plugins and themes as Composer packages.
500 stars 48 forks source link

Plugins whitelisted by default #154

Closed LucasDemea closed 3 years ago

LucasDemea commented 3 years ago

Hi, Is there a way to enabled satispress by default for each new installed plugin ?

bradyvercher commented 3 years ago

There isn't a setting for that, but you could replace the whitelist repository with the plugins repository. You wouldn't be able to remove plugins going this route, though.

add_action( 'satispress_compose', function( $plugin, $container ) {
    $container['repository.whitelist'] = $container['repository.plugins'];
}, 10, 2 );
LucasDemea commented 3 years ago

Thank you, this solution could cover my needs. Otherwise is there a filter or something that could be a starting point to add this feature by code ?

bradyvercher commented 3 years ago

You can create your own repository with your own rules and replace it in the same way. Or use the satispress_plugins filter. The whitelist repository actually starts with all installed plugins and themes and filters out ones that haven't been enabled.

LucasDemea commented 3 years ago

Thanks, will have a look at that !

LucasDemea commented 2 years ago

Just for reference, I ended up adding a mu-plugin with :

function satispress_plugin_filter() {
    return array_keys( get_plugins() );
}

add_filter( 'satispress_plugins', 'satispress_plugin_filter' );

This way, all newly added plugin are automatically satispress-enabled.