2 Replies Latest reply on May 2, 2007 1:11 PM by mgordon

    Automatic space creation

      Would it be possible to automatically create a space for each registered user?

        • Re: Automatic space creation

          hi mgordon,

           

          It''s not possible out of the box, but you could easily do something like this by writing some Java code and packaging it up as a plugin. Here''s how:

           

          1) Create a plugin (check out the plugin dev guide here: http://www.jivesoftware.com/builds/docs/clearspace/latest/ClearspacePluginDevelopmentGuide.html)

           

          2) Create a community / space called ''employees'' (or whatever you want to call the parent of all these spaces, the code below assumes the existence of a community / space called ''employees'')

           

          3) In the initializePlugin(..) method of the plugin you created in step 1:

           

                  UserEventDispatcher.getInstance().addListener(new UserListener() {
          
                      public void userCreated(UserEvent event) {
                          User newUser = event.getUser();
                          AuthToken system = AuthFactory.getSystemAuthToken();
                          JiveContext jiveContext = JiveApplication.getContext(system);
                          String communityName = newUser.getName() + "''s Space";
                          String displayName = newUser.getUsername();
                          jiveContext.getCommunityManager().getCommunity("employees")
                                  .createCommunity(communityName, displayName, "");
                      }
          
                      public void userDeleted(UserEvent event) {
          
                      }
          
                      public void userModified(UserEvent event) {
          
                      }
                  });
          

           

          4) Deploy your plugin via the admin console and you''re all set. For extra credit (and depending on your requirements) you''d probably want to set some specific permissions on the space / community you created. 

           

          Cheers,

           

          AJ