Muhammad Talha
Muhammad Talha

Reputation: 53

how to change SITE AREA constant dynamically in CI-BONFIRE?

I am new to bonfire, I am developing a system that incorporates three users

  1. Admin
  2. Clients
  3. Agents

I have changed login destination for each above mentioned users in bf_roles table in database, but the issue is that the SITEAREA constant defined in constant.php file under application folder,is set to admin i.e

define('SITE_AREA', 'admin');

I want to define sitearea according to the respective users i.e for clients it should be

define('SITE_AREA',clients);

now with the default site area set to admin, I get this address whenever I login using clients credentials

http://localhost/pbx/index.php/admin/

How to dynamically change the site area for each user?

Upvotes: 0

Views: 202

Answers (1)

Oluwafemi Sule
Oluwafemi Sule

Reputation: 38962

Since SITE_AREA is a view related constant. i.e. It's used only in views. It's definition can be moved to a later time in the application lifecycle, to a time before a view is rendered.e.g in your base controller:

  • Define a variable in your base controller that references the value of which SITE_AREA to use.

  • Selectively rename references to SITE_AREA in your view templates to the new variable name. ✌️

Upvotes: 0

Related Questions