eZ Community » Forums » Developer » eZUser::currentUser() returns anonymous
expandshrink

eZUser::currentUser() returns anonymous

eZUser::currentUser() returns anonymous

Saturday 17 July 2010 9:02:37 pm - 1 reply

Hello,

I'm currently working on an extension for paying registration into eZPublish. To build this, i'm using 2 workflow/triggers :

  • checkout > before to pay with a bank extension i made,
  • checkout > after to put user into the premium user group for a limited time.

I'm having a problem in checkout > after : using eZUser::currentUser() always returns anonymous user.

I tryed to watch the $process parameter of the execute() method my workflow : user id passed in the object is 10 too (anonymous user); so i cannot find a way to get my current user.

If i disable the payment workflow/trigger, i can get my user normally using eZUser::currentUser().

Am i doing something wrong ?

Regards,
Stéphane.

PS : I'm using eZPublish 4.3

Modified on Saturday 17 July 2010 10:59:21 pm by Stéphane Le Merre

Sunday 18 July 2010 1:05:58 am

I found out how to solve this, the checkout->after workflow is call by the bank script with no session in it, that's why eZUser::currentUser() returns anonymous. Quiet stupid question but i'm tired happy.gif Emoticon

Maybe solution can help, so i get the user from the order_id :

function execute( $process, $event )
 {
     $bResult = false;
     $s = new PremiumSubscription();
 
     $processParams  = $process->attribute( 'parameter_list' );
     $orderID        = $processParams['order_id'];
     $order          = eZOrder::fetch( $orderID );
     $currentUser    = $order->user();
     $userId         = $currentUser->id();
 
     //...
}

Regards,
Stéphane.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from