• Resolved killua99

    (@killua99)


    I’m having few of these Notice messages.

    ( ! ) Notice: Undefined property: stdClass::$sections in /www/xxxxx/wp-content/plugins/mailchimp-for-wp-premium/licensing/class-admin.php on line 193

    How could I fix them?

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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();
    			}
    		}
    Plugin Contributor Lap

    (@lapzor)

    Hi,

    What version of the Premium add-on are you using?

    Overwriting the file may not be the best solution as your changes will be undone when the plugin is updated.

    ​Thanks for letting us know.

    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.

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    For support of premium products, please reach us out at “support@mc4wp.com” as it’s against the rules of this forum for us to provide support on plugins not sold here.

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

The topic ‘Undefined property: stdClass::$sections’ is closed to new replies.