CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Information about Session
Pages: [1]

Author Topic: Information about Session  (Read 331 times)

phanhan

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 234
  • CMS version: joomla
  • MySQL version: 3.4
  • PHP version: 2.34
Information about Session
November 17, 2014, 01:13:22 am
Hello everybody.
So I have a live site and two sites on my local machine.

At civisprint I upgraded one of them (let's call it JohnFF2) to 4.4.

Then, on the other (let's call it JohnFF1), running 4.2 I experienced the following problem:

I'm querying the session to find my ID, then using that to get any relevant memberships. The function I'm using is:
 
$session = &CRM_Core_Session::singleton();
$contactID = $session->get('userID');

However, $session doesn't have a userID field, unless I masquerade as a different user, whereupon it mysteriously all works!

Any ideas?

1) Could doing the upgrade have broken some of my other settings somehow? (I doubt it, but worth asking).
2) How should I be getting my userID if not by this way?
3) Why is it working on the masquerade, and not on the not masquerade?

Thanks.

« Last Edit: October 21, 2015, 07:59:39 am by mathieu »

JohnFF

  • I post frequently
  • ***
  • Posts: 235
  • Karma: 6
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.31-1
  • PHP version: 5.3.27
Re: Information about Session
November 17, 2014, 03:59:29 am
Is one Drupal login connected to a CiviCRM id (via the uf table say) and the other isn't?

(It's interesting to see my brand being used to ask questions about upgrades I've done historically...)

Which module/extension are you finding this in?
If you like empowering charities in a free and open way, then you're going to love Civi.

Email Amender: https://civicrm.org/extensions/email-amender
UK Phone Validator: https://civicrm.org/extensions/uk-phone-number-validator
http://civifirst.com
https://twitter.com/civifirst

DaveFF

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 5
  • Developer at Future First
    • Future First
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.34
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Information about Session
November 18, 2014, 04:30:41 am
Is the ampersand necessary before CRM_Core_Session::singleton()? We don't have one when we get the logged-in cid that way.

http://php.net/manual/en/language.variables.basics.php says only named variables may be assigned by reference.
Do Not Contact Until extension: https://civicrm.org/extensions/do-not-contact-until
Organisation Name De-duplicator extension: https://civicrm.org/extensions/organisation-name-de-duplicator

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Information about Session

This forum was archived on 2017-11-26.