Jump to content

using multi-instances with dynamic multi-sites problem


swampmusic
 Share

Recommended Posts

Having a problem with a basic multi-site instance.

The multi-sites are dynamically created and run as sub-domains and all is ok with them. They are created during a sign up process by end users.

During the sign up process - once the new site & db has been created, I had planned to load the new site instance and add a new user to it, using code similar to this..

$newSiteInstance = new ProcessWire($path, $newSiteUrl);
 
$u = $newSiteInstance->users->add($sitename);
$u->pass = $pass;
$u->email = $email;
$u->addRole('content-viewer');
$x = $newSiteInstance->users->save($u);

 This won't work in the registration script. It throws an error ... "SQLSTATE[42S02]: Base table or view not found".

However, if I halt the script, load the new site incognito/other browser, then continue the script, all works perfectly.

So $newSiteInstance = new ProcessWire($path, $newSiteUrl); doesn't seem to work for me unless a site has already been loaded in a browser or instantiated somehow.

I am missing something here ? Does a site need to be bootstrapped before new instance will work on it ? 

Sorry, pretty new to this php/PW arena.  Having fun though :-)

Any ideas folks ?

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...