Welcome Guest, Not a member yet? Register   Sign In
Getting the customer id if session is not set
#4

(This post was last modified: 07-28-2016, 05:13 AM by InsiteFX.)

(07-28-2016, 04:27 AM)wolfgang1983 Wrote:
(07-28-2016, 04:19 AM)InsiteFX Wrote: You can add this to your class:

PHP Code:
// Add this as a class variable
protected static $customerId 0;

// Then to SET it do this
self::$customerId $customer_id;

// Then to GET it do this
$customer_id self::$customerId

Do I put the bottom 2 in the __construct() area?

You first need to get your customers id, I would create two new methods setCustomerId() and getCustomerId()

I see you are getting the customers id in the postLogin method so that would be were you would set it.

You get the customer id anywhere you need it after that.

Also if you do not need the customers id outside of this class then make the variable private.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Getting the customer id if session is not set - by InsiteFX - 07-28-2016, 04:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB