Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • @tgglv hacking WordPress Core seems also a good solution.

    The problem with the mime is a Core Issue then.

    Thread Starter killua99

    (@killua99)

    Sorry that I didn’t mention it, yes, I knew it was another plugin that was doing that. I skip the debugging to actually track the entire runtime. But caught me it was the only Notice I was getting.

    This is the plugin that I thing was causing it https://github.com/bueltge/multisite-global-media

    But well, I think I’ve more than once plugin that use the same hook, but this plugin was the only one causing that message. Nothing wrong with the plugin, but could be cool to have a check for WP_Post instanceof of the $attachment in case something is wrong.

    Thread Starter killua99

    (@killua99)

    Hi, is not the best solution I’m with you, but was the only place to put the code.

    The latest version of the premium plugin, the 4.5.5.

    Thread Starter killua99

    (@killua99)

    If you want to avoid a PHP Notice, override the file class-admin.php on your Premium Plugin.

    And replace the entire function fetch_plugin()

    	/**
    	 * @return object
    	 */
    	private function fetch_plugin() {
    		static $data;
    
    		if( $data === null ) {
    			$client = $this->get_api_client();
    			try {
    				// @NOTE this should probably be dynamic
    				$data = $client->request( 'GET', '/plugins/premium?format=wp' );
    				if ( !empty($data->sections)) {
    					$data->sections = (array) $data->sections;
    				}
    				if( ! empty( $data->banners ) ) {
    					$data->banners = (array) $data->banners;
    				}
    
    				// add activation token to download URL's
    				$license = $this->load_license();
    				if( ! empty( $license->token ) ) {
    
    					if (!empty($data->package)) {
    						$data->package = add_query_arg( array( 'token' => $license->token ), $data->package );
    					} else {
    						$data->package = add_query_arg( array( 'token' => $license->token ), null );
    					}
    					$data->download_link = $data->package;
    				} else {
    					$data->sections['changelog'] = '<div class="notice notice-warning"><p>' . sprintf( 'You will need to <a href="%s">activate your plugin license</a> to install this update.', admin_url( 'admin.php?page=mailchimp-for-wp-other' ) ) . '</p></div>' . $data->sections['changelog'];
    					$data->upgrade_notice = 'You will need to activate your plugin license to install this update.';
    					$data->package = '';
    				}
    			} catch( Exception $e ) {
    				$data = (object) array();
    			}
    		}
    Thread Starter killua99

    (@killua99)

    If you keep it Open Source I would like to help you rewriting the code.

    You could take a look at my code, https://github.com/killua99

    Cheers

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