1

I can't seem to access session values on API definition. var_dump($_SESSION) returns an empty array event after putting session_start().

api/v3/MymoduleEntity.php

function civicrm_api3_mymodule_entity_method($params) {
  session_start();
  return var_dump($_SESSION); // Returns an empty array
  ...
}
1

You can try

-- Variable to set in CiviCRM session CRM_Core_Session::singleton()->set('myVariable', 'Yes, I am in current Session');

-- get value of variable from CiviCRM Session CRM_Core_Session::singleton()->get('myVariable');

HTH
Pradeep

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.