workflow: user registration

Author Message

Sebastian Sprenger

Tuesday 24 February 2004 1:29:25 am

Hi all!
I want to create a workflow that reacts on user registration and user editing. I tried the trigger 'content / publish / after', but it doesn't seem to work on creation/editing of users.
My aim is: I want to move users to this or that usergroup, depending on what they fill out in the registration form.

Any ideas? Thanks!
Sebastian

Tore Skobba

Tuesday 24 February 2004 1:58:27 am

Hi

If you manage to do this could you please post some tips, I am also very interessted in how to do that.

Cheers
Tore

Sebastian Sprenger

Tuesday 24 February 2004 5:59:40 am

OK, 'content/publish/after' works, I had an error in my script.
I wrote a workflow which is started by a trigger on publish-event. Then I will 'copy' the user to another usergroup, depending on what he wrote in the form. The data from the form I get from the data_map. For copying the user I use node assignment.
Sebastian

Tore Skobba

Sunday 18 April 2004 3:32:13 pm

Hi Sebastian

If possible, could you please post your code as I trying to make the same stuff myself.

Cheers
Tore

Sebastian Sprenger

Monday 19 April 2004 11:01:47 am

Hi Tore,
I will post the code next week, unfurtunately I'm not in the office before next monday, sorry!
Sebastian

Sebastian Sprenger

Monday 26 April 2004 12:14:07 am

Hi!
Here a few lines from the code. If you want I could mail the complete file.

First get some general infos:

$parameters = $process->attribute( 'parameter_list' );
$object =& eZContentObject::fetch( $parameters['object_id'] );
$objectId= $parameters['object_id'];

Status is a ezselect attribute that I use to decide, what should happen to the user object.

$status = $data_map['status']->attribute('data_text');

Depending on this attribute the following code will be executed (or not):

// get latest Version number
$maxVersion =& $object->getVersionCount();
$allVersions = $object->versions();
$latestVersion = $allVersions[$maxVersion-1];
$maxVersion= $latestVersion->attribute('version');
$version =& $object->version( $maxVersion );

// get all Nodeassignments
$nodeAssignments = $version->nodeAssignments();

// remove all assignments with main_node_id = 546
foreach ($nodeAssignments as $assignment) {
	$parentObject = $assignment->getParentNode();
	if ($parentObject->attribute('main_node_id') == 546) {
		$version->removeAssignment(546);
	} else {
		// if an assignment is 'main', remove and create a new one without 'main'
		if ($assignment->attribute( 'is_main' ) == '1') {
			$nodeId = $assignment->getParentNode();
			$version->removeAssignment($nodeId);
			$version->assignToNode($nodeId, 0);
		}
	}
}
//set new assignment, here: 12
$version->removeAssignment(12);
$version->assignToNode(12, 1, 546);
$version->store();

Hope this helps. Just post any questions.
Sebastian

Tore Skobba

Monday 26 April 2004 3:18:22 am

Thank you very much, I really appreciate it. However, I have started to fall back on my first solution which is an SQL script which updates the database tables. Due to that I found workflow programming highly complex and not very intuitive. But if my SQL scripts fail then I will probably step back into the workflow solution.

Cheers
Tore

Tore Skobba

Tuesday 27 April 2004 8:04:31 am

Hi again

If possible, could you please mail me the file at tore@grunderskolen.no?

Cheers
Tore

Giovanni Gigante

Wednesday 20 April 2005 10:40:30 am

Sebastian Sprenger,
I am extremely interested in your solution, too.
I have exactly the same problem!
Could you post the entire code of your solution? Or perhaps mail it to me at giov@cidoc.iuav.it ?
Thanks a lot!
Giovanni

Xavier Dutoit

Thursday 21 April 2005 12:35:11 am

Hi Sebastian,

Could you please consider adding it to the contributions here http://www.ez.no/community/contribs/workflow as we lake of examples of events ?

Better yet, request a svn account to paul (have a look at pubsvn.ez.no ).

X+

http://www.sydesy.com

Giovanni Gigante

Thursday 21 April 2005 3:16:07 am

Sebastian told me that he no longer works with EZ nor has his code anymore.
Anyone else has experience with this?

Jorge estévez

Sunday 01 May 2005 3:35:56 am

Hi Tore and Giovanni : Any ideas, have you the whole code? I need a similar solution too

I have posted the following comment at this forum: http://ez.no/community/forum/developer/e_commerce_site_tasks_to_do_after_buying

Please any Ideas or futher comments or code will be great...

thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 18:19:14
Script start
Timing: Jan 18 2025 18:19:14
Module start 'layout'
Timing: Jan 18 2025 18:19:14
Module start 'content'
Timing: Jan 18 2025 18:19:15
Module end 'content'
Timing: Jan 18 2025 18:19:15
Script end

Main resources:

Total runtime0.6675 sec
Peak memory usage4,096.0000 KB
Database Queries90

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 587.9141152.6250
Module start 'layout' 0.00540.0040 740.539139.4453
Module start 'content' 0.00940.6538 779.9844744.3672
Module end 'content' 0.66310.0043 1,524.351620.1641
Script end 0.6674  1,544.5156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00540.8146160.0003
Check MTime0.00320.4752160.0002
Mysql Total
Database connection0.00060.083410.0006
Mysqli_queries0.591888.6672900.0066
Looping result0.00080.1198880.0000
Template Total0.627494.020.3137
Template load0.00210.315820.0011
Template processing0.625393.675420.3126
Template load and register function0.00020.034510.0002
states
state_id_array0.00130.200910.0013
state_identifier_array0.00130.192220.0006
Override
Cache load0.00180.2761670.0000
Sytem overhead
Fetch class attribute can translate value0.00050.076150.0001
Fetch class attribute name0.00120.1784130.0001
XML
Image XML parsing0.00090.134850.0002
class_abstraction
Instantiating content class attribute0.00000.0034130.0000
General
dbfile0.00360.5453160.0002
String conversion0.00000.001840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
12content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
20content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 50
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs