Skip to Content Skip to Menu

$myId = $_CB_framework->myId();

  • Gersha
  • Gersha
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
13 years 4 months ago #166831 by Gersha
$myId = $_CB_framework->myId(); was created by Gersha
hey,

Need to get users id from session. Tried with : $myId = $_CB_framework->myId();


Got error :
PHP Fatal error: Call to a member function myId() on a non-object

Could anyone help ?

Thanks,
Jones

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

  • clickmo
  • clickmo
  • OFFLINE
  • Posts: 55
  • Thanks: 1
  • Karma: 1
13 years 4 months ago #167612 by clickmo
Replied by clickmo on topic Re: $myId = $_CB_framework->myId();
This problem is related to not instantiating the global $_CB_framework where you need it.

For instance, if you have a function() and inside this function you need access to myId() then you need to call the global at the top of the function as such:
Code:
public function getId(){ global $_CB_framework; $myId = $_CB_framework->myId(); return $myId; }
The following user(s) said Thank You: Gersha

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

Moderators: beatnantkrileon
Powered by Kunena Forum