My Problem
========
I have a database that has tables and pre-set data in some of them, my problem now is that whenever a new user signs up in Drupal; i want to be able to copy this database to a new one called database_ so it is unique to the user who registered.

The database used is mysql.

What is the best course of action to do this?

Comments

carlmcdade’s picture

You want to actually create an entire database for each new user? or just copy a row from db1 table1 to db2 table2?

Hiveminds Magazine | FireOrb | Drupal Street | Drupal offline manual

criznach’s picture

If you really do want to create a separate mysql database as said above, you'll need to write a module that implements hook_user and executes a MySQL statement to create each database when the 'register' operation is called. The MySQL user you are using for drupal must have the appropriate permissions set. And of course, you'll want to check for duplicates and all sorts of other fun error and security checking.

http://www.trailheadinteractive.com
--- Featured Projects ---
http://www.montanakitesports.com
http://www.cmrussell.org
http://www.tdandh.com
http://www.cccsmt.org
http://www.universalsemensales.com

thorie79’s picture

Here is another issue, i notice in the user table there aren't any type of group or something to indicate that the user is an admin user; except for users_roles table to tell what status is the user.

What i am trying to achieve here is setup an Admin users when a user first register, like in gmail if you are using it for company mail. At this stage, the new database is deployed for the Admin user. Then within this Admin user, any sub users can sign in but they need to be under the same Admin user's group. The Admin user retain control over all sub user's role, permission, etc.

From the looks of things to achieve this, i cannot use the users table to create the sub users. Right?