<?php if ($user_groups) { ?>
<?php foreach ($user_groups as $user_group) { ?>
<?php echo $user_group['user_group_id']==???? ; ?>
Add the following to the end of "admin/model/user/user.php":
Code: Select all
public function getUserGroup($user_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user u LEFT JOIN " . DB_PREFIX . "user_group ug ON (u.user_group_id = ug.user_group_id) WHERE u.user_id = '" . (int)$user_id . "'");
return $query->row['name'];
}
Code: Select all
$this->load->model('user/user');
$this->data['user_group'] = $this->model_user_user->getUserGroup($this->user->getId());
Code: Select all
<?php echo $user_group; ?>
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
i just want to hide the menus for people in groups not admin
if there is no query for that how can i grab the name of the logged in user??
eg if logged in user is "administrator" show all menus in template....if logged in user is in vendor group, show catalogue and sales ONLY?
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
Make a copy of your "admin/view/template/common/header.tpl" and remove the links to items you don't want the "non-top admin" users to see.
Insert this query into the model (admin/model/user/user.php):
Code: Select all
public function getUserGroupId($user_id) {
$query = $this->db->query("SELECT DISTINCT user_group_id FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$user_id . "'");
return $query->row['user_group_id'];
}
Code: Select all
$this->template = 'common/header.tpl';
Code: Select all
$this->load->model('user/user');
if ($this->model_user_user->getUserGroupId($this->user->getId()) == 1) {
$this->template = 'common/header.tpl';
} else {
$this->template = 'common/new_header.tpl';
}
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
Please use proper English at all times, so that all members may understand you.
Users browsing this forum: Amazon [Bot] and 10 guests