| 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. 
CheersTore
 | 
                                                                                                    
                                                        | 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. 
CheersTore
 | 
                                                                                                    
                                                        | 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.  
CheersTore
 | 
                                                                                                    
                                                        | Tore Skobba
                                                                                                                             | Tuesday 27 April 2004 8:04:31 am 
                                                                 Hi again If possible, could you please mail me the file at [email protected]?  
CheersTore
 | 
                                                                                                    
                                                        | 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 [email protected] ?
 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 CubaWeb Design Cuba
 www.elfosdesign.com
 |