Forums / Developer / workflow: user registration

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

eZ debug

Timing: Jan 18 2025 15:16:35
Script start
Timing: Jan 18 2025 15:16:35
Module start 'content'
Timing: Jan 18 2025 15:16:35
Module end 'content'
Timing: Jan 18 2025 15:16:35
Script end

Main resources:

Total runtime0.1889 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 587.7109180.8359
Module start 'content' 0.00520.0045 768.5469105.9922
Module end 'content' 0.00960.1792 874.5391534.2734
Script end 0.1888  1,408.8125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00321.6872200.0002
Check MTime0.00130.6701200.0001
Mysql Total
Database connection0.00080.419310.0008
Mysqli_queries0.148378.48451410.0011
Looping result0.00130.69071390.0000
Template Total0.178994.710.1789
Template load0.00080.439310.0008
Template processing0.178194.258810.1781
Override
Cache load0.00050.278410.0005
Sytem overhead
Fetch class attribute can translate value0.00070.346210.0007
XML
Image XML parsing0.00030.140310.0003
General
dbfile0.00180.9687200.0001
String conversion0.00000.002130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs