Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

How can I transfer a variable value with CB auto-action from an action to another

8 years 2 months ago #284247 by smalldragoon
hello
I have a variable ( a reference ID ) that I'm creating at CB auto-action "before login" , and I would like to transfer it and be able to use for another action " after login"
I can see in the parameters of CB-actions some variables but I don't find how to use them
Thanks for your insights !

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 2 months ago #284257 by krileon
If it's in the form POST data then a field action can store it fine and you can pull it from POST using [post_VARIABLE] (e.g. [post_referenceid]). Beyond that you'll need to better clarify how you're generating this variable, where, and what scope it's available to (e.g. is it in GET, POST, PHP variable?).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

8 years 2 months ago - 8 years 2 months ago #284349 by smalldragoon
Hi ,
Thanks for your answer.
In fact, it is linked to my other topic.
Before login, I generate a sessionID reference, that I want to pass accross pages to be able to use in a new CB-Action : after login , using a PHP script then

1 - user arrivs on login form
2 - CB action : generate sessionID
3 - user logs-in
4 - I have sessionID var avialble to use for some PHP script

Thx !
Last edit: 8 years 2 months ago by smalldragoon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 2 months ago #284359 by krileon
You need to store the ID somewhere so it can be accessed across pages. The best bet is to store it in their Joomla session and then you can access it reliably until they log out. Why is this needed? Joomla already handles a session id per user.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

8 years 2 months ago - 8 years 2 months ago #284364 by smalldragoon
Hi
I call it sessionID as a bad translation to english. let's call it : referencedeviceID
I'm implementing a devicefinger printing solution and I need to make a relation between the scan and the check ( after the login ) , which is this referenceID

Do you mean then something like that :
$session = JFactory::getSession();
$session->set('myrefID', '1234567890'); ?

And then, when needed , this ?

$MyrefID = $session->get('myrefID');
Last edit: 8 years 2 months ago by smalldragoon.

Please Log in or Create an account to join the conversation.

8 years 2 months ago - 8 years 2 months ago #284382 by smalldragoon
Hi,
After few debugging , I found why my ID are not matching where I though it was issues on variable sharing accross pages ...
Here is the code implemented regarding ID generation and sharing.
With the "debugging" as error output ( see attached ) , I can see the code being run multiple times... and then so, ID regenerated ( double checked, the 1st geenration is working well for javascript usage )

here is the code ... no loop or anything, why is it run multiple times ?
Code:
// generate random unique sessionID $MyREFSessionID = md5(microtime(true)); // create handle on session object and define sessionIDdevice for later use $mysession = JFactory::getSession(); $mysession->set('MyREFSessionID', $MyREFSessionID); $return = 'my java script removed to avoid posting issues '; $application = JFactory::getApplication(); $application->enqueueMessage(JText::_('My ref ID : ' .$MyREFSessionID), 'error'); return array( 'beforeForm' => $return );
Thx !

Attachments:
Last edit: 8 years 2 months ago by smalldragoon.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum