All Projects → WebDevStudios → WDS-Required-Plugins

WebDevStudios / WDS-Required-Plugins

Licence: other
Make certain plugins required so that they cannot be (easily) deactivated. | Gatekeeper: @aubreypwd

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to WDS-Required-Plugins

eventcatalog
Discover, Explore and Document your Event Driven Architectures powered by Markdown.
Stars: ✭ 392 (+409.09%)
Mutual labels:  plugins
kubectl-ssh-plugin-eks
This is plugin to SSH into Worker Nodes running on AWS
Stars: ✭ 18 (-76.62%)
Mutual labels:  plugins
Accordion-Shortcodes
A WordPress plugin that adds a few shortcodes to allow for accordion dropdowns.
Stars: ✭ 16 (-79.22%)
Mutual labels:  plugins
unity-history-window
A simple selection history window for Unity.
Stars: ✭ 118 (+53.25%)
Mutual labels:  plugins
plugins
Officially supported Psi plugins
Stars: ✭ 52 (-32.47%)
Mutual labels:  plugins
vuepress-theme-macgs
💫 A vuepress theme for easyhexo.com
Stars: ✭ 16 (-79.22%)
Mutual labels:  plugins
Useful-Softwares-Tools-list
List of useful Softwares, Tools, Plugins, Utilities (Online/Offline)
Stars: ✭ 22 (-71.43%)
Mutual labels:  plugins
flutter plugins
Flutter插件集合,好用常用的插件.
Stars: ✭ 22 (-71.43%)
Mutual labels:  plugins
Loom
The next generation Minecraft server software and plugin API.
Stars: ✭ 40 (-48.05%)
Mutual labels:  plugins
build-plugin-template
Template repository to create new Netlify Build plugins.
Stars: ✭ 26 (-66.23%)
Mutual labels:  plugins
module-invalidate
Invalidate node.js modules loaded through require()
Stars: ✭ 19 (-75.32%)
Mutual labels:  require
stop-spammers
Stop Spammers — WordPress Plugin
Stars: ✭ 31 (-59.74%)
Mutual labels:  plugins
WP-Gulp-Starter
A starter kit for developing WordPress themes and plugins with Gulp workflow.
Stars: ✭ 26 (-66.23%)
Mutual labels:  plugins
ink
The flexible TypeScript Markdown editor that powers https://octo.app
Stars: ✭ 82 (+6.49%)
Mutual labels:  plugins
toast
Plugin-driven CLI utility for code generation using Go source as IDL
Stars: ✭ 52 (-32.47%)
Mutual labels:  plugins
canorus
Canorus is a free cross-platform music score editor
Stars: ✭ 25 (-67.53%)
Mutual labels:  plugins
react-editor-kit
(alpha) Compose a React-based text editor using a suite of standard plugins
Stars: ✭ 21 (-72.73%)
Mutual labels:  plugins
vim-rzip
Extends zip.vim to browse and write nested zip files
Stars: ✭ 22 (-71.43%)
Mutual labels:  plugins
dotfiles
Opinionated garbage for your terminal. Gotta get that yolo swag.
Stars: ✭ 37 (-51.95%)
Mutual labels:  plugins
livestorm-plugin
This repo hosts the exposed APIs that you can use to create a plugin for your Livestorm organization
Stars: ✭ 25 (-67.53%)
Mutual labels:  plugins

WDS Required Plugins

A library you can use to make any plugins required and auto-activate.

  • Nobody can de-activate the plugin from the WordPress Admin
  • They are auto-activated when required

To use, place this library in your mu-plugins/ directory (if you don't have one, create one in wp-content/), then use the example below:

WebDevStudios. WordPress for big brands.

Installation & Update

With Composer

Add the following to your composer.json

{
    "extra": {
        "installer-paths": {
            "mu-plugins/{$name}/": ["type:wordpress-muplugin"]
        }
    }
}

Then use:

composer require webdevstudios/wds-required-plugins

This will install the mu-plugin, e.g. mu-plugins/wds-required-plugins in wp-content based projects.

You will have to require it in e.g. mu-plugins/wds-required-plugins-list.php:

<?php

require WPMU_PLUGIN_DIR . '/wds-required-plugins/wds-required-plugins.php';

function wds_required_plugins_add( $required ) {
    return array_merge( $required, array(
        'my-plugin/my-plugin.php`,
    ) );
}
add_filter( 'wds_network_required_plugins', 'wds_required_plugins_add' );

Example Usage

<?php

/**
 * Add required plugins to WDS_Required_Plugins.
 *
 * @param  array $required Array of required plugins in `plugin_dir/plugin_file.php` form.
 *
 * @return array           Modified array of required plugins.
 */
function wds_required_plugins_add( $required ) {

	$required = array_merge( $required, array(
		'jetpack/jetpack.php',
		'sample-plugin/sample-plugin.php',
	) );

	return $required;
}
add_filter( 'wds_required_plugins', 'wds_required_plugins_add' );

Use the following filter instead to network activate plugins:

add_filter( 'wds_network_required_plugins', 'wds_required_plugins_add' );

Change the Text:

To change the label from Required Plugin to something else, use the following filter/code:

/**
 * Modify the required-plugin label.
 *
 * @param  string  $label Label markup.
 *
 * @return string         (modified) label markup.
 */
function change_wds_required_plugins_text( $label ) {

	$label_text = __( 'Required Plugin for ACME', 'acme-prefix' );
	$label = sprintf( '<span style="color: #888">%s</span>', $label_text );

	return $label;
}
add_filter( 'wds_required_plugins_text', 'change_wds_required_plugins_text' );

Hide Required Plugins (off by default)

To hide your required plugins from the plugins list, use the following filter/code:

add_filter( 'wds_required_plugins_remove_from_list', '__return_true' );

This will make any plugin that is required simply not show in the plugins list.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].