Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter wiseowl9000

    (@wiseowl9000)

    Fantastic! Thanks heaps.

    1. Copy the code below into a file called plugin_filter.php
    2. Change the $pluginsNotToUpdate adding the plugins you want not to update, by using the plugin folder name and plugin filename
    3. Upload the file to your wp-plugins directory
    <?php
    /**
     * @package Plugin_Filter
     * @version 2.0
     */
    /*
    Plugin Name: Plugin Filter
    Plugin URI: https://www.brideonline.com.au/
    Description: Removes certain plugins from being updated.
    Author: Ben Wise
    Version: 2.0
    Author URI: https://github.com/WiseOwl9000
    */
    
    /**
     * @param $update bool Ignore this it just is set to whether the plugin should be updated
     * @param $plugin string Indicates which plugin will be upgraded. Contains the directory name of the plugin followed by / followed by the filename containing the "Plugin Name:" parameters.
     */
    function filter_plugins_bol($update, $plugin)
    {
    /*
    	// debugging
    	error_log(print_r($plugin,true));
    	ob_start();
    		var_dump(func_get_args());
    		$econ = ob_get_contents();
    		debug_print_backtrace();
    	ob_end_clean();
    	error_log($econ);
    */
    	$pluginsNotToUpdate[] = "plugin-folder-name/plugin-file-name.php";
    	// add more plugins to exclude by repeating the line above with new plugin folder / plugin file
    
    	// Allow all plugins except the ones listed above to be updated
    	if (!in_array(trim($plugin),$pluginsNotToUpdate))
    	{
    //		error_log("plugin is not in list allowing");
    		return true; // return true to allow update to go ahead
    	}
    
    //	error_log("plugin is in list trying to abort");
    	return false;
    }
    
    // Now set that function up to execute when the admin_notices action is called
    // Important priority should be higher to ensure our plugin gets the final say on whether the plugin can be updated or not.
    // Priority 1 didn't work
    add_filter( 'auto_update_plugin', 'filter_plugins_bol' ,20  /* priority  */,2 /* argument count passed to filter function  */);
    Thread Starter wiseowl9000

    (@wiseowl9000)

    Thank you very much Stéphane.

    Once I upgraded I had another issue but solved it as follows:

    I’m using the file externall so inlcuded them in the following order (in case anyone else is using this plugin as a stepping stone to integrating something other than phpBB):

    require_once("wp-content/plugins/phpbb-single-sign-on/module.wp.php");
    //Include WordPress
    require_once("wp-blog-header.php");
    // dummy class to allow common-functions.php below to load
    class wpbb_phpBB3
    {
        static function loadConstants(){}
    }
    require_once("wp-content/plugins/phpbb-single-sign-on/common-functions.php");

    Then I can call wpbb_addUser and wp_signon etc.

    Cheers,

    Ben.

    Thread Starter wiseowl9000

    (@wiseowl9000)

    I’m using the latest version (3.4). Upgraded through the wordpress plugin manager ??

    I also see wordpress MU has been merged into wordpress, so it’s all one and the same now, my bad.

    I’m calling the plugin externally (using it to integrate another system into wordpress) so I’ll see if including that ms-functions.php file resolves my issue and if so mark this as resolved.

Viewing 4 replies - 1 through 4 (of 4 total)