Trigger on user login/logout - nearly working solution

Author Message

Simon Phillips

Monday 28 February 2005 3:33:22 pm

Hi,

With a modification to the kernel, I've got triggers activating on user login and logout. However, something strange seems to be happening when I attach a workflow to the trigger - the login/logout event doesn't succeed on the first try - as if the workflow has sent back a status to tell it to wait. This means that one has to login/logout twice in order to get it working.

My login trigger is defined as follows in the operation_definition file:

$OperationList['login'] = array( 'name' => 'login',
                                'default_call_method' => array( 'include_file' => 'extension/spauthintegrate/modules/spauthhooks.php',
                                                                'class' => 'spauthhooks' ),
                                'parameter_type' => 'standard',
                                'parameters' => array( array( 'name' => 'user_id',
                                                              'type' => 'integer',
                                                              'required' => true )),
                                'keys' => array( 'user_id' ),

                                'body' => array( array( 'type' => 'trigger',
                                                        'name' => 'post_login',
                                                        'keys' => array( 'user_id')
                                                        )
												) 
								);

This trigger is activated by the following code at the correct point in the ezUser class:

            include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
    		include_once( 'kernel/classes/eztrigger.php' );

    		$dummy=& eZOperationHandler::execute( 'user', 'login', array( 'user_id' => $userID));

The trigger is attached to a workflow with a single workflow event which returns the following status : EZ_WORKFLOW_TYPE_STATUS_ACCEPTED.

The workflow executes the first time one tries to log in/out, and the log in/out functionality executes the second time one tries. From what I can tell, my workflow status is correct; what could the problem be?

If I run a method instead of calling a trigger in the above user/login trigger code, it works fine - but I'd prefer to use a workflow for this due to the potential other uses for the ez community.

<b>Please help</b>!

Thanks,
Simon

Xavier Dutoit

Sunday 27 March 2005 4:15:17 am

Hi Simon,

As you might have seen, workflows aren't that used (nor documented) and the ez crew says they are going to improve them (3.7 ?).

I was wondering if you've been able to find a solution on your problem ? If yes, I'd love to see how you solved it.

Good luck.

Xavier

http://www.sydesy.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 19 2025 01:21:42
Script start
Timing: Jan 19 2025 01:21:42
Module start 'layout'
Timing: Jan 19 2025 01:21:42
Module start 'content'
Timing: Jan 19 2025 01:21:42
Module end 'content'
Timing: Jan 19 2025 01:21:42
Script end

Main resources:

Total runtime0.5701 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 589.3047152.6406
Module start 'layout' 0.00520.0038 741.945339.4766
Module start 'content' 0.00900.5595 781.4219527.6094
Module end 'content' 0.56850.0016 1,309.031312.1250
Script end 0.5701  1,321.1563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.5501160.0002
Check MTime0.00120.2177160.0001
Mysql Total
Database connection0.00080.133510.0008
Mysqli_queries0.523491.8018540.0097
Looping result0.00080.1346520.0000
Template Total0.539294.620.2696
Template load0.00190.329420.0009
Template processing0.537394.242920.2687
Template load and register function0.00010.024010.0001
states
state_id_array0.00150.258510.0015
state_identifier_array0.00070.114020.0003
Override
Cache load0.00150.2656220.0001
Sytem overhead
Fetch class attribute can translate value0.00070.114320.0003
Fetch class attribute name0.00120.216130.0004
XML
Image XML parsing0.00060.109420.0003
class_abstraction
Instantiating content class attribute0.00000.002030.0000
General
dbfile0.00110.1914160.0001
String conversion0.00000.004740.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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: 13
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs