plainblack.com
Username Password
search
Bookmark and Share

Workflow Activity to Create Personal User Areas, When user is created.

This Workflow activity, will create a personal space for a user. The activity can be triggered when a new user is created at your site.
Its kind of a Dashboard thing, but all is made in code.

Its not ment to be an exhaustive example, but its ment to be build upon and its an idea for users who want to build personal user pages within their sites.

 

System Requirements

The "CreateUserHomeSkeleton.pm" file should be copied to
the "/data/WebGUI/lib/WebGUI/Workflow/Activity/"

The "Workflow_Activity_CreateUserHomeSkeleton.pm" should be copied to "/data/WebGUI/lib/WebGUI/i18n/English/"

Edit the configuration file for the site you want to test this on.
go to the "workflowActivities" section and a little down, you should see:

      "WebGUI::User" : [
         "WebGUI::Workflow::Activity::CreateCronJob",
         "WebGUI::Workflow::Activity::NotifyAboutUser"
      ]

add a line below "WebGUI::Workflow::Activity::CreateUserHomeSkeleton", so the section now looks something like this:

      "WebGUI::User" : [
         "WebGUI::Workflow::Activity::CreateCronJob",
         "WebGUI::Workflow::Activity::NotifyAboutUser",
         "WebGUI::Workflow::Activity::CreateUserHomeSkeleton"
      ]



After this is done, you can restart your webserver.

Next you need to setup a Workflow, which contains your new Activity. This is done in the adminconsole under "Workflow". Here you add a new workflow, and in "Object Type", you choose  "WebGUI::User" and then in the "Edit Workflow" screen, you choose a title for the workflow. IsEnabled is set to "Yes" and then  click the "Create User Home Skeleton" link in the bottom left corner, to add this Activity to your new Workflow.

You are now in the Add/Edit Form, of the Activity. Leave the title and description as they are. The "Page Layout Template" field is set to whatever page layout style template, you want for the user areas. The "Build In" field you enter the directory where you want the user pages to be Build In. For example, enter: membersites
to build the new user sites under http://www.yoursite.com/membersites/username/home

Now click "Save", and you are returned to the Workflow edit screen. Be sure to set "Is Enabled?" to Yes!
And check that "Mode" is set to the default value "Parallel".
 Now click save one last time.

Now we need to have the Workflow executed, whenever a user is created on the site. Go to Admin Console->Settings, and click on the "user" Tab. Here you set "On Create User (User)" to the name you gave your workflow.

Now click save, and for good measure, log out with the admin user and try to create a user (not from the admin but as a normal Visitor would do) and after that check that you can access the new user personal area at:

http://www.yoursite.com/membersites/username/home


If you can't access your home directory, be sure to read your webgui error log to see what might be the problem.


To be able to edit or add additional things to the users site, you can add him to the  "Turn Admin On" group. He can only add things under his own home directory. Some of the Assets can't be managed fully by the owner of the asset, but only as Admin user.

I don't know if this workflow is any useful for any of you, but I made it in an attempt to clarify (mostly to myself), how you can create assets in code and how you can add them on the fly, by utilizing the power of Workflows.
To get a better understanding of the workings of WebGUI, I suggest that you read the code also and take some time to modify the code to your needs.

 


Best regards

Comments
5ehab: "This is great as a matter of fact I was searching for something similar.

Is there a simple way to extend this where the user page will automatically get some assets inserted in it?"
0titlandata: "Greetings Ehab,
I will write something regarding this shortly, how you can add different assets, also in code, like for example:
Forums, Polls, Weatherdata etc.

"
5sduensin: "This is fantastic.  Thank you!"
0martien: "Great!

The missing link to a personal homepage "MyHome" is a redirect at login. This would easily be possible by extending the personal profile with a redirect-field and a redirect automatism during the login process.

I did this with by expanding the profile with a "myHomes" field which selects the root (/ or /homes ) to go to and I changed Auth::Login:

...
    elsif ( $self->session->user->profileField("myHome")."/".$self->user->username) ) {
       $self->session->http->setRedirect($self->session->user->profileField("myHome")."/".$self->user->username);
       }

..."
DownloadWorkflow_Activity_CreateUserHomeSkeleton.pm Workflow_Activity_CreateUserHomeSkeleton.pm
CreateUserHomeSkeleton.pm CreateUserHomeSkeleton.pm
LinksNo Support Offered
Statistics Downloads: 1684
Views: 3798
Rating: 5
Updated: 10/11/2008
Keywords activity auto autocreation content create Workflow
NavigationMore from Peter Bryde
Back to the Bazaar
© 2018 Plain Black Corporation | All Rights Reserved