• Thanks Alex, we installed it and it works great.

    However one possible related problem.

    When my builders try to create a new website in our multisite setup, they are getting this error (note the site is still created, but the success page is blank):

    Fatal error: Using $this when not in object context in \wp-content\plugins\multisite-auditor\functions.php on line 84

    Any ideas? It seems it is failing writing the new blog to db based on that line number.

    	public static function MSA_updateThemeNewBlog($blogID)
    	{
    		$blogInfo = MSA_functions::getBlogInfo($blogID);
    		$this->MSA_addThemeToDB($blogInfo);
    	}
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Alex Furr

    (@alexfurr)

    Hi,
    Thanks for the feedback. I’ll try to reproduce the fault and fix. Hopefully a straight forward issue.

    I assume you’re creating the sites using the standard network admin pages.
    Alex

    Thread Starter apolakos

    (@apolakos)

    Yes, according to my site builders they use the built-in standard network admin pages. Thanks much!

    Plugin Author Alex Furr

    (@alexfurr)

    Hi – So I’ve got debugging turned on for my multisite and tried creating a new site here:

    Network Admin > Sites > Add new

    And the site was created successfully and it added the info to the DB without a problem / error.
    So I’m not sure whats going on, but I’ll modify the code so it won’t fail and then update the plugin version. I’ll let you know when its done so you can test.

    Alex

    Thread Starter apolakos

    (@apolakos)

    Thanks ALex.

    Thread Starter apolakos

    (@apolakos)

    Just an FYI: We were able to resolve it (in an extremely hacky way) on our installation.

    we noticed that $this was returning NULL on line 84. So we just pulled the entire MSA_addThemetoDB up into the MSA_updateThemeNewBlog function.

    	public static function MSA_updateThemeNewBlog($blogID)
    	{
    
    		$blogInfo = MSA_functions::getBlogInfo($blogID);
    		// $this->MSA_addThemeToDB($blogInfo);  <-- was NULL here
    		global $wpdb;
    		
    		$blogID = $blogInfo['blogID'];	
    		$themeName = $blogInfo['themeName'];
    		$blogName = $blogInfo['blogName'];
    		$blogURL = $blogInfo['blogURL'];
    		$dateCreated = $blogInfo['dateCreated'];
    		$myDate= date('Y-m-d h:i:s');		
    		
    		// Delete from theme database any old data about this blog
    		$table_name = $wpdb->base_prefix . "MSA_themes";					
    		$deleteSQL = 'DELETE FROM '.$table_name.' WHERE blogID = %d';
    		
    		$RunQry = $wpdb->query( $wpdb->prepare(	$deleteSQL, $blogID  ));
    		
    		$myFields="INSERT into ".$table_name." (blogID, themeName, blogName, blogURL, dateCreated, activateDate) ";
    		$myFields.="VALUES (%u, '%s', '%s', '%s', '%s', '%s')";
    		
    		$RunQry = $wpdb->query( $wpdb->prepare($myFields,
    			$blogID,
    			$themeName,
    			$blogName,
    			$blogURL,
    			$dateCreated,
    			$myDate
    		));			
    	}

    Hacky? Heck yeah. But it works!

    Plugin Author Alex Furr

    (@alexfurr)

    Great, as long as it works!
    Will try to sort a more permanent solution going forward…

    Alex

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Error when creating new sites’ is closed to new replies.