Author Topic: How not to create user workspaces  (Read 3330 times)

metabyte

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
How not to create user workspaces
« on: June 09, 2009, 11:05:31 am »
Hi,

I would like to know if there is a config option or dev hack so that when I create users, there is no workspace automatically generated for them.

Thanks

metabyte

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: How not to create user workspaces
« Reply #1 on: June 09, 2009, 10:14:58 pm »
Hi,

I think I just found where the modification is to be done: in the Controller.
Method A: Quick and Dirty Steps:
1) Edit file application/controllers/UserController.class.php
2) Got to line 221 and comment
Code: [Select]
//$project_user->save();
Method B: Configuration Driven (more elegant?):
1) Add to mysql table "og_config_options", assuming "og: your table prefix, the following:

Code: [Select]
INSERT INTO `eznetflow_config_options` VALUES ('', 'general', 'automatic_personal_workspace_generation', '0', 'BoolConfigHandler', '0', '0', 'Enable automatic personal user workspace creation');

2) Edit file application/controllers/UserController.class.php
3) Replace
Code: [Select]

/* create personal project */
$project = new Project();
by
Code: [Select]

/* create personal project */
if (config_option('automatic_personal_workspace_generation')) {
$project = new Project();

4) Replace
Code: [Select]
$project_user->save();
/* end personal project */

by
Code: [Select]
$project_user->save();
}
/* end personal project */


5) Update language files. For english, edit file language/en_us/administration.php and replace
Code: [Select]
   // General
    'config option name site_name' => 'Site name',
by
Code: [Select]
   // General
    'config option name automatic_personal_workspace_generation' => 'Enable automatic users personal workspace generation',
    'config option name site_name' => 'Site name',

Now, you can go to the Administration and configure if you wish to automatically generate user workspaces when you add them.

Now, I may probaby check what happens when we delet a user... TBC
« Last Edit: June 09, 2009, 10:17:38 pm by metabyte »

metabyte

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: How not to create user workspaces
« Reply #2 on: June 09, 2009, 11:04:49 pm »
One last thing to do in Method B:

Replace in application/controllers/UserController.class.php, around line 250
Code: [Select]
  // End: update contact info if user was created from a contact
  DB::commit();
  if (logged_user()->isProjectUser($new_project)) {
  evt_add("workspace added", array(
"id" => $new_project->getId(),
"name" => $new_project->getName(),
"color" => $new_project->getColor()
));
}

by

Code: [Select]
  // End: update contact info if user was created from a contact
  DB::commit();
if (config_option('automatic_personal_workspace_generation')) {
  if (logged_user()->isProjectUser($new_project)) {
  evt_add("workspace added", array(
"id" => $new_project->getId(),
"name" => $new_project->getName(),
"color" => $new_project->getColor()
));
}
  }

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: How not to create user workspaces
« Reply #3 on: June 24, 2009, 10:22:20 am »
Hi, on version 1.5 you will be able to select the user's Personal workspace from an existing one or automatically create one.